Commit 9bd29655 by 宁斌

Merge remote-tracking branch 'origin/dev' into dev

parents b1b0ebb2 7b55a06f
...@@ -4,6 +4,10 @@ buildscript { ...@@ -4,6 +4,10 @@ buildscript {
ext.kotlin_version = '1.4.21' ext.kotlin_version = '1.4.21'
repositories { repositories {
maven { url 'https://maven.google.com' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' } //gradle 国内镜像仓
maven { url 'https://maven.aliyun.com/repository/google' } //google 国内镜像仓
maven { url 'https://maven.aliyun.com/repository/jcenter' } //jcenter 国内镜像仓
// 添加阿里云 maven 地址 // 添加阿里云 maven 地址
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' } maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' } maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
...@@ -34,6 +38,10 @@ buildscript { ...@@ -34,6 +38,10 @@ buildscript {
allprojects { allprojects {
repositories { repositories {
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' } //gradle 国内镜像仓
maven { url 'https://maven.aliyun.com/repository/google' } //google 国内镜像仓
maven { url 'https://maven.aliyun.com/repository/jcenter' } //jcenter 国内镜像仓
// 添加阿里云 maven 地址 // 添加阿里云 maven 地址
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' } maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' } maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
......
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gingersoft.gsa.cloud.scan"> package="com.gingersoft.gsa.cloud.scan">
...@@ -9,11 +10,11 @@ ...@@ -9,11 +10,11 @@
<uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application android:networkSecurityConfig="@xml/network_android"> <application android:networkSecurityConfig="@xml/network_android">
<activity android:name=".mvp.ui.activity.MipcaCaptureActivity"/> <activity android:name=".mvp.ui.activity.MultiScanCodeActivity"/>
<activity android:name=".mvp.ui.activity.MipcaCaptureActivity" />
</application> </application>
</manifest> </manifest>
\ No newline at end of file
package com.gingersoft.gsa.cloud.scan; package com.gingersoft.gsa.cloud.scan;
import android.util.Log;
import com.billy.cc.core.component.CC; import com.billy.cc.core.component.CC;
import com.billy.cc.core.component.CCResult;
import com.billy.cc.core.component.CCUtil; import com.billy.cc.core.component.CCUtil;
import com.billy.cc.core.component.IComponent; import com.billy.cc.core.component.IComponent;
import com.gingersoft.gsa.cloud.component.ComponentName; import com.gingersoft.gsa.cloud.component.ComponentName;
import com.gingersoft.gsa.cloud.scan.mvp.ui.activity.MipcaCaptureActivity; import com.gingersoft.gsa.cloud.scan.mvp.ui.activity.MipcaCaptureActivity;
import com.gingersoft.gsa.cloud.scan.mvp.ui.activity.MultiScanCodeActivity;
/** /**
* @作者: bin * @作者: bin
...@@ -40,6 +38,9 @@ public class ComponentScan implements IComponent { ...@@ -40,6 +38,9 @@ public class ComponentScan implements IComponent {
switch (actionName) { switch (actionName) {
case "openScanActivity": case "openScanActivity":
return openScanActivity(cc); return openScanActivity(cc);
case "openMultiScanActivity":
CCUtil.navigateTo(cc, MultiScanCodeActivity.class);
return true;
default: default:
//这个逻辑分支上没有调用CC.sendCCResult(...),是一种错误的示例 //这个逻辑分支上没有调用CC.sendCCResult(...),是一种错误的示例
//并且方法的返回值为false,代表不会异步调用CC.sendCCResult(...) //并且方法的返回值为false,代表不会异步调用CC.sendCCResult(...)
......
...@@ -10,6 +10,8 @@ import android.net.Uri; ...@@ -10,6 +10,8 @@ import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment; import android.os.Environment;
import android.os.Parcel;
import android.os.VibrationEffect;
import android.os.Vibrator; import android.os.Vibrator;
import android.provider.DocumentsContract; import android.provider.DocumentsContract;
import android.provider.MediaStore; import android.provider.MediaStore;
...@@ -113,25 +115,13 @@ public class MipcaCaptureActivity extends BaseActivity<BasePresenter> implements ...@@ -113,25 +115,13 @@ public class MipcaCaptureActivity extends BaseActivity<BasePresenter> implements
public void initTopBar() { public void initTopBar() {
mTopBar.setBackgroundColor(ContextCompat.getColor(this, R.color.theme_color)); mTopBar.setBackgroundColor(ContextCompat.getColor(this, R.color.theme_color));
mTopBar.removeAllLeftViews(); mTopBar.removeAllLeftViews();
mTopBar.addLeftBackImageButton().setOnClickListener(new View.OnClickListener() { mTopBar.addLeftBackImageButton().setOnClickListener(v -> scanResult(""));
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.putExtra(QR_RESULT_CODE, "");
setResult(ScanHelper.CALL_BACK_QR_RESULT, intent);
killMyself();
}
});
mTopBar.setTitle(title); mTopBar.setTitle(title);
} }
@Override @Override
public void onBackPressed() { public void onBackPressed() {
Intent intent = new Intent(); scanResult("");
intent.putExtra(QR_RESULT_CODE, "");
setResult(ScanHelper.CALL_BACK_QR_RESULT, intent);
killMyself();
} }
@Override @Override
...@@ -171,9 +161,13 @@ public class MipcaCaptureActivity extends BaseActivity<BasePresenter> implements ...@@ -171,9 +161,13 @@ public class MipcaCaptureActivity extends BaseActivity<BasePresenter> implements
super.onDestroy(); super.onDestroy();
} }
private void vibrate() { public void vibrate() {
Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
vibrator.vibrate(200); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
vibrator.vibrate(VibrationEffect.createOneShot(200, VibrationEffect.DEFAULT_AMPLITUDE));
} else {
vibrator.vibrate(200);
}
} }
@OnClick({R2.id.btn_album}) @OnClick({R2.id.btn_album})
...@@ -256,8 +250,11 @@ public class MipcaCaptureActivity extends BaseActivity<BasePresenter> implements ...@@ -256,8 +250,11 @@ public class MipcaCaptureActivity extends BaseActivity<BasePresenter> implements
public void onScanQRCodeSuccess(String result) { public void onScanQRCodeSuccess(String result) {
Log.i(TAG, "onScanQRCodeSuccess:" + result); Log.i(TAG, "onScanQRCodeSuccess:" + result);
vibrate(); vibrate();
mZXingView.startSpot(); // mZXingView.startSpot();
scanResult(result);
}
protected void scanResult(String result) {
Intent intent = new Intent(); Intent intent = new Intent();
intent.putExtra(QR_RESULT_CODE, result); intent.putExtra(QR_RESULT_CODE, result);
setResult(ScanHelper.CALL_BACK_QR_RESULT, intent); setResult(ScanHelper.CALL_BACK_QR_RESULT, intent);
...@@ -267,6 +264,7 @@ public class MipcaCaptureActivity extends BaseActivity<BasePresenter> implements ...@@ -267,6 +264,7 @@ public class MipcaCaptureActivity extends BaseActivity<BasePresenter> implements
killMyself(); killMyself();
} }
@Override @Override
public void onCameraAmbientBrightnessChanged(boolean isDark) { public void onCameraAmbientBrightnessChanged(boolean isDark) {
// 这里是通过修改提示文案来展示环境是否过暗的状态,接入方也可以根据 isDark 的值来实现其他交互效果 // 这里是通过修改提示文案来展示环境是否过暗的状态,接入方也可以根据 isDark 的值来实现其他交互效果
......
package com.gingersoft.gsa.cloud.scan.mvp.ui.activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.RadioGroup;
import androidx.annotation.Nullable;
import com.billy.cc.core.component.CC;
import com.billy.cc.core.component.CCResult;
import com.billy.cc.core.component.CCUtil;
import com.gingersoft.gsa.cloud.common.scan.ScanHelper;
import com.gingersoft.gsa.cloud.scan.R;
import com.gingersoft.gsa.cloud.scan.R2;
import com.xuexiang.rxutil2.rxjava.RxJavaUtils;
import java.util.ArrayList;
import butterknife.BindView;
import io.reactivex.functions.Consumer;
/**
* 可選多次掃碼
*
* @author admin
*/
public class MultiScanCodeActivity extends MipcaCaptureActivity {
@BindView(R2.id.rb_scan_type)
RadioGroup mRbScanType;
ArrayList<String> mScanValues;
@Override
public void initData(@Nullable Bundle savedInstanceState) {
super.initData(savedInstanceState);
mRbScanType.setVisibility(View.VISIBLE);
}
@Override
public void onScanQRCodeSuccess(String result) {
//掃完一個碼後
//將掃描內容存儲下來
if (mRbScanType.getCheckedRadioButtonId() == R.id.rb_single_scan) {
//單個掃碼
vibrate();
super.scanResult(result);
} else {
if (mScanValues == null) {
mScanValues = new ArrayList<>();
}
if (!mScanValues.contains(result)) {
vibrate();
mScanValues.add(result);
if (mScanValues.size() >= 10) {
scanResult("");
}
showMessage("掃描結果:" + result + ",已掃描" + mScanValues.size() + "個");
} else {
showMessage("SN碼已掃描,請更換SN碼");
}
mZXingView.stopSpot();
//延遲一秒再啟動
RxJavaUtils.delay(1, aLong -> mZXingView.startSpot());
}
}
@Override
protected void scanResult(String result) {
Intent intent = new Intent();
intent.putStringArrayListExtra(QR_RESULT_CODE, mScanValues);
setResult(ScanHelper.CALL_BACK_QR_RESULT, intent);
CC.sendCCResult(CCUtil.getNavigateCallId(this), CCResult.success(QR_RESULT_CODE, mScanValues));
killMyself();
}
}
\ No newline at end of file
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" > android:layout_height="match_parent">
<cn.bingoogolapple.qrcode.zxing.ZXingView <cn.bingoogolapple.qrcode.zxing.ZXingView
android:id="@+id/zxingview" android:id="@+id/zxingview"
...@@ -55,18 +55,59 @@ ...@@ -55,18 +55,59 @@
android:id="@+id/btn_album" android:id="@+id/btn_album"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/topbar"
android:layout_gravity="right"
android:layout_margin="@dimen/dp_10" android:layout_margin="@dimen/dp_10"
android:text="相冊" android:layout_marginTop="@dimen/head_height"
android:background="@drawable/shape_delivery_item_btn_normal"
android:paddingLeft="@dimen/normal_space12" android:paddingLeft="@dimen/normal_space12"
android:paddingRight="@dimen/normal_space12"
android:paddingTop="@dimen/normal_space5" android:paddingTop="@dimen/normal_space5"
android:paddingRight="@dimen/normal_space12"
android:paddingBottom="@dimen/normal_space5" android:paddingBottom="@dimen/normal_space5"
android:text="相冊"
android:textColor="@color/white" android:textColor="@color/white"
android:layout_below="@+id/topbar" android:textSize="@dimen/font_normal2" />
android:layout_marginTop="@dimen/head_height"
android:background="@drawable/shape_delivery_item_btn_normal" <RadioGroup
android:textSize="@dimen/font_normal2" android:id="@+id/rb_scan_type"
android:layout_gravity="right"/> android:layout_width="match_parent"
<!-- </LinearLayout>--> android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginLeft="@dimen/dp_20"
android:layout_marginRight="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_20"
android:orientation="horizontal"
android:visibility="gone">
<com.google.android.material.radiobutton.MaterialRadioButton
android:id="@+id/rb_single_scan"
style="@style/app_btn_style"
android:layout_width="@dimen/dp_0"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/selector_app_btn"
android:button="@null"
android:checked="true"
android:gravity="center"
android:paddingTop="@dimen/dp_12"
android:paddingBottom="@dimen/dp_12"
android:text="@string/str_single_scan"
android:textColor="@color/s_3c_to_white" />
<com.google.android.material.radiobutton.MaterialRadioButton
android:id="@+id/rb_multi_scan"
style="@style/Cancel_Btn_Style"
android:layout_width="@dimen/dp_0"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_13"
android:layout_weight="1"
android:background="@drawable/selector_app_btn"
android:button="@null"
android:gravity="center"
android:paddingTop="@dimen/dp_12"
android:paddingBottom="@dimen/dp_12"
android:text="@string/str_continuous_scan"
android:textColor="@color/s_3c_to_white" />
</RadioGroup>
</FrameLayout> </FrameLayout>
</LinearLayout> </LinearLayout>
\ 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.SnInOutboundRecordsModule;
import com.gingersoft.supply_chain.mvp.contract.SnInOutboundRecordsContract;
import com.jess.arms.di.scope.FragmentScope;
import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.SnInOutboundRecordsFragment;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 05/11/2021 11:05
* <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 = SnInOutboundRecordsModule.class, dependencies = AppComponent.class)
public interface SnInOutboundRecordsComponent {
void inject(SnInOutboundRecordsFragment fragment);
@Component.Builder
interface Builder {
@BindsInstance
SnInOutboundRecordsComponent.Builder view(SnInOutboundRecordsContract.View view);
SnInOutboundRecordsComponent.Builder appComponent(AppComponent appComponent);
SnInOutboundRecordsComponent build();
}
}
\ 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.SnInOutboundRecordsContract;
import com.gingersoft.supply_chain.mvp.model.SnInOutboundRecordsModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 05/11/2021 11:05
* <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 SnInOutboundRecordsModule {
@Binds
abstract SnInOutboundRecordsContract.Model bindSnInOutboundRecordsModel(SnInOutboundRecordsModel model);
}
\ No newline at end of file
package com.gingersoft.supply_chain.mvp.bean;
import java.util.List;
/**
* @author 宇航. 1239658231@qq.com
* User: admin
* Date: 2021/5/12
* Time: 14:52
* Use:
*/
public class SnInOutBoundRecordDetailsBean {
private List<ConsumeDetailsBean> consumeDetails;
private List<InventoryDetailsBean> inventoryDetails;
public List<ConsumeDetailsBean> getConsumeDetails() {
return consumeDetails;
}
public void setConsumeDetails(List<ConsumeDetailsBean> consumeDetails) {
this.consumeDetails = consumeDetails;
}
public List<InventoryDetailsBean> getInventoryDetails() {
return inventoryDetails;
}
public void setInventoryDetails(List<InventoryDetailsBean> inventoryDetails) {
this.inventoryDetails = inventoryDetails;
}
public static class ConsumeDetailsBean {
/**
* consumeType : 退貨消耗
* createTime : 1620802300554
* orderNo : DN20211051294171381
* remarks : 哈哈哈哈
* uid : 397
* userName : wyh
*/
private String consumeType;
private long createTime;
private String orderNo;
private String remarks;
private int uid;
private String userName;
public String getConsumeType() {
return consumeType;
}
public void setConsumeType(String consumeType) {
this.consumeType = consumeType;
}
public long getCreateTime() {
return createTime;
}
public void setCreateTime(long createTime) {
this.createTime = createTime;
}
public String getOrderNo() {
return orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks;
}
public int getUid() {
return uid;
}
public void setUid(int uid) {
this.uid = uid;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
}
public static class InventoryDetailsBean {
/**
* storageType : 調撥入庫
* createTime : 1620696962112
* orderNo : RK202105111037773
* remarks :
* uid : 397
* userName : wyh
*/
private String storageType;
private long createTime;
private String orderNo;
private String remarks;
private int uid;
private String userName;
public String getStorageType() {
return storageType;
}
public void setStorageType(String storageType) {
this.storageType = storageType;
}
public long getCreateTime() {
return createTime;
}
public void setCreateTime(long createTime) {
this.createTime = createTime;
}
public String getOrderNo() {
return orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks;
}
public int getUid() {
return uid;
}
public void setUid(int uid) {
this.uid = uid;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
}
}
package com.gingersoft.supply_chain.mvp.bean;
/**
* @author 宇航. 1239658231@qq.com
* User: admin
* Date: 2021/5/12
* Time: 11:24
* Use:
*/
public class SnInoutBoundRecordBean {
/**
* encodeFoodNo : Mdse1379
* encodeOrderNo : RK202105111037773
* encodeSnNo : 111
* status : 1
* brandId : 1
* restaurantId : 26
* purchaseWarehousingOrderDetailsIds : 1225
* name : 荷兰烤肉SN
*/
private String encodeFoodNo;
private String encodeOrderNo;
private String encodeSnNo;
/**
* 是否出库:1未出库{@link NOT_OUT_STOCK},2已出库{@link OUT_STOCK}
*/
private int status;
public static int OUT_STOCK = 2;
public static int NOT_OUT_STOCK = 1;
private int brandId;
private int restaurantId;
/**
* 入库详情id
*/
private String purchaseWarehousingOrderDetailsIds;
private String name;
private String images;
/**
* 是否已經加載過詳情了
*/
private boolean isLoadDetails = false;
public String getEncodeFoodNo() {
return encodeFoodNo;
}
public void setEncodeFoodNo(String encodeFoodNo) {
this.encodeFoodNo = encodeFoodNo;
}
public String getEncodeOrderNo() {
return encodeOrderNo;
}
public void setEncodeOrderNo(String encodeOrderNo) {
this.encodeOrderNo = encodeOrderNo;
}
public String getEncodeSnNo() {
return encodeSnNo;
}
public void setEncodeSnNo(String encodeSnNo) {
this.encodeSnNo = encodeSnNo;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getBrandId() {
return brandId;
}
public void setBrandId(int brandId) {
this.brandId = brandId;
}
public int getRestaurantId() {
return restaurantId;
}
public void setRestaurantId(int restaurantId) {
this.restaurantId = restaurantId;
}
public String getPurchaseWarehousingOrderDetailsIds() {
return purchaseWarehousingOrderDetailsIds;
}
public void setPurchaseWarehousingOrderDetailsIds(String purchaseWarehousingOrderDetailsIds) {
this.purchaseWarehousingOrderDetailsIds = purchaseWarehousingOrderDetailsIds;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getImages() {
return images;
}
public void setImages(String images) {
this.images = images;
}
public boolean isLoadDetails() {
return isLoadDetails;
}
public void setLoadDetails(boolean loadDetails) {
isLoadDetails = loadDetails;
}
}
package com.gingersoft.supply_chain.mvp.content; package com.gingersoft.supply_chain.mvp.content;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager; import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.supply_chain.BuildConfig;
import java.util.Map; import java.util.Map;
......
package com.gingersoft.supply_chain.mvp.contract;
import com.chad.library.adapter.base.BaseBinderAdapter;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
import java.util.Map;
import io.reactivex.Observable;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 05/11/2021 11:05
* <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 SnInOutboundRecordsContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
void showEmpty();
void loadAdapter(BaseBinderAdapter baseBinderAdapter);
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
/**
* 跟進SN查詢出入庫記錄
*
* @param map
* @return
*/
Observable<BaseResult> getFoodInOutBoundRecordBySnCode(Map<String, Object> map);
/**
* 查詢出入庫記錄詳情
*
* @param map
* @return
*/
Observable<BaseResult> getFoodInOutBoundRecordDetails(Map<String, Object> map);
}
}
package com.gingersoft.supply_chain.mvp.model;
import android.app.Application;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.function.PutRestaurantInfo;
import com.gingersoft.gsa.cloud.common.function.click.CheckLoginState;
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.SnInOutboundRecordsContract;
import java.util.Map;
import io.reactivex.Observable;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 05/11/2021 11:05
* <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 SnInOutboundRecordsModel extends BaseModel implements SnInOutboundRecordsContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public SnInOutboundRecordsModel(IRepositoryManager repositoryManager) {
super(repositoryManager);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mGson = null;
this.mApplication = null;
}
@Override
public Observable<BaseResult> getFoodInOutBoundRecordBySnCode(@PutRestaurantInfo Map<String, Object> map) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).getFoodInOutBoundRecordBySnCode(map);
}
@Override
public Observable<BaseResult> getFoodInOutBoundRecordDetails(@PutRestaurantInfo Map<String, Object> map) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).getFoodInOutBoundRecordDetails(map);
}
}
\ No newline at end of file
...@@ -3,6 +3,7 @@ package com.gingersoft.supply_chain.mvp.model; ...@@ -3,6 +3,7 @@ package com.gingersoft.supply_chain.mvp.model;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.common.bean.BaseResult; import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.function.PutRestaurantInfo;
import com.gingersoft.supply_chain.mvp.bean.SupplierResultBean; import com.gingersoft.supply_chain.mvp.bean.SupplierResultBean;
import com.gingersoft.supply_chain.mvp.contract.SupplierListContract; import com.gingersoft.supply_chain.mvp.contract.SupplierListContract;
import com.gingersoft.supply_chain.mvp.server.SupplierServer; import com.gingersoft.supply_chain.mvp.server.SupplierServer;
......
...@@ -204,7 +204,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient ...@@ -204,7 +204,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
infoMultiBeans.add(new UploadPicMultiBean(InfoMultiBean.EDIT_FOOD_ITEM_UPLOAD_PIC, "圖片上傳", R.drawable.png_upload_pic)); infoMultiBeans.add(new UploadPicMultiBean(InfoMultiBean.EDIT_FOOD_ITEM_UPLOAD_PIC, "圖片上傳", R.drawable.png_upload_pic));
infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_LINE)); infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_LINE));
infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_TITLE, "基本信息")); infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_TITLE, "基本信息"));
infoMultiBeans.add(new MultiSelectBean(InfoMultiBean.EDIT_FOOD_ITEM_SELECT, "所屬供應商", true, "請輸入/選擇供應商", SELECT_SUPPLIER_RESULTCODE, true, new InputFilter[]{InputFilterUtils.getLengthFilter(context, 100), InputFilterUtils.getChAndEnAndNumInputFilter(context)}, SupplierListFragment.class)); infoMultiBeans.add(new MultiSelectBean(InfoMultiBean.EDIT_FOOD_ITEM_SELECT, "所屬供應商", true, "請輸入/選擇供應商", SELECT_SUPPLIER_RESULTCODE, true, SupplierListFragment.class));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "食材名稱", true, "請輸入名稱", new InputFilter[]{InputFilterUtils.getLengthFilter(context, 200), InputFilterUtils.getChAndEnAndNumAndPtInputFilter(context)}, InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES)); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "食材名稱", true, "請輸入名稱", new InputFilter[]{InputFilterUtils.getLengthFilter(context, 200), InputFilterUtils.getChAndEnAndNumAndPtInputFilter(context)}, InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES));
infoMultiBeans.add(new MultiSelectBean(InfoMultiBean.EDIT_FOOD_ITEM_SELECT, "食材類別", true, "請選擇食材類別", SELECT_FOOD_CATEGORY_REQUEST_CODE, CategorySelectFragment.class)); infoMultiBeans.add(new MultiSelectBean(InfoMultiBean.EDIT_FOOD_ITEM_SELECT, "食材類別", true, "請選擇食材類別", SELECT_FOOD_CATEGORY_REQUEST_CODE, CategorySelectFragment.class));
infoMultiBeans.add(new MultiSelectBean(InfoMultiBean.EDIT_FOOD_ITEM_SELECT, "基本單位", true, "請選擇食材單位", SELECT_PACKAGE_SPECIFICATION_REQUEST_CODE, FoodUnitPageFragment.class)); infoMultiBeans.add(new MultiSelectBean(InfoMultiBean.EDIT_FOOD_ITEM_SELECT, "基本單位", true, "請選擇食材單位", SELECT_PACKAGE_SPECIFICATION_REQUEST_CODE, FoodUnitPageFragment.class));
......
package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application;
import com.chad.library.adapter.base.BaseBinderAdapter;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.utils.CollectionUtils;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.SnInOutBoundRecordDetailsBean;
import com.gingersoft.supply_chain.mvp.bean.SnInoutBoundRecordBean;
import com.gingersoft.supply_chain.mvp.content.PurchaseConstant;
import com.gingersoft.supply_chain.mvp.ui.adapter.binder.SnInOutRecordBinder;
import com.gingersoft.supply_chain.mvp.ui.adapter.binder.SnInRecordDetailsBinder;
import com.gingersoft.supply_chain.mvp.ui.adapter.binder.SnOutRecordDetailsBinder;
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.SnInOutboundRecordsContract;
import com.jess.arms.utils.RxLifecycleUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 05/11/2021 11:05
* <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 SnInOutboundRecordsPresenter extends BasePresenter<SnInOutboundRecordsContract.Model, SnInOutboundRecordsContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
private BaseBinderAdapter baseBinderAdapter;
@Inject
public SnInOutboundRecordsPresenter(SnInOutboundRecordsContract.Model model, SnInOutboundRecordsContract.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 getFoodInOutBoundRecordBySnCode(String encodeSnNo) {
if (TextUtil.isEmptyOrNullOrUndefined(encodeSnNo)) {
mRootView.showMessage(mApplication.getString(R.string.str_please_input_sn));
return;
}
Map<String, Object> map = new HashMap<>(3);
PurchaseConstant.addRestaurantId(map);
PurchaseConstant.addBrandId(map);
map.put("encodeSnNo", encodeSnNo);
mModel.getFoodInOutBoundRecordBySnCode(map)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.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 result) {
if (result != null && result.isSuccess() && result.getData() != null) {
List<SnInoutBoundRecordBean> snInoutBoundRecordBeans = GsonUtils.jsonToList(result.getData(), SnInoutBoundRecordBean.class);
if (CollectionUtils.isNullOrEmpty(snInoutBoundRecordBeans)) {
mRootView.showMessage(mApplication.getString(R.string.str_no_data_found));
mRootView.showEmpty();
} else {
loadAdapter(snInoutBoundRecordBeans);
}
} else {
showErrMsg(result);
}
}
private void loadAdapter(List<SnInoutBoundRecordBean> snInoutBoundRecordBeans) {
if (baseBinderAdapter == null) {
baseBinderAdapter = new BaseBinderAdapter();
baseBinderAdapter.addItemBinder(SnInoutBoundRecordBean.class, new SnInOutRecordBinder())
.addItemBinder(SnInOutBoundRecordDetailsBean.ConsumeDetailsBean.class, new SnOutRecordDetailsBinder())
.addItemBinder(SnInOutBoundRecordDetailsBean.InventoryDetailsBean.class, new SnInRecordDetailsBinder());
baseBinderAdapter.addData(snInoutBoundRecordBeans);
mRootView.loadAdapter(baseBinderAdapter);
baseBinderAdapter.setOnItemClickListener((adapter, view, position) -> {
Object item = baseBinderAdapter.getItem(position);
if (item instanceof SnInoutBoundRecordBean) {
SnInoutBoundRecordBean recordBean = (SnInoutBoundRecordBean) item;
if (!recordBean.isLoadDetails()) {
getFoodInOutBoundDetails(recordBean.getPurchaseWarehousingOrderDetailsIds(), recordBean.getEncodeSnNo(), recordBean.getEncodeFoodNo());
recordBean.setLoadDetails(true);
}
}
});
} else {
baseBinderAdapter.setList(snInoutBoundRecordBeans);
}
}
});
}
private void showErrMsg(BaseResult result) {
if (result != null && TextUtil.isNotEmptyOrNullOrUndefined(result.getErrMsg())) {
mRootView.showMessage(result.getErrMsg());
} else {
mRootView.showMessage(PurchaseConstant.GET_INFO_ERROR);
}
mRootView.showEmpty();
}
public void getFoodInOutBoundDetails(String purchaseWarehousingOrderDetailsIds, String encodeSnNo, String encodeFoodNo) {
Map<String, Object> map = new HashMap<>(5);
map.put("purchaseWarehousingOrderDetailsIds", purchaseWarehousingOrderDetailsIds);
PurchaseConstant.addRestaurantId(map);
PurchaseConstant.addBrandId(map);
map.put("encodeSnNo", encodeSnNo);
map.put("encodeFoodNo", encodeFoodNo);
mModel.getFoodInOutBoundRecordDetails(map)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(PurchaseConstant.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 result) {
if (result != null && result.isSuccess() && result.getData() != null) {
SnInOutBoundRecordDetailsBean detailsBean = GsonUtils.GsonToBean(result.getData(), SnInOutBoundRecordDetailsBean.class);
baseBinderAdapter.addData(detailsBean.getConsumeDetails());
baseBinderAdapter.addData(detailsBean.getInventoryDetails());
} else {
showErrMsg(result);
}
}
});
}
}
...@@ -522,4 +522,18 @@ public interface SupplierServer { ...@@ -522,4 +522,18 @@ public interface SupplierServer {
@GET("purchaseWarehousingOrder/details/getMultipleStorageOrderDetails" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2) @GET("purchaseWarehousingOrder/details/getMultipleStorageOrderDetails" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> getWarehousingOrderDetails(@Query("warehousingOrderId") int warehousingOrderId); Observable<BaseResult> getWarehousingOrderDetails(@Query("warehousingOrderId") int warehousingOrderId);
/**
* 根據SN碼查詢出入庫記錄
*/
@Headers({"Domain-Name: ricepon-purchase"})
@GET("purchaseWarehousingOrder/details/getSnInventoryDetails" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> getFoodInOutBoundRecordBySnCode(@QueryMap Map<String, Object> map);
/**
* 查詢出入庫詳情
*/
@Headers({"Domain-Name: ricepon-purchase"})
@GET("purchaseWarehousingOrder/details/getFoodNoInventoryDetails" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> getFoodInOutBoundRecordDetails(@QueryMap Map<String, Object> map);
} }
...@@ -62,11 +62,11 @@ public class WareHousingDetailsAdapter extends BaseQuickAdapter<WarehouseDetails ...@@ -62,11 +62,11 @@ public class WareHousingDetailsAdapter extends BaseQuickAdapter<WarehouseDetails
//下單時間為空,入庫時間不為空 //下單時間為空,入庫時間不為空
//下單時間改為入庫時間,隱藏入庫時間控件 //下單時間改為入庫時間,隱藏入庫時間控件
viewHolder.setText(R.id.tv_warehouse_order_time_text, String.format(getContext().getString(R.string.str_format_warehousing_date), item.getWarehousingTime())); viewHolder.setText(R.id.tv_warehouse_order_time_text, String.format(getContext().getString(R.string.str_format_warehousing_date), item.getWarehousingTime()));
// viewHolder.setGone(R.id.tv_warehouse_time_text, true); viewHolder.setGone(R.id.tv_warehouse_time_text, true);
} else { } else {
viewHolder.setText(R.id.tv_warehouse_order_time_text, String.format(getContext().getString(R.string.str_format_order_date), item.getPurchaseTime())); viewHolder.setText(R.id.tv_warehouse_order_time_text, String.format(getContext().getString(R.string.str_format_order_date), item.getPurchaseTime()));
viewHolder.setText(R.id.tv_warehouse_time_text, String.format(getContext().getString(R.string.str_format_warehousing_date), item.getWarehousingTime())); viewHolder.setText(R.id.tv_warehouse_time_text, String.format(getContext().getString(R.string.str_format_warehousing_date), item.getWarehousingTime()));
// viewHolder.setGone(R.id.tv_warehouse_time_text, false); viewHolder.setGone(R.id.tv_warehouse_time_text, false);
} }
viewHolder.setGone(R.id.tv_warehouse_details_remarks, true); viewHolder.setGone(R.id.tv_warehouse_details_remarks, true);
} else { } else {
......
package com.gingersoft.supply_chain.mvp.ui.adapter.binder;
import androidx.core.content.ContextCompat;
import com.chad.library.adapter.base.binder.QuickItemBinder;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.gsa.cloud.common.utils.glide.GlideUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.SnInoutBoundRecordBean;
import org.jetbrains.annotations.NotNull;
/**
* @author 宇航. 1239658231@qq.com
* User: admin
* Date: 2021/5/12
* Time: 12:29
* Use:
*/
public class SnInOutRecordBinder extends QuickItemBinder<SnInoutBoundRecordBean> {
@Override
public int getLayoutId() {
return R.layout.item_sn_inout_bound_record;
}
@Override
public void convert(@NotNull BaseViewHolder viewHolder, SnInoutBoundRecordBean snInoutBoundRecordBean) {
if (TextUtil.isNotEmptyOrNullOrUndefined(snInoutBoundRecordBean.getImages())) {
GlideUtils.display(viewHolder.itemView.getContext(), viewHolder.getView(R.id.iv_inout_bound_food_img), snInoutBoundRecordBean.getImages());
} else {
viewHolder.setImageResource(R.id.iv_inout_bound_food_img, R.drawable.img_small_default);
}
viewHolder.setText(R.id.iv_inout_bound_food_name, snInoutBoundRecordBean.getName());
viewHolder.setText(R.id.iv_inout_bound_food_no, snInoutBoundRecordBean.getEncodeFoodNo());
if (snInoutBoundRecordBean.getStatus() == SnInoutBoundRecordBean.NOT_OUT_STOCK) {
//在庫
viewHolder.setTextColor(R.id.iv_inout_bound_food_state, ContextCompat.getColor(viewHolder.itemView.getContext(), R.color.theme_color));
viewHolder.setText(R.id.iv_inout_bound_food_state, R.string.str_in_warehouse);
} else if (snInoutBoundRecordBean.getStatus() == SnInoutBoundRecordBean.OUT_STOCK) {
viewHolder.setTextColor(R.id.iv_inout_bound_food_state, ContextCompat.getColor(viewHolder.itemView.getContext(), R.color.theme_333_color));
viewHolder.setText(R.id.iv_inout_bound_food_state, R.string.str_already_out_warehouse);
} else {
viewHolder.setText(R.id.iv_inout_bound_food_state, snInoutBoundRecordBean.getStatus() + "");
}
}
}
package com.gingersoft.supply_chain.mvp.ui.adapter.binder;
import android.content.Context;
import com.chad.library.adapter.base.binder.QuickItemBinder;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.SnInOutBoundRecordDetailsBean;
import org.jetbrains.annotations.NotNull;
/**
* @author 宇航. 1239658231@qq.com
* User: admin
* Date: 2021/5/12
* Time: 12:29
* Use: sn碼入庫記錄詳情
*/
public class SnInRecordDetailsBinder extends QuickItemBinder<SnInOutBoundRecordDetailsBean.InventoryDetailsBean> {
@Override
public int getLayoutId() {
return R.layout.item_sn_inout_bound_details;
}
@Override
public void convert(@NotNull BaseViewHolder viewHolder, SnInOutBoundRecordDetailsBean.InventoryDetailsBean item) {
Context context = viewHolder.itemView.getContext();
viewHolder.setText(R.id.iv_inout_bound_details_type, String.format(context.getString(R.string.str_format_in_warehousing_type), item.getStorageType()));
viewHolder.setText(R.id.iv_inout_bound_details_member, item.getUserName());
viewHolder.setText(R.id.iv_inout_bound_details_time, String.format(context.getString(R.string.str_format_time), TimeUtils.StampToData(TimeUtils.DEFAULT_DATE_FORMAT, item.getCreateTime())));
viewHolder.setText(R.id.iv_inout_bound_details_order_no, String.format(context.getString(R.string.str_format_order_no), item.getOrderNo()));
viewHolder.setText(R.id.iv_inout_bound_details_remarks, String.format(context.getString(R.string.str_format_remark_colon), item.getRemarks()));
}
}
package com.gingersoft.supply_chain.mvp.ui.adapter.binder;
import android.content.Context;
import com.chad.library.adapter.base.binder.QuickItemBinder;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.SnInOutBoundRecordDetailsBean;
import org.jetbrains.annotations.NotNull;
/**
* @author 宇航. 1239658231@qq.com
* User: admin
* Date: 2021/5/12
* Time: 12:29
* Use: sn碼出庫記錄詳情
*/
public class SnOutRecordDetailsBinder extends QuickItemBinder<SnInOutBoundRecordDetailsBean.ConsumeDetailsBean> {
@Override
public int getLayoutId() {
return R.layout.item_sn_inout_bound_details;
}
@Override
public void convert(@NotNull BaseViewHolder viewHolder, SnInOutBoundRecordDetailsBean.ConsumeDetailsBean item) {
Context context = viewHolder.itemView.getContext();
viewHolder.setText(R.id.iv_inout_bound_details_type, String.format(context.getString(R.string.str_format_out_warehousing_type), item.getConsumeType()));
viewHolder.setText(R.id.iv_inout_bound_details_member, item.getUserName());
viewHolder.setText(R.id.iv_inout_bound_details_time, String.format(context.getString(R.string.str_format_time), TimeUtils.StampToData(TimeUtils.DEFAULT_DATE_FORMAT, item.getCreateTime())));
viewHolder.setText(R.id.iv_inout_bound_details_order_no, String.format(context.getString(R.string.str_format_order_no), item.getOrderNo()));
viewHolder.setText(R.id.iv_inout_bound_details_remarks, String.format(context.getString(R.string.str_format_remark_colon), item.getRemarks()));
}
}
...@@ -25,6 +25,7 @@ import com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodManagementFragment; ...@@ -25,6 +25,7 @@ import com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodManagementFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.MeasurementUnitFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.food.MeasurementUnitFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.order.PurchaseListFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.order.PurchaseListFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.supplier.SupplierListFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.supplier.SupplierListFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.SnInOutboundRecordsFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.WareHouseListFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.WareHouseListFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.WarehousingOrderListFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.WarehousingOrderListFragment;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
...@@ -94,7 +95,7 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr ...@@ -94,7 +95,7 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr
storage.add(new Function("庫存查詢", R.drawable.ic_inventory_inquiry)); storage.add(new Function("庫存查詢", R.drawable.ic_inventory_inquiry));
storage.add(new Function("入庫", R.drawable.ic_warehousing)); storage.add(new Function("入庫", R.drawable.ic_warehousing));
// storage.add(new Function("出庫", R.drawable.ic_out_of_stock)); // storage.add(new Function("出庫", R.drawable.ic_out_of_stock));
// storage.add(new Function("盤點", R.drawable.ic_inventory)); storage.add(new Function("SN查詢", R.drawable.ic_inventory));
if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG) {
storage.add(new Function("切換環境", R.drawable.ic_seekbar_btn)); storage.add(new Function("切換環境", R.drawable.ic_seekbar_btn));
} }
...@@ -130,6 +131,9 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr ...@@ -130,6 +131,9 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr
case "入庫": case "入庫":
start(WarehousingOrderListFragment.newInstance()); start(WarehousingOrderListFragment.newInstance());
break; break;
case "SN查詢":
start(SnInOutboundRecordsFragment.newInstance());
break;
case "切換環境": case "切換環境":
int format = (int) SPUtils.get("isFormal", 3); int format = (int) SPUtils.get("isFormal", 3);
if (format == 3) { if (format == 3) {
......
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 androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseBinderAdapter;
import com.gingersoft.gsa.cloud.common.loadsir.EmptyCallback;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2;
import com.gingersoft.supply_chain.di.component.DaggerSnInOutboundRecordsComponent;
import com.gingersoft.supply_chain.mvp.contract.SnInOutboundRecordsContract;
import com.gingersoft.supply_chain.mvp.presenter.SnInOutboundRecordsPresenter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.jess.arms.di.component.AppComponent;
import com.kingja.loadsir.core.LoadSir;
import com.qmuiteam.qmui.alpha.QMUIAlphaButton;
import com.qmuiteam.qmui.widget.QMUITopBar;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import butterknife.BindView;
import butterknife.OnClick;
/**
* SN碼出入庫記錄頁面
*
* @author admin
*/
public class SnInOutboundRecordsFragment extends BaseSupplyChainFragment<SnInOutboundRecordsPresenter> implements SnInOutboundRecordsContract.View, View.OnClickListener {
@BindView(R2.id.supply_top_bar)
QMUITopBar supplyTopBar;
@BindView(R2.id.ed_inout_bound_search)
EditText edInoutBoundSearch;
@BindView(R2.id.btn_inout_bound_record_search)
QMUIAlphaButton btnInoutBoundRecordSearch;
@BindView(R2.id.rv_inout_bound_record_list)
RecyclerView rvInoutBoundRecordList;
// @BindView(R2.id.srl_inout_bound_record)
// SmartRefreshLayout srlInoutBoundRecord;
public static SnInOutboundRecordsFragment newInstance() {
SnInOutboundRecordsFragment fragment = new SnInOutboundRecordsFragment();
return fragment;
}
@Override
public void setupFragmentComponent(@NonNull AppComponent appComponent) {
DaggerSnInOutboundRecordsComponent //如找不到该类,请编译一下项目
.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_inout_bound_records_list, container, false);
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
loadService = LoadSir.getDefault().register(rvInoutBoundRecordList);
// srlInoutBoundRecord.setPrimaryColorsId(R.color.trans, R.color.black);
initTopBar(supplyTopBar, getString(R.string.str_title_sn_query));
}
@OnClick({R2.id.btn_inout_bound_record_search})
@Override
public void onClick(View v) {
int vId = v.getId();
if (vId == R.id.btn_inout_bound_record_search) {
//搜索
mPresenter.getFoodInOutBoundRecordBySnCode(edInoutBoundSearch.getText().toString());
}
}
@Override
public void showEmpty() {
loadService.showCallback(EmptyCallback.class);
}
@Override
public void loadAdapter(BaseBinderAdapter baseBinderAdapter) {
loadService.showSuccess();
rvInoutBoundRecordList.setAdapter(baseBinderAdapter);
}
}
...@@ -166,6 +166,7 @@ public class WareHouseListFragment extends BaseSupplyChainFragment<WareHouseList ...@@ -166,6 +166,7 @@ public class WareHouseListFragment extends BaseSupplyChainFragment<WareHouseList
@Override @Override
public void finishLoadNoMoreData() { public void finishLoadNoMoreData() {
mTableView.freshAndLoadSuccess();
mTableView.loadMoreSuccessWithNoMoreData(); mTableView.loadMoreSuccessWithNoMoreData();
} }
......
...@@ -74,7 +74,6 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD ...@@ -74,7 +74,6 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
@BindView(R2.id.tv_warehouse_specifications) @BindView(R2.id.tv_warehouse_specifications)
TextView tvWarehouseSpecifications; TextView tvWarehouseSpecifications;
@BindView(R2.id.tv_warehouse_unit_price) @BindView(R2.id.tv_warehouse_unit_price)
TextView tvWarehouseUnitPrice; TextView tvWarehouseUnitPrice;
@BindView(R2.id.tv_warehouse_total_amount) @BindView(R2.id.tv_warehouse_total_amount)
TextView tvWarehouseTotalAmount; TextView tvWarehouseTotalAmount;
...@@ -151,7 +150,7 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD ...@@ -151,7 +150,7 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
purchaseWarehousingOrderDetailsVO = (PurchaseWarehousingOrderDetailsVO) arguments.getSerializable(FOOD_INFO_KEY); purchaseWarehousingOrderDetailsVO = (PurchaseWarehousingOrderDetailsVO) arguments.getSerializable(FOOD_INFO_KEY);
if (purchaseWarehousingOrderDetailsVO == null) { if (purchaseWarehousingOrderDetailsVO == null) {
killMyself(); killMyself();
showMessage("食材信息獲取失敗,請稍候重試"); showMessage(getString(R.string.str_food_info_get_error));
} }
initTopBar(supplyTopBar, purchaseWarehousingOrderDetailsVO.getName()); initTopBar(supplyTopBar, purchaseWarehousingOrderDetailsVO.getName());
...@@ -289,11 +288,11 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD ...@@ -289,11 +288,11 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
//初始化掃碼view //初始化掃碼view
scanSnView = new ScanSnView(this).setOnScanResultListener((popup, scanResult) -> { scanSnView = new ScanSnView(this).setOnScanResultListener((popup, scanResult) -> {
if (scanResult.isEmpty()) { if (scanResult.isEmpty()) {
showMessage("請掃碼SN碼"); showMessage(getString(R.string.str_please_scan_sn));
return; return;
} }
if (scanResult.size() != inventoryConsumptionView.getConsumptionNum()) { if (scanResult.size() != inventoryConsumptionView.getConsumptionNum()) {
showMessage("SN碼數量和消耗庫存數必須保持一致"); showMessage(getString(R.string.str_sn_quantity_consume_must_equla));
return; return;
} }
List<String> snCodes = new ArrayList<>(); List<String> snCodes = new ArrayList<>();
...@@ -301,7 +300,7 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD ...@@ -301,7 +300,7 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
snCodes.add(purchaseFoodEncodeSn.getEncodeSnNo()); snCodes.add(purchaseFoodEncodeSn.getEncodeSnNo());
} }
inventory(consumeReasonBeans, snCodes, inventoryConsumptionView.getIsPrint()); inventory(consumeReasonBeans, snCodes, inventoryConsumptionView.getIsPrint());
}).setOnCancelListener(() -> { }).setMaxCodeSize(purchaseWarehousingOrderDetailsVO.getFoodNum()).setOnCancelListener(() -> {
//取消 //取消
showList(View.VISIBLE); showList(View.VISIBLE);
}).init(); }).init();
...@@ -369,7 +368,7 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD ...@@ -369,7 +368,7 @@ public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseD
@Override @Override
public void removeNoFoodSn(List<String> sns) { public void removeNoFoodSn(List<String> sns) {
AppDialog.getInstance().showTipDialog(requireContext(), "是否移除非當前食材的SN碼?" + sns.toString(), () -> { AppDialog.getInstance().showTipDialog(requireContext(), getString(R.string.str_whether_remove_not_current_food_sn_code) + sns.toString(), () -> {
if (scanSnView != null) { if (scanSnView != null) {
//修改上面的數量 //修改上面的數量
inventoryConsumptionView.setConsumptionNumber(scanSnView.getSnSize() - sns.size()); inventoryConsumptionView.setConsumptionNumber(scanSnView.getSnSize() - sns.size());
......
...@@ -11,6 +11,7 @@ import android.widget.FrameLayout; ...@@ -11,6 +11,7 @@ import android.widget.FrameLayout;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.StringRes;
import androidx.appcompat.widget.SwitchCompat; import androidx.appcompat.widget.SwitchCompat;
import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
...@@ -27,6 +28,8 @@ import com.qmuiteam.qmui.alpha.QMUIAlphaTextView; ...@@ -27,6 +28,8 @@ import com.qmuiteam.qmui.alpha.QMUIAlphaTextView;
import java.util.List; import java.util.List;
import javax.annotation.Resource;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
...@@ -79,18 +82,18 @@ public class InventoryConsumptionView extends FrameLayout { ...@@ -79,18 +82,18 @@ public class InventoryConsumptionView extends FrameLayout {
int i = Integer.parseInt(s); int i = Integer.parseInt(s);
if (i > 0) { if (i > 0) {
if (i > maxConsumption) { if (i > maxConsumption) {
edInput.setError("不能超過當前庫存數量:" + maxConsumption); edInput.setError(String.format(getString(R.string.str_format_can_not_exceed_inventory_quantity), maxConsumption));
} else { } else {
onConfirmClickListener.onConfirm(i, consumptionReasonAdapter.getSelectIndex(), TextUtil.getNotNullStrAndTrim(edRemarks.getText().toString())); onConfirmClickListener.onConfirm(i, consumptionReasonAdapter.getSelectIndex(), TextUtil.getNotNullStrAndTrim(edRemarks.getText().toString()));
} }
} else { } else {
ToastUtils.show(getContext(), "請輸入消耗庫存數"); ToastUtils.show(getContext(), getString(R.string.str_please_input_consume_quantity));
edInput.setError("請輸入消耗庫存數"); edInput.setError(getString(R.string.str_please_input_consume_quantity));
} }
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
e.printStackTrace(); e.printStackTrace();
ToastUtils.show(getContext(), "請輸入消耗庫存數"); ToastUtils.show(getContext(), getString(R.string.str_please_input_consume_quantity));
edInput.setError("請輸入消耗庫存數"); edInput.setError(getString(R.string.str_please_input_consume_quantity));
} }
} }
}); });
...@@ -110,7 +113,7 @@ public class InventoryConsumptionView extends FrameLayout { ...@@ -110,7 +113,7 @@ public class InventoryConsumptionView extends FrameLayout {
try { try {
int i = Integer.parseInt(s.toString()); int i = Integer.parseInt(s.toString());
if (i > maxConsumption) { if (i > maxConsumption) {
edInput.setError("不能超過當前庫存數量:" + maxConsumption); edInput.setError(String.format(getString(R.string.str_format_can_not_exceed_inventory_quantity), maxConsumption));
} }
if (onNumberChangeListener != null) { if (onNumberChangeListener != null) {
onNumberChangeListener.onNumberChange(i); onNumberChangeListener.onNumberChange(i);
...@@ -180,7 +183,7 @@ public class InventoryConsumptionView extends FrameLayout { ...@@ -180,7 +183,7 @@ public class InventoryConsumptionView extends FrameLayout {
int i = Integer.parseInt(s); int i = Integer.parseInt(s);
if (i > 0) { if (i > 0) {
if (i > maxConsumption) { if (i > maxConsumption) {
String errMsg = "不能超過當前庫存數量:" + maxConsumption; String errMsg = String.format(getString(R.string.str_format_can_not_exceed_inventory_quantity), maxConsumption);
edInput.setError(errMsg); edInput.setError(errMsg);
ToastUtils.show(getContext(), errMsg); ToastUtils.show(getContext(), errMsg);
return -1; return -1;
...@@ -188,14 +191,14 @@ public class InventoryConsumptionView extends FrameLayout { ...@@ -188,14 +191,14 @@ public class InventoryConsumptionView extends FrameLayout {
return i; return i;
} }
} else { } else {
String errMsg = "請輸入消耗庫存數"; String errMsg = getString(R.string.str_please_input_consume_quantity);
ToastUtils.show(getContext(), errMsg); ToastUtils.show(getContext(), errMsg);
edInput.setError(errMsg); edInput.setError(errMsg);
return -1; return -1;
} }
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
e.printStackTrace(); e.printStackTrace();
String errMsg = "請輸入消耗庫存數"; String errMsg = getString(R.string.str_please_input_consume_quantity);
ToastUtils.show(getContext(), errMsg); ToastUtils.show(getContext(), errMsg);
edInput.setError(errMsg); edInput.setError(errMsg);
return -1; return -1;
...@@ -221,6 +224,10 @@ public class InventoryConsumptionView extends FrameLayout { ...@@ -221,6 +224,10 @@ public class InventoryConsumptionView extends FrameLayout {
edInput.setText(String.valueOf(consumptionNumber)); edInput.setText(String.valueOf(consumptionNumber));
} }
private String getString(@StringRes int strId) {
return getContext().getString(strId);
}
public interface OnConfirmClickListener { public interface OnConfirmClickListener {
/** /**
* 確認時,將消耗的庫存,原因,備註傳遞回去 * 確認時,將消耗的庫存,原因,備註傳遞回去
......
...@@ -187,7 +187,7 @@ public class ScanSnView extends FrameLayout { ...@@ -187,7 +187,7 @@ public class ScanSnView extends FrameLayout {
btnFoodIngredientsCancel.setOnClickListener(v -> { btnFoodIngredientsCancel.setOnClickListener(v -> {
if (adapter.getData().size() != initCodeSize) { if (adapter.getData().size() != initCodeSize) {
AppDialog.getInstance().showTipDialog(getContext(), "關閉後不會保存SN碼記錄", () -> { AppDialog.getInstance().showTipDialog(getContext(), getString(R.string.str_close_dont_save), () -> {
if (onCancelListener != null) { if (onCancelListener != null) {
onCancelListener.onCancel(); onCancelListener.onCancel();
} }
...@@ -198,18 +198,19 @@ public class ScanSnView extends FrameLayout { ...@@ -198,18 +198,19 @@ public class ScanSnView extends FrameLayout {
}); });
adapter.setOnItemChildClickListener((adapter1, view, position) -> { adapter.setOnItemChildClickListener((adapter1, view, position) -> {
if (view.getId() == R.id.iv_sn_code_delete) { if (view.getId() == R.id.iv_sn_code_delete) {
if (adapter.getItem(position).newAdd) { PurchaseFoodEncodeSn item = adapter.getItem(position);
onSingerResultListener.onScanValue(false, adapter.getItem(position), adapter.getItemCount()); if (item.newAdd) {
onSingerResultListener.onScanValue(false, item, adapter.getItemCount());
if (onDeleteSnCodeListener != null) { if (onDeleteSnCodeListener != null) {
onDeleteSnCodeListener.onDelete(adapter.getItem(position), position); onDeleteSnCodeListener.onDelete(item, position);
} }
if (adapter.getItem(position).newAdd) { if (item.newAdd) {
newCodeSize--; newCodeSize--;
} }
adapter1.removeAt(position); adapter1.removeAt(position);
setConfirmBtnState(); setConfirmBtnState();
} else { } else {
ToastUtils.show(getContext(), "已入庫的SN碼不可刪除"); ToastUtils.show(getContext(), getString(R.string.str_already_warehousing_dont_delete));
} }
} }
}); });
...@@ -219,33 +220,61 @@ public class ScanSnView extends FrameLayout { ...@@ -219,33 +220,61 @@ public class ScanSnView extends FrameLayout {
private void scanSn() { private void scanSn() {
if (fragment == null) { if (fragment == null) {
ToastUtils.show(getContext(), "掃碼功能無法啟用,請聯繫開發人員"); ToastUtils.show(getContext(), getString(R.string.str_scan_dont_use));
return; return;
} }
XPermissionUtils.launchCamera(fragment, (allGranted, grantedList, deniedList) -> { XPermissionUtils.launchCamera(fragment, (allGranted, grantedList, deniedList) -> {
if (allGranted) { if (allGranted) {
//去掃碼頁面 //去掃碼頁面
CC.obtainBuilder(ComponentName.COMPONENT_SCAN) CC.obtainBuilder(ComponentName.COMPONENT_SCAN)
.setActionName("openScanActivity") .setActionName("openMultiScanActivity")
.addParam("scanMode", BarcodeType.ONE_DIMENSION) .addParam("scanMode", BarcodeType.ONE_DIMENSION)
.build() .build()
.callAsyncCallbackOnMainThread((cc, result) -> { .callAsyncCallbackOnMainThread((cc, result) -> {
Object qrCodeResult = result.getDataItem("qrCodeResult"); Object qrCodeResult = result.getDataItem("qrCodeResult");
if (qrCodeResult != null) { if (qrCodeResult != null) {
String snCode = String.valueOf(qrCodeResult); if (qrCodeResult instanceof ArrayList) {
for (PurchaseFoodEncodeSn purchaseFoodEncodeSn : adapter.getData()) { List<String> sns = (List<String>) qrCodeResult;
if (purchaseFoodEncodeSn.getEncodeSnNo().equals(snCode)) { if (sns.size() > 0) {
ToastUtils.show(getContext(), "商品已存在,不能重複添加"); StringBuilder stringBuilder = new StringBuilder();
return; for (String sn : sns) {
if (snIsExist(sn, false)) {
//如果SN已存在
stringBuilder.append(sn).append(",");
} else {
//sn不存在,添加進去
addSnCode(adapter, sn);
}
}
String substring = "";
if (stringBuilder.length() > 0) {
substring = stringBuilder.substring(0, stringBuilder.length() - 1);
ToastUtils.show(getContext(), String.format(getString(R.string.str_format_sn_already_existed), substring));
}
} }
} else {
String snCode = String.valueOf(qrCodeResult);
if (snIsExist(snCode, true)) return;
addSnCode(adapter, snCode);
} }
addSnCode(adapter, snCode);
} }
}); });
} }
}); });
} }
private boolean snIsExist(String snCode, boolean showTip) {
for (PurchaseFoodEncodeSn purchaseFoodEncodeSn : adapter.getData()) {
if (purchaseFoodEncodeSn.getEncodeSnNo().equals(snCode)) {
if (showTip) {
ToastUtils.show(getContext(), getString(R.string.str_food_existed_dont_add));
}
return true;
}
}
return false;
}
public void setConfirmBtnState() { public void setConfirmBtnState() {
if (minCodeSize == -1 || newCodeSize == minCodeSize) { if (minCodeSize == -1 || newCodeSize == minCodeSize) {
btnFoodIngredientsConfirm.setBackground(ContextCompat.getDrawable(getContext(), R.drawable.shape_app_btn)); btnFoodIngredientsConfirm.setBackground(ContextCompat.getDrawable(getContext(), R.drawable.shape_app_btn));
...@@ -257,15 +286,10 @@ public class ScanSnView extends FrameLayout { ...@@ -257,15 +286,10 @@ public class ScanSnView extends FrameLayout {
private void commitSnCode() { private void commitSnCode() {
if (TextUtil.isNotEmptyOrNullOrUndefined(edInputSn)) { if (TextUtil.isNotEmptyOrNullOrUndefined(edInputSn)) {
String snCode = edInputSn.getText().toString(); String snCode = edInputSn.getText().toString();
for (PurchaseFoodEncodeSn datum : adapter.getData()) { if (snIsExist(snCode, true)) return;
if (datum.getEncodeSnNo().equals(snCode)) {
ToastUtils.show(getContext(), "商品已存在,不能重複添加");
return;
}
}
addSnCode(adapter, snCode); addSnCode(adapter, snCode);
} else { } else {
ToastUtils.show(getContext(), "請輸入SN碼"); ToastUtils.show(getContext(), getString(R.string.str_please_input_sn));
} }
} }
...@@ -273,14 +297,18 @@ public class ScanSnView extends FrameLayout { ...@@ -273,14 +297,18 @@ public class ScanSnView extends FrameLayout {
* 添加sn码,內部新增sn統一使用 * 添加sn码,內部新增sn統一使用
*/ */
private void addSnCode(SnCodeAdapter adapter, String snCode) { private void addSnCode(SnCodeAdapter adapter, String snCode) {
PurchaseFoodEncodeSn purchaseFoodEncodeSn = new PurchaseFoodEncodeSn(snCode); if (maxCodeSize == -1 || adapter.getItemCount() < maxCodeSize) {
purchaseFoodEncodeSn.newAdd = true; PurchaseFoodEncodeSn purchaseFoodEncodeSn = new PurchaseFoodEncodeSn(snCode);
adapter.addData(0, purchaseFoodEncodeSn); purchaseFoodEncodeSn.newAdd = true;
adapter.notifyDataSetChanged(); adapter.addData(0, purchaseFoodEncodeSn);
newCodeSize++; adapter.notifyDataSetChanged();
edInputSn.setText(""); newCodeSize++;
setConfirmBtnState(); edInputSn.setText("");
onSingerResultListener.onScanValue(true, purchaseFoodEncodeSn, adapter.getItemCount()); setConfirmBtnState();
onSingerResultListener.onScanValue(true, purchaseFoodEncodeSn, adapter.getItemCount());
} else {
ToastUtils.show(getContext(), String.format(getString(R.string.str_format_can_not_exceed_inventory_quantity), maxCodeSize));
}
} }
/** /**
...@@ -370,6 +398,10 @@ public class ScanSnView extends FrameLayout { ...@@ -370,6 +398,10 @@ public class ScanSnView extends FrameLayout {
} }
} }
private String getString(int strId) {
return getContext().getString(strId);
}
public static class SnCodeAdapter extends BaseQuickAdapter<PurchaseFoodEncodeSn, BaseViewHolder> { public static class SnCodeAdapter extends BaseQuickAdapter<PurchaseFoodEncodeSn, BaseViewHolder> {
public SnCodeAdapter(int layoutResId, @org.jetbrains.annotations.Nullable List<PurchaseFoodEncodeSn> data) { public SnCodeAdapter(int layoutResId, @org.jetbrains.annotations.Nullable List<PurchaseFoodEncodeSn> data) {
......
...@@ -73,7 +73,7 @@ public class WarehousingFoodDetailsPopup extends CenterPopupView { ...@@ -73,7 +73,7 @@ public class WarehousingFoodDetailsPopup extends CenterPopupView {
String price = String.format(getContext().getString(R.string.str_unit_price_colon_s), MoneyUtil.formatDouble(purchaseFoodBean.getUnitPrice())); String price = String.format(getContext().getString(R.string.str_unit_price_colon_s), MoneyUtil.formatDouble(purchaseFoodBean.getUnitPrice()));
tvGoodsPrice.setText(TextUtil.getBoldSpannableString(price, ContextCompat.getColor(getContext(), R.color.required_color), 3, price.length())); tvGoodsPrice.setText(TextUtil.getBoldSpannableString(price, ContextCompat.getColor(getContext(), R.color.required_color), 3, price.length()));
String totalAmountText = String.format(getContext().getString(R.string.str_total_amount_colon_s), MoneyUtil.formatDouble(MoneyUtil.priceCalculation(purchaseFoodBean.getUnitPrice(), purchaseFoodBean.getFoodQuantity()))); String totalAmountText = String.format(getContext().getString(R.string.str_total_amount_colon_s), MoneyUtil.formatDouble(MoneyUtil.priceCalculation(purchaseFoodBean.getUnitPrice(), purchaseFoodBean.getFoodQuantity())));
tvFoodTotalAmount.setText(TextUtil.getBoldSpannableString(totalAmountText, ContextCompat.getColor(getContext(), R.color.required_color), 3, price.length())); tvFoodTotalAmount.setText(TextUtil.getBoldSpannableString(totalAmountText, ContextCompat.getColor(getContext(), R.color.required_color), 3, totalAmountText.length()));
if (TextUtil.isNotEmptyOrNullOrUndefined(purchaseFoodBean.getPackingDescription())) { if (TextUtil.isNotEmptyOrNullOrUndefined(purchaseFoodBean.getPackingDescription())) {
tvGoodsSpecification.setText(purchaseFoodBean.getPackingDescription()); tvGoodsSpecification.setText(purchaseFoodBean.getPackingDescription());
} else { } else {
......
<?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" />
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/dp_10"
android:paddingTop="@dimen/dp_10"
android:paddingRight="@dimen/dp_10">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_47"
android:background="@drawable/shape_white_eight_corners_bg"
app:elevation="@dimen/dp_0"
app:layout_scrollFlags="scroll|enterAlways">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:layout_width="@dimen/dp_24"
android:layout_height="@dimen/dp_24"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/dp_10"
android:src="@drawable/ic_search" />
<EditText
android:id="@+id/ed_inout_bound_search"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_5"
android:layout_weight="1"
android:background="@null"
android:hint="@string/str_search_sn"
android:imeOptions="actionSearch"
android:inputType="text"
android:maxLines="1"
android:textColor="@color/theme_333_color"
android:textColorHint="@color/hint_color"
android:textCursorDrawable="@drawable/cursor_theme"
android:textSize="@dimen/dp_16" />
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id="@+id/btn_inout_bound_record_search"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@null"
android:text="搜索"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14" />
</LinearLayout>
<!-- android:background="@drawable/shape_app_btn"-->
</com.google.android.material.appbar.AppBarLayout>
<!-- <com.scwang.smartrefresh.layout.SmartRefreshLayout-->
<!-- android:id="@+id/srl_inout_bound_record"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- app:layout_behavior="@string/appbar_scrolling_view_behavior">-->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_inout_bound_record_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_10"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<!-- </com.scwang.smartrefresh.layout.SmartRefreshLayout>-->
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -7,67 +7,71 @@ ...@@ -7,67 +7,71 @@
android:background="@color/supply_chain_bg_color" android:background="@color/supply_chain_bg_color"
android:orientation="vertical"> android:orientation="vertical">
<include layout="@layout/supply_chain_top_bar" />
<com.google.android.material.appbar.AppBarLayout <androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_marginTop="@dimen/head_height" android:orientation="vertical">
android:background="@color/trans"
app:elevation="0dp">
<LinearLayout <com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:background="@color/trans"
android:padding="@dimen/dp_10" app:elevation="0dp">
app:layout_scrollFlags="scroll">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="@dimen/dp_10"
app:layout_scrollFlags="scroll">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="庫存:"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_16" />
<TextView
android:id="@+id/tv_sn_housing_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/red"
android:textSize="@dimen/dp_18"
android:textStyle="bold"
tools:text="100" />
</LinearLayout>
<TextView <TextView
android:id="@+id/tv_remark"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="庫存:" android:layout_marginLeft="@dimen/dp_10"
android:textColor="@color/theme_333_color" android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_16" /> android:textSize="@dimen/dp_16"
app:layout_scrollFlags="scroll"
tools:text="備註:" />
<TextView <include
android:id="@+id/tv_sn_housing_num" layout="@layout/include_sn_item"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/red" android:layout_marginLeft="@dimen/dp_10"
android:textSize="@dimen/dp_18" android:layout_marginTop="@dimen/dp_5"
android:textStyle="bold" android:layout_marginRight="@dimen/dp_10" />
tools:text="100" /> </com.google.android.material.appbar.AppBarLayout>
</LinearLayout>
<TextView
android:id="@+id/tv_remark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_16"
app:layout_scrollFlags="scroll|enterAlwaysCollapsed"
tools:text="備註:" />
<include <androidx.recyclerview.widget.RecyclerView
layout="@layout/include_sn_item" android:id="@+id/rv_sn"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_10" android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_10" android:layout_marginRight="@dimen/dp_10"
app:layout_scrollFlags="scroll|exitUntilCollapsed" /> app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
</com.google.android.material.appbar.AppBarLayout> app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<include layout="@layout/supply_chain_top_bar" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_sn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file </LinearLayout>
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
style="@style/WareHouse_Details_TextStyle" style="@style/WareHouse_Details_TextStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="庫存:" /> android:text="@string/str_inventory_colon" />
<TextView <TextView
android:id="@+id/tv_warehouse_inventory_number" android:id="@+id/tv_warehouse_inventory_number"
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
style="@style/WareHouse_Details_TextStyle" style="@style/WareHouse_Details_TextStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="規格:" /> android:text="@string/str_specification_colon" />
<TextView <TextView
android:id="@+id/tv_warehouse_specifications" android:id="@+id/tv_warehouse_specifications"
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
android:gravity="center" android:gravity="center"
android:paddingTop="@dimen/dp_11" android:paddingTop="@dimen/dp_11"
android:paddingBottom="@dimen/dp_11" android:paddingBottom="@dimen/dp_11"
android:text="入庫流水" android:text="@string/str_warehousing_bill"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="@dimen/dp_17" /> android:textSize="@dimen/dp_17" />
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
android:gravity="center" android:gravity="center"
android:paddingTop="@dimen/dp_11" android:paddingTop="@dimen/dp_11"
android:paddingBottom="@dimen/dp_11" android:paddingBottom="@dimen/dp_11"
android:text="出庫流水" android:text="@string/str_out_warehousing_bill"
android:textColor="@color/color_3c" android:textColor="@color/color_3c"
android:textSize="@dimen/dp_17" /> android:textSize="@dimen/dp_17" />
</LinearLayout> </LinearLayout>
......
...@@ -6,8 +6,7 @@ ...@@ -6,8 +6,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/theme_color" android:background="@color/theme_color"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal">
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<TextView <TextView
android:id="@+id/tv_serial_number" android:id="@+id/tv_serial_number"
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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="wrap_content"
android:layout_marginTop="@dimen/dp_1"
android:background="@color/white"
android:padding="@dimen/dp_5">
<TextView
android:id="@+id/iv_inout_bound_details_type"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/iv_inout_bound_details_member"
app:layout_constraintTop_toTopOf="parent"
tools:text="出庫類型:調撥出庫" />
<TextView
android:id="@+id/iv_inout_bound_details_member"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_10"
android:ellipsize="end"
android:maxLength="10"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="操作人員" />
<TextView
android:id="@+id/iv_inout_bound_details_time"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16"
app:layout_constraintLeft_toLeftOf="@id/iv_inout_bound_details_type"
app:layout_constraintTop_toBottomOf="@id/iv_inout_bound_details_type"
tools:text="時間:2020-11-20 12:00:00" />
<TextView
android:id="@+id/iv_inout_bound_details_order_no"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16"
app:layout_constraintLeft_toLeftOf="@id/iv_inout_bound_details_type"
app:layout_constraintTop_toBottomOf="@id/iv_inout_bound_details_time"
tools:text="單號:CK20210505" />
<TextView
android:id="@+id/iv_inout_bound_details_unit_price"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="@id/iv_inout_bound_details_type"
app:layout_constraintTop_toBottomOf="@id/iv_inout_bound_details_order_no"
tools:text="入庫單價:$20.00" />
<TextView
android:id="@+id/iv_inout_bound_details_remarks"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16"
app:layout_constraintLeft_toLeftOf="@id/iv_inout_bound_details_type"
app:layout_constraintTop_toBottomOf="@id/iv_inout_bound_details_unit_price"
tools:text="備註:" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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="wrap_content"
android:background="@drawable/shape_white_five_corners_bg"
android:padding="@dimen/dp_5">
<ImageView
android:id="@+id/iv_inout_bound_food_img"
android:layout_width="@dimen/dp_67"
android:layout_height="@dimen/dp_67"
android:src="@drawable/img_small_default"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/iv_inout_bound_food_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16"
app:layout_constraintBottom_toTopOf="@id/iv_inout_bound_food_no"
app:layout_constraintLeft_toRightOf="@id/iv_inout_bound_food_img"
app:layout_constraintRight_toLeftOf="@id/iv_inout_bound_food_state"
app:layout_constraintTop_toTopOf="parent"
tools:text="澳洲牛排soif綠色經典傅雷" />
<TextView
android:id="@+id/iv_inout_bound_food_no"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_10"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@id/iv_inout_bound_food_name"
app:layout_constraintRight_toLeftOf="@id/iv_inout_bound_food_state"
app:layout_constraintTop_toBottomOf="@id/iv_inout_bound_food_name"
tools:text="Sn001" />
<TextView
android:id="@+id/iv_inout_bound_food_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_10"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="在庫" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
...@@ -67,4 +67,34 @@ ...@@ -67,4 +67,34 @@
<string name="str_format_warehousing_date">入庫日期:%1$s</string> <string name="str_format_warehousing_date">入庫日期:%1$s</string>
<string name="str_format_consumption_date">消耗日期:%1$s</string> <string name="str_format_consumption_date">消耗日期:%1$s</string>
<string name="str_title_sn_query">SN查詢</string>
<string name="str_search_sn">搜索SN碼</string>
<string name="str_please_input_sn">請輸入SN碼</string>
<string name="str_please_scan_sn">請掃碼SN碼</string>
<string name="str_no_data_found">未查詢到數據</string>
<string name="str_in_warehouse">在庫</string>
<string name="str_already_out_warehouse">已出庫</string>
<string name="str_format_out_warehousing_type">出庫類型:%1$s</string>
<string name="str_format_in_warehousing_type">入庫類型:%1$s</string>
<string name="str_format_time">時間:%1$s</string>
<string name="str_format_order_no">單號:%1$s</string>
<string name="str_inventory_colon">庫存:</string>
<string name="str_specification_colon">規格:</string>
<string name="str_warehousing_bill">入庫流水</string>
<string name="str_out_warehousing_bill">出庫流水</string>
<string name="str_close_dont_save">關閉後不會保存SN碼記錄</string>
<string name="str_already_warehousing_dont_delete">已入庫的SN碼不可刪除</string>
<string name="str_scan_dont_use">掃碼功能無法啟用,請聯繫開發人員</string>
<string name="str_food_existed_dont_add">商品已存在,不能重複添加</string>
<string name="str_format_can_not_exceed_inventory_quantity">不能超過當前庫存數量:%1$d</string>
<string name="str_please_input_consume_quantity">請輸入消耗庫存數</string>
<string name="str_format_sn_already_existed">%1$s已存在列表中</string>
<string name="str_sn_quantity_consume_must_equla">SN碼數量和消耗庫存數必須保持一致</string>
<string name="str_whether_remove_not_current_food_sn_code">是否移除非當前食材的SN碼</string>
<string name="str_food_info_get_error">食材信息獲取失敗,請稍候重試</string>
</resources> </resources>
\ No newline at end of file
package com.gingersoft.gsa.cloud.common.function;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author 宇航. 1239658231@qq.com
* User: admin
* Date: 2021/5/11
* Time: 11:30
* Use: 添加餐廳id和品牌id到map或者RequestBody中
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.PARAMETER)
public @interface PutRestaurantInfo {
}
package com.gingersoft.gsa.cloud.common.function;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
/**
* @author 宇航. 1239658231@qq.com
* User: admin
* Date: 2021/5/11
* Time: 11:33
* Use:
*/
@Aspect
public class PutRestaurantInfoAspect {
@Pointcut("execution(@com.gingersoft.gsa.cloud.common.function.PutRestaurantInfo * *(..))")
public void putRestaurantInfo(){
}
@Before("putRestaurantInfo()")
public void executePut(JoinPoint joinPoint){
Object[] args = joinPoint.getArgs();
}
}
package com.gingersoft.gsa.cloud.common.function.click; package com.gingersoft.gsa.cloud.common.function.click;
import android.util.Log;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
...@@ -12,12 +11,9 @@ import org.aspectj.lang.ProceedingJoinPoint; ...@@ -12,12 +11,9 @@ import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import java.lang.reflect.Method;
import java.util.Calendar; import java.util.Calendar;
import butterknife.OnClick;
import butterknife.internal.DebouncingOnClickListener; import butterknife.internal.DebouncingOnClickListener;
/** /**
......
...@@ -10,7 +10,6 @@ import org.aspectj.lang.annotation.Aspect; ...@@ -10,7 +10,6 @@ import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.annotation.Pointcut;
/** /**
*
* @author Wyh * @author Wyh
* @date 2018/6/13 * @date 2018/6/13
*/ */
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/shape_app_btn" android:state_checkable="true"/> <item android:drawable="@drawable/shape_app_btn" android:state_checkable="true"/>
<item android:drawable="@drawable/shape_btn_unclick"/> <item android:drawable="@drawable/shape_app_btn" android:state_checked="true"/>
<item android:drawable="@drawable/shape_white_eight_corners_bg"/>
</selector> </selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 填充背景色 -->
<solid android:color="@color/white" />
<!-- 圓角 -->
<corners android:radius="@dimen/dp_5" />
</shape>
\ No newline at end of file
...@@ -244,6 +244,8 @@ ...@@ -244,6 +244,8 @@
<string name="str_remark">備註</string> <string name="str_remark">備註</string>
<string name="str_remark_colon">備註:</string> <string name="str_remark_colon">備註:</string>
<string name="str_format_remark_colon">備註:%1$s</string> <string name="str_format_remark_colon">備註:%1$s</string>
<string name="str_single_scan">單次掃描</string>
<string name="str_continuous_scan">連續掃描</string>
<string name="str_save">保存</string> <string name="str_save">保存</string>
<string name="str_inventory">盤點</string> <string name="str_inventory">盤點</string>
......
package com.gingersoft.gsa.cloud.ui.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import com.google.android.material.appbar.AppBarLayout;
/**
* @author 宇航. 1239658231@qq.com
* User: admin
* Date: 2021/5/11
* Time: 10:24
* Use: 解決CoordinatorLayout折疊佈局中RecyclerView顯示不全問題
*/
public class FixScrollingBehavior extends AppBarLayout.ScrollingViewBehavior {
private AppBarLayout appBarLayout;
public FixScrollingBehavior() {
super();
}
public FixScrollingBehavior(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public boolean onDependentViewChanged(@NonNull CoordinatorLayout parent, @NonNull View child, @NonNull View dependency) {
if (appBarLayout == null) {
appBarLayout = (AppBarLayout) dependency;
}
final boolean result = super.onDependentViewChanged(parent, child, dependency);
final int bottomPadding = calculateBottomPadding(appBarLayout);
final boolean paddingChanged = bottomPadding != child.getPaddingBottom();
if (paddingChanged) {
child.setPadding(
child.getPaddingLeft(),
child.getPaddingTop(),
child.getPaddingRight(),
bottomPadding);
child.requestLayout();
}
return paddingChanged || result;
}
private int calculateBottomPadding(AppBarLayout dependency) {
final int totalScrollRange = dependency.getTotalScrollRange();
return totalScrollRange + dependency.getTop();
}
}
\ No newline at end of file
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