Commit 09af818f authored by zhang_z's avatar zhang_z

Merge remote-tracking branch 'origin/master'

parents 02a91bc0 5037ce8d
......@@ -3,8 +3,10 @@ package com.xingdata.zzdpos.ui.manage.inventory;
import android.content.Intent;
import android.view.MotionEvent;
import android.view.View;
import com.blankj.utilcode.util.ActivityUtils;
import com.blankj.utilcode.util.FragmentUtils;
import com.blankj.utilcode.util.KeyboardUtils;
import com.xingdata.zzdpos.R;
import com.xingdata.zzdpos.base.BaseActivity;
......@@ -17,8 +19,10 @@ import com.xingdata.zzdpos.ui.dialog.LoadingDialog;
import com.xingdata.zzdpos.ui.manage.inventory.fragment.InventoryAddFragment;
import com.xingdata.zzdpos.ui.manage.inventory.fragment.InventoryFragment;
import com.xingdata.zzdpos.ui.manage.manageMenu.ManageDateFragment;
import com.xingdata.zzdpos.ui.scan.ScanFragment;
import com.xingdata.zzdpos.ui.statistics.StatisticsDetailActivity;
import com.xingdata.zzdpos.util.Global;
import com.xingdata.zzdpos.util.OnClickListener;
import java.util.List;
......@@ -29,6 +33,7 @@ public class InventoryActivity extends BaseActivity<InventoryPresenter, Activity
private ManageDateFragment mManageDateFragment = new ManageDateFragment();
private InventoryAddFragment mInventoryAddFragment;
LoadingDialog mLoadingDialog = new LoadingDialog();
private ScanFragment mScanFragment;
@Override
public int getLayoutId() {
......@@ -38,10 +43,30 @@ public class InventoryActivity extends BaseActivity<InventoryPresenter, Activity
@Override
public void initView() {
loadRootFragment(R.id.f_bottom, mInventoryFragment, true, false);
initTitle();
}
private void initTitle() {
mViewBinding.icTitle.edTitle.setVisibility(View.GONE);
mViewBinding.icTitle.tvTitle.setVisibility(View.VISIBLE);
changeTitle("盘库记录", false);
mViewBinding.icTitle.setOnClickListener(new OnClickListener() {
@Override
protected void myOnClickListener(View v) {
if (mInventoryAddFragment.isAdded()) {
mInventoryAddFragment.popThis();
return;
}
if (mScanFragment!=null&&mScanFragment.isAdded()) {
mScanFragment.pop();
return;
}
finish();
}
});
}
@Override
public void showDateFragment() {
start(mManageDateFragment);
......@@ -55,11 +80,18 @@ public class InventoryActivity extends BaseActivity<InventoryPresenter, Activity
@Override
public void addInventoryGoodsItem(List<Sssku> ssskuList) {
mInventoryAddFragment.addInventoryGoodsItem(ssskuList);
if (mScanFragment!=null&&mScanFragment.isAdded()) {
mScanFragment.pop();
}
}
@Override
public void addInventoryGoodsItem(Sssku sssku) {
mInventoryAddFragment.addInventoryGoodsItem(sssku);
if (mScanFragment!=null&&mScanFragment.isAdded()) {
mScanFragment.pop();
}
}
@Override
......@@ -85,6 +117,7 @@ public class InventoryActivity extends BaseActivity<InventoryPresenter, Activity
@Override
public void disInventoryDetailFragment(Boolean idChange) {
changeTitle("盘库记录", false);
if (idChange) {
mInventoryAddFragment.pop();
mInventoryFragment.onRefresh();
......@@ -109,6 +142,7 @@ public class InventoryActivity extends BaseActivity<InventoryPresenter, Activity
public void openInventoryAddFragment(Cs cs) {
mInventoryAddFragment = new InventoryAddFragment();
mInventoryAddFragment.setCs(cs);
changeTitle("商品盘点", true);
start(mInventoryAddFragment);
}
......@@ -129,6 +163,41 @@ public class InventoryActivity extends BaseActivity<InventoryPresenter, Activity
// mInventoryAddFragment.searchGoodsSuc();
}
@Override
public void changeTitle(String s, boolean b) {
mViewBinding.icTitle.tvTitle.setText(s);
if (b) {
mViewBinding.icTitle.ivRight.setImageResource(R.mipmap.but_sweep_yard);
} else {
mViewBinding.icTitle.ivRight.setImageResource(R.mipmap.ic_dates);
}
mViewBinding.icTitle.ivRight.setOnClickListener(new OnClickListener() {
@Override
protected void myOnClickListener(View v) {
if (b) {
if (mScanFragment == null) {
mScanFragment = new ScanFragment();
mScanFragment.setOnScanCompletedListener(new ScanFragment.OnScanCompletedListener() {
@Override
public void OnScanCompleted(String barcode) {
mPresenter.getProductByBarcode(barcode);
}
});
}
if (!mScanFragment.isAdded()) {
start(mScanFragment);
}
} else {
mPresenter.clickDate();
}
}
});
}
@Override
public void isShowLoading(Boolean is) {
if (is) {
......@@ -140,6 +209,11 @@ public class InventoryActivity extends BaseActivity<InventoryPresenter, Activity
}
}
@Override
public void delSucc() {
mInventoryFragment.onRefresh();
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
Global.clickHideKeyboard(ev, this);
......
......@@ -21,9 +21,9 @@ public interface InventoryContract {
* 添加盘库 搜索商品成功
*/
void searchGoodsSuc();
void changeTitle(String s,boolean b);
void isShowLoading(Boolean is);
void delSucc();
/**
* 跳转日期搜索
*/
......@@ -92,6 +92,11 @@ public interface InventoryContract {
*/
public abstract void clickDate();
/**
* - 改标题
*/
public abstract void changeTitle(String s,boolean b);
/**
* 盘库添加页面 - 取消退出这次盘库的记录
*
......
......@@ -117,7 +117,7 @@ public class InventoryPresenter extends InventoryContract.Presenter {
mView.isShowLoading(true);
ApiFactory.Cs.delCsDetail(cs.getId(), cs.getCsNo()).doFinally(() -> mView.isShowLoading(false))
.subscribe(object -> {
mView.delSucc();
}, throwable -> {
ToastUtils.showShort(throwable.getMessage());
});
......@@ -128,6 +128,11 @@ public class InventoryPresenter extends InventoryContract.Presenter {
mView.showDateFragment();
}
@Override
public void changeTitle(String s, boolean b) {
mView.changeTitle(s,b);
}
@Override
public void cancelInventoryAdd(Cs cs) {
mView.isShowLoading(true);
......
......@@ -7,6 +7,7 @@ import android.text.TextWatcher;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.TextView;
import com.facebook.drawee.view.SimpleDraweeView;
import com.xingdata.zzdpos.R;
......@@ -17,10 +18,12 @@ import com.xingdata.zzdpos.model.Sssku;
import com.xingdata.zzdpos.util.ConvertUtil;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class InventoryGoodsAdapter extends BaseAdapter<Sssku, ItemInventoryGoodsBinding> {
private int count ;
public InventoryGoodsAdapter(@Nullable List<Sssku> data) {
super(R.layout.item_inventory_goods, data);
......@@ -30,44 +33,53 @@ public class InventoryGoodsAdapter extends BaseAdapter<Sssku, ItemInventoryGoods
@Override
protected void convert(BaseViewHolder helper, Sssku item) {
helper.addOnClickListener(R.id.btn_ok);
super.convert(helper, item);
}
@Override
protected void convert(ItemInventoryGoodsBinding mViewBinding, Sssku item) {
if (item.getInventoryCut() == 0) {
item.setInventoryCut(1);
}
count=item.getInventoryCut();
helper.setText(R.id.et_count, item.getInventoryCut() + "");
helper.setText(R.id.tv_goods_name, item.getSpuName())
.setText(R.id.tv_goods_code, item.getSpuBarcode() + "")
.setText(R.id.tv_goods_size, "规格/" + item.getSpuUnitName())
.setText(R.id.tv_goods_price, ConvertUtil.fenToYuan(item.getSkuRetailPrice1(), false))
.setText(R.id.tv_stock, item.getSkuStock() + "");
((SimpleDraweeView) helper.getView(R.id.img_goods)).setImageURI(item.getSpuImg());
helper.getView(R.id.btn_up).setOnClickListener(v -> {
mViewBinding.etCount.setText(item.getInventoryCut() + "");
mViewBinding.tvGoodsName.setText(item.getSpuName());
mViewBinding.tvGoodsCode.setText(item.getSpuBarcode() + "");
mViewBinding.tvGoodsSize.setText("规格/" + item.getSpuUnitName());
mViewBinding.tvGoodsPrice.setText(ConvertUtil.fenToYuan(item.getSkuRetailPrice1(), false));
mViewBinding.tvStock.setText(item.getSkuStock() + item.getSpuUnitName());
mViewBinding.imgGoods.setImageURI(item.getSpuImg());
mViewBinding.btnUp.setOnClickListener(v -> {
int count = Integer.valueOf(mViewBinding.etCount.getText().toString());
if (count > 0 && count < 9999) {
helper.setText(R.id.et_count, String.valueOf(++count));
mViewBinding.etCount.setText(String.valueOf(++count));
item.setInventoryCut(count);
}
});
helper.getView(R.id.btn_down).setOnClickListener(v -> {
mViewBinding.btnDown.setOnClickListener(v -> {
int count = Integer.valueOf(mViewBinding.etCount.getText().toString());
if (count == 1) {
item.setInventoryCut(count);
return;
}
if (count > 1 && count < 100) {
helper.setText(R.id.et_count, String.valueOf(--count));
mViewBinding.etCount.setText(String.valueOf(--count));
item.setInventoryCut(count);
}
});
((EditText) helper.getView(R.id.et_count)).addTextChangedListener((new TextWatcher() {
mViewBinding.etCount.addTextChangedListener((new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
count = ((EditText) helper.getView(R.id.et_count)).getText().toString().length() == 0 ? 1 : Integer.valueOf(((EditText) helper.getView(R.id.et_count)).getText().toString());
int count = mViewBinding.etCount.getText().toString().length() == 0 ? 1 : Integer.valueOf((mViewBinding.etCount.getText().toString()));
item.setInventoryCut(count);
}
......@@ -75,13 +87,6 @@ public class InventoryGoodsAdapter extends BaseAdapter<Sssku, ItemInventoryGoods
public void afterTextChanged(Editable editable) {
}
}));
helper.addOnClickListener(R.id.btn_ok);
super.convert(helper, item);
}
@Override
protected void convert(ItemInventoryGoodsBinding mViewBinding, Sssku item) {
}
......
......@@ -44,7 +44,10 @@ public class CsCartDialog extends BaseSheetDialog<InventoryPresenter, DialogInve
mViewBinding.setResult(result);
// set Other listener
mViewBinding.tvOk.setOnClickListener(view -> mPresenter.exitInventoryAdd());
mViewBinding.tvOk.setOnClickListener(view -> {
dismiss();
mPresenter.exitInventoryAdd();
});
}
......
......@@ -8,6 +8,7 @@ import android.view.inputmethod.EditorInfo;
import android.widget.TextView;
import com.blankj.utilcode.util.FragmentUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.xingdata.zzdpos.R;
......@@ -21,6 +22,7 @@ import com.xingdata.zzdpos.ui.dialog.PromptDialog;
import com.xingdata.zzdpos.ui.manage.inventory.InventoryPresenter;
import com.xingdata.zzdpos.ui.manage.inventory.adpter.InventoryGoodsAdapter;
import com.xingdata.zzdpos.ui.manage.inventory.dialog.CsCartDialog;
import com.xingdata.zzdpos.ui.scan.ScanFragment;
import com.xingdata.zzdpos.util.OnClickListener;
import com.xingdata.zzdpos.util.RecyclerViewUtil;
......@@ -39,6 +41,7 @@ public class InventoryAddFragment extends BaseFragment<InventoryPresenter, Fragm
private InventoryGoodsAdapter mInventoryGoodsAdapter;
private CsCartDialog mCartDialog = new CsCartDialog();
/**
* 当前购物车信息
*/
......@@ -57,9 +60,8 @@ public class InventoryAddFragment extends BaseFragment<InventoryPresenter, Fragm
initRecycler();
mViewBinding.setCartCount(0);
mViewBinding.icTitle.edTitle.setVisibility(View.GONE);
mViewBinding.icTitle.tvTitle.setText("商品盘点");
mViewBinding.icTitle.tvTitle.setVisibility(View.VISIBLE);
mViewBinding.edTitle.setHint(R.string.inventory_add_et_hint);
mViewBinding.edTitle.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
......@@ -83,18 +85,7 @@ public class InventoryAddFragment extends BaseFragment<InventoryPresenter, Fragm
mViewBinding.btnEnd.setOnClickListener(view -> {
mPresenter.exitInventoryAdd();
});
mViewBinding.icTitle.setOnClickListener(new OnClickListener() {
@Override
protected void myOnClickListener(View v) {
PromptDialog promptDialog = new PromptDialog();
promptDialog.setDialogType(PromptDialog.PROMPTDIALOG_SELECT, "退出前是否删除本次盘库记录").setClick(view1 -> {
mPresenter.cancelInventoryAdd(mCs);
promptDialog.dismiss();
}, view1 -> {
promptDialog.dismiss();
}).setCancelables(false).show((BaseActivity) mContext);
}
});
// mViewBinding.btnPrint.setOnClickListener(new OnClickListener() {
// @Override
// protected void myOnClickListener(View v) {
......@@ -219,6 +210,12 @@ public class InventoryAddFragment extends BaseFragment<InventoryPresenter, Fragm
@Override
public boolean onBackPressedSupport() {
popThis();
return true;
}
public void popThis() {
if (bottomCsList.size() == 0) {
mPresenter.cancelInventoryAdd(mCs);
} else {
......@@ -229,17 +226,12 @@ public class InventoryAddFragment extends BaseFragment<InventoryPresenter, Fragm
}, view1 -> {
promptDialog.dismiss();
mPresenter.changeTitle("盘库记录",false);
pop();
}).setCancelables(false).show((BaseActivity) mContext);
}
return true;
}
public void searchGoodsSuc() {
// mViewBinding.etKeyword.setText("");
// KeyboardUtils.hideSoftInput(getActivity());
}
......@@ -249,4 +241,5 @@ public class InventoryAddFragment extends BaseFragment<InventoryPresenter, Fragm
textView.setText(R.string.inventory_add_empty_hint);
return view;
}
}
......@@ -59,7 +59,6 @@ public class InventoryFragment extends BaseFragment<InventoryPresenter, Fragment
start = null;
end = null;
pageNum = 1;
initTitle();
mViewBinding.btnAdd.setOnClickListener(new OnClickListener() {
@Override
protected void myOnClickListener(View v) {
......@@ -100,23 +99,7 @@ public class InventoryFragment extends BaseFragment<InventoryPresenter, Fragment
mPresenter.getInventoryList(pageNum);
}
private void initTitle() {
mViewBinding.icTitle.edTitle.setVisibility(View.GONE);
mViewBinding.icTitle.tvTitle.setText("盘库记录");
mViewBinding.icTitle.tvTitle.setVisibility(View.VISIBLE);
mViewBinding.icTitle.ivRight.setOnClickListener(new OnClickListener() {
@Override
protected void myOnClickListener(View v) {
mPresenter.clickDate();
}
});
mViewBinding.icTitle.setOnClickListener(new OnClickListener() {
@Override
protected void myOnClickListener(View v) {
getActivity().finish();
}
});
}
//
public void setCount(int count) {
......
......@@ -20,6 +20,7 @@ import com.xingdata.zzdpos.model.Pager;
import com.xingdata.zzdpos.ui.dialog.LoadingDialog;
import com.xingdata.zzdpos.ui.manage.otherselect.fragment.OtherDetailFragment;
import com.xingdata.zzdpos.ui.manage.otherselect.fragment.OtherListFragment;
import com.xingdata.zzdpos.ui.scan.ScanFragment;
import com.xingdata.zzdpos.util.Global;
import com.xingdata.zzdpos.util.OnClickListener;
......@@ -29,6 +30,7 @@ public class OtherSelectActivity extends BaseActivity<OtherSelectPresenter,
private OtherListFragment mOtherListFragment = new OtherListFragment();
private OtherDetailFragment mOtherDetailFragment = new OtherDetailFragment();
LoadingDialog mLoadingDialog = new LoadingDialog();
private ScanFragment mScanFragment;
@Override
public int getLayoutId() {
......@@ -37,20 +39,32 @@ public class OtherSelectActivity extends BaseActivity<OtherSelectPresenter,
@Override
public void initView() {
mViewBinding.lyTitle.ivRight.setVisibility(View.GONE);
mViewBinding.lyTitle.ivRight.setVisibility(View.VISIBLE);
mViewBinding.lyTitle.edTitle.setVisibility(View.GONE);
mViewBinding.lyTitle.tvTitle.setText("邻库查询");
mViewBinding.lyTitle.tvTitle.setVisibility(View.VISIBLE);
FragmentUtils.add(getSupportFragmentManager(), mOtherListFragment, mViewBinding
.fragmentContainer.getId(), false, true);
mViewBinding.edTitle.setOnEditorActionListener(new TextView.OnEditorActionListener() {
mViewBinding.lyTitle.ivRight.setImageResource(R.mipmap.but_sweep_yard);
mViewBinding.lyTitle.ivRight.setOnClickListener(new OnClickListener() {
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
if (i == EditorInfo.IME_ACTION_SEARCH) {
search(mViewBinding.edTitle.getText().toString().trim());
protected void myOnClickListener(View v) {
if (mScanFragment == null) {
mScanFragment = new ScanFragment();
mScanFragment.setOnScanCompletedListener(new ScanFragment.OnScanCompletedListener() {
@Override
public void OnScanCompleted(String barcode) {
mOtherListFragment.search(barcode);
}
});
}
if (!mScanFragment.isAdded()) {
FragmentUtils.add(getSupportFragmentManager(), mScanFragment, mViewBinding
.fragmentContainer.getId(), false, true);
}
return true;
}
});
mViewBinding.lyTitle.setOnClickListener(new OnClickListener() {
......@@ -60,8 +74,8 @@ public class OtherSelectActivity extends BaseActivity<OtherSelectPresenter,
mViewBinding.lyTitle.edTitle.clearFocus();
}
if (mOtherDetailFragment.isAdded()) {
mOtherDetailFragment.pop();
if (mScanFragment!=null&&mScanFragment.isAdded()) {
mScanFragment.pop();
return;
}
finish();
......@@ -84,11 +98,12 @@ public class OtherSelectActivity extends BaseActivity<OtherSelectPresenter,
@Override
public void loadOssku(Pager<Ossku> osskuList, boolean isRefresh) {
if (mOtherDetailFragment.isAdded()) {
mOtherDetailFragment.pop();
public void loadOssku(Pager<Ossku> osskuList, boolean isRefresh, String keyWord) {
if (mScanFragment!=null&&mScanFragment.isAdded()) {
mScanFragment.pop();
}
mOtherListFragment.setData(osskuList, isRefresh);
mOtherListFragment.setKeyword(keyWord);
}
@Override
......@@ -104,17 +119,6 @@ public class OtherSelectActivity extends BaseActivity<OtherSelectPresenter,
super.onPause();
}
private void search(String string) {
KeyboardUtils.hideSoftInput(this);
if (string.length() == 0) {
ToastUtils.showShort("请输入搜索内容");
return;
}
mPresenter.searchGoodsFirst(string);
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
......
......@@ -20,7 +20,7 @@ public interface OtherSelectContract {
/**
* 加载列表
*/
void loadOssku(Pager<Ossku> osskuList, boolean isRefresh);
void loadOssku(Pager<Ossku> osskuList, boolean isRefresh,String wd);
void showOsskuDetail(Ossku ossku);
}
......
......@@ -40,9 +40,11 @@ public class OtherSelectPresenter extends OtherSelectContract.Presenter {
.subscribe(osskus -> {
if (osskus.getTotalRow() == 0) {
ToastUtils.showShort("没有搜到当前商品,请重新输入");
}else {
mView.loadOssku(osskus, nowPageNumber == 1,keyword);
}
//判断是否能加载更多
mView.loadOssku(osskus, nowPageNumber == 1);
}, throwable -> {
ToastUtils.showShort(throwable.getMessage());
});
......
......@@ -7,6 +7,7 @@ import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.TextView;
......@@ -51,7 +52,15 @@ public class OtherListFragment extends BaseFragment<OtherSelectPresenter, Fragme
mViewBinding.recyclerOtherSelcet.setLayoutManager(new LinearLayoutManager(getActivity()));
mViewBinding.recyclerOtherSelcet.setAdapter(mOtherSelectAdapter);
mViewBinding.edTitle.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
if (i == EditorInfo.IME_ACTION_SEARCH) {
search(mViewBinding.edTitle.getText().toString().trim());
}
return true;
}
});
// mOtherSelectAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
// @Override
// public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
......@@ -102,11 +111,25 @@ public class OtherListFragment extends BaseFragment<OtherSelectPresenter, Fragme
}
public void setKeyword(String s){
mViewBinding.edTitle.setText(s);
}
private View getEmptyView(int resHint) {
View view = getLayoutInflater().inflate(R.layout.view_empty, null);
((TextView) view.findViewById(R.id.tv_empty)).setText(resHint);
return view;
}
public void search(String string) {
KeyboardUtils.hideSoftInput(getActivity());
if (string.length() == 0) {
ToastUtils.showShort("请输入搜索内容");
return;
}
mPresenter.searchGoodsFirst(string);
}
}
......@@ -2,7 +2,9 @@ package com.xingdata.zzdpos.ui.manage.replenishment;
import android.view.MotionEvent;
import android.view.View;
import com.blankj.utilcode.util.FragmentUtils;
import com.blankj.utilcode.util.KeyboardUtils;
import com.xingdata.zzdpos.R;
import com.xingdata.zzdpos.base.BaseActivity;
......@@ -12,7 +14,9 @@ import com.xingdata.zzdpos.model.Sssku;
import com.xingdata.zzdpos.ui.dialog.LoadingDialog;
import com.xingdata.zzdpos.ui.manage.replenishment.fragment.ReplenishmentDetailFragment;
import com.xingdata.zzdpos.ui.manage.replenishment.fragment.ReplenishmentFragment;
import com.xingdata.zzdpos.ui.scan.ScanFragment;
import com.xingdata.zzdpos.util.Global;
import com.xingdata.zzdpos.util.OnClickListener;
import java.util.List;
......@@ -22,6 +26,7 @@ public class ReplenishmentActivity extends BaseActivity<ReplenishmentPresenter,
private ReplenishmentDetailFragment mReplenishmentDetailFragment = new
ReplenishmentDetailFragment();
private boolean isAllowFragment = true;
private ScanFragment mScanFragment;
LoadingDialog mLoadingDialog = new LoadingDialog();
@Override
......@@ -32,7 +37,46 @@ public class ReplenishmentActivity extends BaseActivity<ReplenishmentPresenter,
@Override
public void initView() {
mPresenter.queryPsbList();
mViewBinding.icTitle.edTitle.setVisibility(View.GONE);
mViewBinding.icTitle.tvTitle.setText(R.string.replenishment_meun);
mViewBinding.icTitle.tvTitle.setVisibility(View.VISIBLE);
mViewBinding.icTitle.ivRight.setImageResource(R.mipmap.but_sweep_yard);
mViewBinding.icTitle.ivRight.setOnClickListener(new OnClickListener() {
@Override
protected void myOnClickListener(View v) {
if (mScanFragment == null) {
mScanFragment = new ScanFragment();
mScanFragment.setOnScanCompletedListener(new ScanFragment.OnScanCompletedListener() {
@Override
public void OnScanCompleted(String barcode) {
mReplenishmentDetailFragment.scrollToItem(barcode);
}
});
}
if (!mScanFragment.isAdded()) {
start(mScanFragment);
}
}
});
mViewBinding.icTitle.setOnClickListener(new OnClickListener() {
@Override
protected void myOnClickListener(View v) {
if (mReplenishmentDetailFragment.isAdded()) {
mReplenishmentDetailFragment.pop();
mViewBinding.icTitle.tvTitle.setText(R.string.replenishment_meun);
return;
}
if (mScanFragment!=null&&mScanFragment.isAdded()) {
mScanFragment.pop();
return;
}
finish();
}
});
mViewBinding.icTitle.ivRight.setVisibility(View.GONE);
}
@Override
......@@ -58,6 +102,7 @@ public class ReplenishmentActivity extends BaseActivity<ReplenishmentPresenter,
if (isAllowFragment) {
isAllowFragment = false;
mReplenishmentDetailFragment.setSsskuList(ssskuList);
changeTitle("一键补货", true);
start(mReplenishmentDetailFragment);
}
......@@ -68,6 +113,7 @@ public class ReplenishmentActivity extends BaseActivity<ReplenishmentPresenter,
if (isAllowFragment) {
isAllowFragment = false;
mReplenishmentDetailFragment.setPsb(psb);
changeTitle("定货详情", true);
start(mReplenishmentDetailFragment);
}
......@@ -95,6 +141,24 @@ public class ReplenishmentActivity extends BaseActivity<ReplenishmentPresenter,
isAllowFragment = is;
}
@Override
public void changeTitle(String s, boolean b) {
mViewBinding.icTitle.tvTitle.setText(s);
if (b) {
mViewBinding.icTitle.ivRight.setVisibility(View.VISIBLE);
} else {
mViewBinding.icTitle.ivRight.setVisibility(View.GONE);
}
}
@Override
public void popScan() {
if (mScanFragment!=null&&mScanFragment.isAdded()) {
mScanFragment.pop();
}
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
Global.clickHideKeyboard(ev, this);
......
......@@ -22,8 +22,9 @@ public interface ReplenishmentContract {
void isAllowFragment(Boolean is);
void changeTitle(String s,boolean b);
void popScan();
/**
* 提交订货成功
*/
......@@ -49,12 +50,20 @@ public interface ReplenishmentContract {
abstract class Presenter extends BasePresenter<View> {
/**
* - 退出扫码
*/
public abstract void popScan();
/**
* 补货订货页面 - 点击一键补货
*/
public abstract void clickAdd();
/**
* 补货订货页面 - 改标题
*/
public abstract void changeTitle(String s,boolean b);
/**
* 补货订货页面 - 查询门店订货订单
*/
......
......@@ -25,6 +25,11 @@ public class ReplenishmentPresenter extends ReplenishmentContract.Presenter {
}
@Override
public void popScan() {
mView.popScan();
}
@Override
public void clickAdd() {
mView.isShowLoading(true);
......@@ -43,6 +48,11 @@ public class ReplenishmentPresenter extends ReplenishmentContract.Presenter {
}
@Override
public void changeTitle(String s, boolean b) {
mView.changeTitle(s,b);
}
@Override
public void queryPsbList() {
mView.isShowLoading(true);
......
......@@ -54,9 +54,7 @@ public class ReplenishmentDetailFragment extends BaseFragment<ReplenishmentPrese
@Override
public void initView() {
mViewBinding.lyTitle.edTitle.setVisibility(View.GONE);
mViewBinding.lyTitle.tvTitle.setVisibility(View.VISIBLE);
mViewBinding.lyTitle.tvTitle.setText("定货详情");
mViewBinding.edTitle.setHint(R.string.inventory_add_et_hint);
mViewBinding.edTitle.setText("");
Drawable drawableTop = getResources().getDrawable(R.mipmap.but_unfurled);
......@@ -66,12 +64,7 @@ public class ReplenishmentDetailFragment extends BaseFragment<ReplenishmentPrese
mViewBinding.tvShopTitle.setCompoundDrawables(null, null, drawableTop, null);
mViewBinding.tvSupplierTitle.setCompoundDrawables(null, null, drawableTop, null);
initRecycycler();
mViewBinding.lyTitle.setOnClickListener(new OnClickListener() {
@Override
protected void myOnClickListener(View v) {
pop();
}
});
mViewBinding.tvShopTitle.setOnClickListener(new OnClickListener() {
@Override
protected void myOnClickListener(View v) {
......@@ -96,7 +89,7 @@ public class ReplenishmentDetailFragment extends BaseFragment<ReplenishmentPrese
}
}
});
mViewBinding.lyTitle.ivRight.setVisibility(View.GONE);
mViewBinding.edTitle.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
......@@ -107,9 +100,7 @@ public class ReplenishmentDetailFragment extends BaseFragment<ReplenishmentPrese
return true;
}
});
mViewBinding.lyTitle.ivBack.setOnClickListener(view -> {
this.pop();
});
mViewBinding.btnOk.setOnClickListener(view -> {
if (mPsb == null || mPsb.getPsbStatus() == null) {
......@@ -269,25 +260,29 @@ public class ReplenishmentDetailFragment extends BaseFragment<ReplenishmentPrese
return view;
}
private void scrollToItem(String string) {
public void scrollToItem(String string) {
if (string.length() == 0) {
ToastUtils.showShort("请输入搜索内容");
return;
}
Pattern pattern = Pattern.compile(string, Pattern.CASE_INSENSITIVE);
for (int i = 0; i < mReplenishmentDetailAdapter.getData().size(); i++) {
Matcher matcher = pattern.matcher((mReplenishmentDetailAdapter.getData().get(i)).getSpuBarcode() + "");
if (matcher.find()) {
((LinearLayoutManager) mViewBinding.recyclerView.getLayoutManager()).scrollToPositionWithOffset(i, 0);
mPresenter.popScan();
ToastUtils.showShort("已找到商品:" + mReplenishmentDetailAdapter.getData().get(i).getSpuName());
KeyboardUtils.hideSoftInput(getActivity());
return;
}
matcher = pattern.matcher((mReplenishmentDetailAdapter.getData().get(i)).getSpuAb() + "");
if (matcher.find()) {
((LinearLayoutManager) mViewBinding.recyclerView.getLayoutManager()).scrollToPositionWithOffset(i, 0);
mPresenter.popScan();
ToastUtils.showShort("已找到商品:" + mReplenishmentDetailAdapter.getData().get(i).getSpuName());
KeyboardUtils.hideSoftInput(getActivity());
return;
......@@ -295,6 +290,7 @@ public class ReplenishmentDetailFragment extends BaseFragment<ReplenishmentPrese
matcher = pattern.matcher((mReplenishmentDetailAdapter.getData().get(i)).getSpuName() + "");
if (matcher.find()) {
((LinearLayoutManager) mViewBinding.recyclerView.getLayoutManager()).scrollToPositionWithOffset(i, 0);
mPresenter.popScan();
ToastUtils.showShort("已找到商品:" + mReplenishmentDetailAdapter.getData().get(i).getSpuName());
KeyboardUtils.hideSoftInput(getActivity());
return;
......@@ -304,4 +300,10 @@ public class ReplenishmentDetailFragment extends BaseFragment<ReplenishmentPrese
ToastUtils.showShort("没有找到相关货品");
}
@Override
public boolean onBackPressedSupport() {
mPresenter.changeTitle(getResources().getString(R.string.replenishment_meun), false);
return super.onBackPressedSupport();
}
}
......@@ -65,16 +65,7 @@ public class ReplenishmentFragment extends BaseFragment<ReplenishmentPresenter,
mViewBinding.btnAdd.setOnClickListener(view -> {
mPresenter.clickAdd();
});
mViewBinding.icTitle.edTitle.setVisibility(View.GONE);
mViewBinding.icTitle.tvTitle.setText("补货订货");
mViewBinding.icTitle.tvTitle.setVisibility(View.VISIBLE);
mViewBinding.icTitle.setOnClickListener(new OnClickListener() {
@Override
protected void myOnClickListener(View v) {
getActivity().finish();
}
});
mViewBinding.icTitle.ivRight.setVisibility(View.GONE);
mViewBinding.edTitle.setHint("请输入供货商名称");
mViewBinding.edTitle.setInputType(InputType.TYPE_CLASS_TEXT);
......
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="vertical">
<include
android:id="@+id/ic_title"
layout="@layout/title_order"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/view_line_L050"
android:background="@color/gray_huanggai" />
<FrameLayout
android:id="@+id/f_bottom"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
......@@ -20,6 +29,6 @@
</FrameLayout>
</android.support.constraint.ConstraintLayout>
</LinearLayout>
</layout>
\ No newline at end of file
......@@ -12,31 +12,15 @@
android:id="@+id/ly_title"
layout="@layout/title_order" />
<EditText
android:id="@+id/ed_title"
style="@style/searchBarEditor"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_below="@id/ly_title"
android:layout_marginBottom="@dimen/padding_small"
android:layout_marginEnd="@dimen/all_bounced_padding"
android:layout_marginStart="@dimen/all_bounced_padding"
android:layout_marginTop="@dimen/padding_small"
android:drawablePadding="@dimen/all_padding"
android:hint="@string/other_select_edit_hint"
android:textColor="@color/black_likui"
android:inputType="text"
android:imeOptions="actionSearch"
android:textSize="@dimen/all_text_size_low"
/>
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/ed_title"
android:background="@color/gray_zhouyu"></FrameLayout>
android:layout_below="@id/ly_title"
android:background="@color/white_caocao">
</FrameLayout>
<View
android:layout_width="match_parent"
......@@ -44,11 +28,7 @@
android:layout_below="@id/ly_title"
android:background="@color/gray_huanggai" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/view_line_L050"
android:layout_below="@id/ed_title"
android:background="@color/gray_huanggai" />
</RelativeLayout>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="vertical">
<include
android:id="@+id/ic_title"
layout="@layout/title_order"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/view_line_L050"
android:background="@color/gray_huanggai" />
<FrameLayout
android:id="@+id/f_bottom"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
......@@ -20,6 +29,6 @@
</FrameLayout>
</android.support.constraint.ConstraintLayout>
</LinearLayout>
</layout>
\ No newline at end of file
......@@ -13,15 +13,6 @@
android:orientation="vertical"
android:splitMotionEvents="false">
<include
android:id="@+id/ic_title"
layout="@layout/title_order"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/view_line_L050"
android:background="@color/gray_huanggai" />
<LinearLayout
android:id="@+id/btn_add"
......
......@@ -21,16 +21,6 @@
android:background="@color/white_caocao"
android:orientation="vertical">
<include
android:id="@+id/ic_title"
layout="@layout/title_order"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/view_line_L050"
android:background="@color/gray_huanggai"
app:layout_constraintTop_toBottomOf="@id/ic_title" />
<EditText
android:id="@+id/ed_title"
......@@ -45,10 +35,9 @@
android:drawablePadding="@dimen/all_padding"
android:hint="@string/other_select_edit_hint"
android:imeOptions="actionSearch"
android:inputType="text"
android:textColor="@color/black_likui"
android:textSize="@dimen/all_text_size_low"
app:layout_constraintTop_toBottomOf="@id/ic_title" />
app:layout_constraintTop_toTopOf="parent" />
<RelativeLayout
android:layout_width="0dp"
......
......@@ -7,10 +7,32 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/gray_zhouyu"
android:background="@color/white_caocao"
android:orientation="vertical">
<EditText
android:id="@+id/ed_title"
style="@style/searchBarEditor"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_below="@id/ly_title"
android:layout_marginBottom="@dimen/padding_small"
android:layout_marginEnd="@dimen/all_bounced_padding"
android:layout_marginStart="@dimen/all_bounced_padding"
android:layout_marginTop="@dimen/padding_small"
android:drawablePadding="@dimen/all_padding"
android:hint="@string/other_select_edit_hint"
android:textColor="@color/black_likui"
android:inputType="text"
android:imeOptions="actionSearch"
android:textSize="@dimen/all_text_size_low"
/>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/view_line_L050"
android:layout_below="@id/ed_title"
android:background="@color/gray_huanggai" />
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/srl_product"
android:layout_width="match_parent"
......
......@@ -13,15 +13,6 @@
android:orientation="vertical"
android:splitMotionEvents="false">
<include
android:id="@+id/ic_title"
layout="@layout/title_order"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/view_line_L050"
android:background="@color/gray_huanggai" />
<EditText
android:id="@+id/ed_title"
style="@style/searchBarEditor"
......
......@@ -63,11 +63,6 @@
android:background="@color/white_caocao"
android:splitMotionEvents="false">
<include
android:id="@+id/ly_title"
layout="@layout/title_order"
app:layout_constraintTop_toTopOf="parent" />
<android.support.constraint.ConstraintLayout
android:id="@+id/cl_default"
......@@ -109,7 +104,6 @@
app:layout_constraintTop_toTopOf="@id/tv_supplier_title" />
<View
android:id="@+id/view_line_left_1"
android:layout_width="match_parent"
......@@ -502,7 +496,7 @@
style="@style/searchBarEditor"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_below="@id/ly_title"
android:layout_alignParentTop="true"
android:layout_marginBottom="@dimen/padding_small"
android:layout_marginEnd="@dimen/all_bounced_padding"
android:layout_marginStart="@dimen/all_bounced_padding"
......
......@@ -75,6 +75,7 @@
android:padding="@dimen/dp_4"
android:text="规格"
android:textSize="@dimen/all_text_size_small"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@id/tv_goods_code"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_goods_code" />
......
......@@ -728,5 +728,4 @@
<string name="sku_name_hint">请输入商品名称</string>
</resources>
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