Commit b13f5d8e authored by 陈前's avatar 陈前

补货

parent 052a5c8b
...@@ -6,6 +6,7 @@ import com.xingdata.zzdpos.base.BasePresenter; ...@@ -6,6 +6,7 @@ import com.xingdata.zzdpos.base.BasePresenter;
import com.xingdata.zzdpos.base.BaseView; import com.xingdata.zzdpos.base.BaseView;
import com.xingdata.zzdpos.model.Psb; import com.xingdata.zzdpos.model.Psb;
import com.xingdata.zzdpos.model.Sssku; import com.xingdata.zzdpos.model.Sssku;
import com.xingdata.zzdpos.ui.manage.replenishment.fragment.ReplenishmentListFragment;
import java.util.List; import java.util.List;
...@@ -59,6 +60,11 @@ public interface ReplenishmentContract { ...@@ -59,6 +60,11 @@ public interface ReplenishmentContract {
*/ */
public abstract void queryPsbList(); public abstract void queryPsbList();
/**
* 补货订货页面 - 查询门店订货订单
*/
public abstract void searchPsbList(String wd, ReplenishmentListFragment replenishmentListFragment);
/** /**
* 补货订货页面 - 查询门店订货详情 * 补货订货页面 - 查询门店订货详情
*/ */
......
...@@ -6,6 +6,7 @@ import android.util.Log; ...@@ -6,6 +6,7 @@ import android.util.Log;
import com.blankj.utilcode.util.ToastUtils; import com.blankj.utilcode.util.ToastUtils;
import com.xingdata.zzdpos.api.ApiFactory; import com.xingdata.zzdpos.api.ApiFactory;
import com.xingdata.zzdpos.model.Psb; import com.xingdata.zzdpos.model.Psb;
import com.xingdata.zzdpos.ui.manage.replenishment.fragment.ReplenishmentListFragment;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -68,6 +69,12 @@ public class ReplenishmentPresenter extends ReplenishmentContract.Presenter { ...@@ -68,6 +69,12 @@ public class ReplenishmentPresenter extends ReplenishmentContract.Presenter {
}); });
} }
@Override
public void searchPsbList(String wd, ReplenishmentListFragment replenishmentListFragment) {
replenishmentListFragment.searchSucc(wd);
}
@Override @Override
public void queryPsbDetail(Psb psb) { public void queryPsbDetail(Psb psb) {
mView.isShowLoading(true); mView.isShowLoading(true);
......
package com.xingdata.zzdpos.ui.manage.replenishment.fragment; package com.xingdata.zzdpos.ui.manage.replenishment.fragment;
import android.databinding.DataBindingUtil;
import android.graphics.Typeface;
import android.support.design.widget.TabLayout;
import android.view.View; import android.view.View;
import android.widget.TextView; import android.widget.TextView;
import com.blankj.utilcode.util.ToastUtils;
import com.xingdata.zzdpos.R; import com.xingdata.zzdpos.R;
import com.xingdata.zzdpos.base.BaseFragment; import com.xingdata.zzdpos.base.BaseFragment;
import com.xingdata.zzdpos.databinding.FragmentReplenishementBinding; import com.xingdata.zzdpos.databinding.FragmentReplenishementBinding;
import com.xingdata.zzdpos.databinding.ItemStringBinding;
import com.xingdata.zzdpos.model.Psb; import com.xingdata.zzdpos.model.Psb;
import com.xingdata.zzdpos.ui.dialog.LoadingDialog; import com.xingdata.zzdpos.ui.dialog.LoadingDialog;
import com.xingdata.zzdpos.ui.main.adapter.FragmentViewAdapter; import com.xingdata.zzdpos.ui.main.adapter.FragmentViewAdapter;
...@@ -18,19 +23,23 @@ import com.xingdata.zzdpos.ui.manage.replenishment.adpter.ReplenishmentAdapter; ...@@ -18,19 +23,23 @@ import com.xingdata.zzdpos.ui.manage.replenishment.adpter.ReplenishmentAdapter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import io.reactivex.Observable;
import io.reactivex.ObservableEmitter;
import io.reactivex.ObservableOnSubscribe;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
/** /**
* Created by Administrator on 2017/11/24. * Created by Administrator on 2017/11/24.
*/ */
public class ReplenishmentFragment extends BaseFragment<ReplenishmentPresenter, FragmentReplenishementBinding> { public class ReplenishmentFragment extends BaseFragment<ReplenishmentPresenter, FragmentReplenishementBinding> {
private int[] titleInts = {R.string.manage_replenishment_unConfirmed, R.string.manage_replenishment_unReceive, R.string.manage_replenishment_finished};
private FragmentViewAdapter mFragmentPagerAdapter; private FragmentViewAdapter mFragmentPagerAdapter;
private List<BaseFragment> fragments; private List<BaseFragment> fragments;
private long mExitTime = 0;
private final int UNCONFIRMED = 3;
private final int UNRECEIVE = 1;
private final int FINISH = 0;
private int status = UNCONFIRMED;
@Override @Override
public int getLayoutId() { public int getLayoutId() {
...@@ -43,69 +52,82 @@ public class ReplenishmentFragment extends BaseFragment<ReplenishmentPresenter, ...@@ -43,69 +52,82 @@ public class ReplenishmentFragment extends BaseFragment<ReplenishmentPresenter,
initTab(); initTab();
mPresenter.queryPsbList(); mPresenter.queryPsbList();
//
// mViewBinding.btnAdd.setOnClickListener(view -> {
// mPresenter.clickAdd();
// });
//
// mViewBinding.btnSearch.setOnClickListener(view -> {
// if (mViewBinding.etKeyword.getText().toString().trim().length() == 0) {
// ToastUtils.showShort("请输入供货商名称");
// return;
// }
// List<Psb> psbs = new ArrayList<>();
// if (psbArrayList == null) {
// return;
// }
// for (Psb psb : psbArrayList) {
// if (mViewBinding.etKeyword.getText().toString().trim().length() == 0) {
// return;
// }
// Pattern pattern = Pattern.compile(mViewBinding.etKeyword.getText().toString(), Pattern.CASE_INSENSITIVE);
//
// Matcher matcher = pattern.matcher((psb.getOutChannelNameabcn() + ""));
// if (matcher.find()) {
// psbs.add(psb);
//
// }
// }
//
// mReplenishmentAdapter.setNewData(psbs);
// mReplenishmentAdapter.loadMoreEnd();
// });
} mViewBinding.btnAdd.setOnClickListener(view -> {
mPresenter.clickAdd();
});
mViewBinding.icTitle.ivRight.setImageResource(R.mipmap.but_sweep_yard);
mViewBinding.icTitle.edTitle.setHint("请输入供货商名称");
mViewBinding.icTitle.edTitle.setOnClickListener(view -> {
if (mViewBinding.icTitle.edTitle.getText().toString().trim().length() == 0) {
ToastUtils.showShort("请输入供货商名称");
return;
}
switch (mViewBinding.tab.getSelectedTabPosition()) {
case 0:
mPresenter.searchPsbList(mViewBinding.icTitle.edTitle.getText().toString(), (ReplenishmentListFragment) fragments.get(0));
break;
case 1:
mPresenter.searchPsbList(mViewBinding.icTitle.edTitle.getText().toString(), (ReplenishmentListFragment) fragments.get(1));
break;
case 2:
mPresenter.searchPsbList(mViewBinding.icTitle.edTitle.getText().toString(), (ReplenishmentListFragment) fragments.get(2));
break;
}
});
// private void initRecycler() {
// mViewBinding.rlProduct.setLayoutManager(new GridLayoutManager(getActivity(), 3));
//
// mReplenishmentAdapter = new ReplenishmentAdapter(new ArrayList<>());
// mReplenishmentAdapter.setEmptyView(getEmptyView());
// mReplenishmentAdapter.bindToRecyclerView(mViewBinding.rlProduct);
// mViewBinding.srlProduct.setOnRefreshListener(this::onRefresh);
// mReplenishmentAdapter.setOnLoadMoreListener(this::onLoadMore, mViewBinding.rlProduct);
// mReplenishmentAdapter.setOnItemClickListener((adapter, view, position) -> {
// if ((System.currentTimeMillis() - mExitTime) > 500) {
// mPresenter.queryPsbDetail(mReplenishmentAdapter.getData().get(position));
// } else {
// ToastUtils.showLong("您操作太快了");
// }
//
// });
// }
private void onRefresh() {
mPresenter.refreshPsb();
} }
private void initTab() { private void initTab() {
mViewBinding.tab.setupWithViewPager(mViewBinding.fragmentContainer); mViewBinding.tab.setupWithViewPager(mViewBinding.fragmentContainer);
mViewBinding.tab.getTabAt(0).setText("待确认"); Observable.create(new ObservableOnSubscribe<View>() {
mViewBinding.tab.getTabAt(1).setText("待收货"); @Override
mViewBinding.tab.getTabAt(2).setText("已入库"); public void subscribe(ObservableEmitter<View> e) throws Exception {
e.onNext(getLayoutInflater().inflate(R.layout.item_string, null));
e.onNext(getLayoutInflater().inflate(R.layout.item_string, null));
e.onNext(getLayoutInflater().inflate(R.layout.item_string, null));
}
}).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer<View>() {
int i = 0;
@Override
public void accept(View view) throws Exception {
ItemStringBinding itemMenuBottomBinding = DataBindingUtil.bind(view);
if (i == 0) {
itemMenuBottomBinding.itemTv.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
}
itemMenuBottomBinding.itemTv.setText(titleInts[i]);
itemMenuBottomBinding.itemTv.setPadding(0, 0, 0, 0);
mViewBinding.tab.getTabAt(i).setCustomView(view);
i++;
}
});
mViewBinding.tab.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
TextView textView = (TextView) tab.getCustomView().findViewById(R.id.item_tv);
textView.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
TextView textView = (TextView) tab.getCustomView().findViewById(R.id.item_tv);
textView.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
}
});
} }
public void initData() { public void initData() {
......
...@@ -2,6 +2,7 @@ package com.xingdata.zzdpos.ui.manage.replenishment.fragment; ...@@ -2,6 +2,7 @@ package com.xingdata.zzdpos.ui.manage.replenishment.fragment;
import android.content.Intent; import android.content.Intent;
import android.os.Handler;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.view.View; import android.view.View;
import android.widget.TextView; import android.widget.TextView;
...@@ -24,11 +25,13 @@ import com.xingdata.zzdpos.ui.statistics.adapter.StatisticsOrderGroupAdapter; ...@@ -24,11 +25,13 @@ import com.xingdata.zzdpos.ui.statistics.adapter.StatisticsOrderGroupAdapter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ReplenishmentListFragment extends BaseFragment<ReplenishmentPresenter, FragmentReplenishmentListBinding> { public class ReplenishmentListFragment extends BaseFragment<ReplenishmentPresenter, FragmentReplenishmentListBinding> {
private ReplenishmentAdapter mReplenishmentAdapter; private ReplenishmentAdapter mReplenishmentAdapter;
private List<Psb> psbs = new ArrayList<>(); private List<Psb> psbArrayList = new ArrayList<>();
@Override @Override
public int getLayoutId() { public int getLayoutId() {
...@@ -38,12 +41,12 @@ public class ReplenishmentListFragment extends BaseFragment<ReplenishmentPresent ...@@ -38,12 +41,12 @@ public class ReplenishmentListFragment extends BaseFragment<ReplenishmentPresent
@Override @Override
public void initView() { public void initView() {
if (mReplenishmentAdapter == null) { if (mReplenishmentAdapter == null) {
mReplenishmentAdapter = new ReplenishmentAdapter(psbs); mReplenishmentAdapter = new ReplenishmentAdapter(psbArrayList);
mViewBinding.recycler.setLayoutManager(new LinearLayoutManager(getActivity())); mViewBinding.recycler.setLayoutManager(new LinearLayoutManager(getActivity()));
mViewBinding.recycler.setAdapter(mReplenishmentAdapter); mViewBinding.recycler.setAdapter(mReplenishmentAdapter);
} else { } else {
mViewBinding.recycler.setLayoutManager(new LinearLayoutManager(getActivity())); mViewBinding.recycler.setLayoutManager(new LinearLayoutManager(getActivity()));
mViewBinding.recycler.setAdapter(mReplenishmentAdapter); mViewBinding.recycler.setAdapter(mReplenishmentAdapter);
} }
...@@ -81,7 +84,7 @@ public class ReplenishmentListFragment extends BaseFragment<ReplenishmentPresent ...@@ -81,7 +84,7 @@ public class ReplenishmentListFragment extends BaseFragment<ReplenishmentPresent
*/ */
public void setData(List<Psb> psbList, boolean isRefresh) { public void setData(List<Psb> psbList, boolean isRefresh) {
if (mReplenishmentAdapter == null) { if (mReplenishmentAdapter == null) {
psbs = psbList; psbArrayList = psbList;
return; return;
} }
if (isRefresh) { if (isRefresh) {
...@@ -100,5 +103,37 @@ public class ReplenishmentListFragment extends BaseFragment<ReplenishmentPresent ...@@ -100,5 +103,37 @@ public class ReplenishmentListFragment extends BaseFragment<ReplenishmentPresent
} }
public void searchSucc(String wd) {
List<Psb> psbs = new ArrayList<>();
if (psbArrayList == null) {
return;
}
for (Psb psb : psbArrayList) {
if (wd.trim().length() == 0) {
return;
}
Pattern pattern = Pattern.compile(wd, Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher((psb.getOutChannelNameabcn() + ""));
if (matcher.find()) {
psbs.add(psb);
}
}
mViewBinding.recycler.setVisibility(View.GONE);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (psbs.size() == 0) {
mViewBinding.llEmpty.setVisibility(View.VISIBLE);
} else {
mReplenishmentAdapter.setNewData(psbs);
mReplenishmentAdapter.loadMoreEnd();
mViewBinding.recycler.setVisibility(View.VISIBLE);
}
}
}, 500);
}
} }
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/btn_add"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawablePadding="@dimen/dp_4" android:drawablePadding="@dimen/dp_4"
...@@ -51,43 +52,23 @@ ...@@ -51,43 +52,23 @@
android:id="@+id/tab" android:id="@+id/tab"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:tabIndicatorHeight="3dp"
app:tabMinWidth="150dp" app:tabMinWidth="150dp"
app:tabSelectedTextColor="@color/blue" app:tabTextColor="@color/black_baozheng">
app:tabTextColor="@color/black">
<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="待确认"
app:tabGravity="fill" />
<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="待收货"
app:tabGravity="fill" />
<android.support.design.widget.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="已入库"
app:tabGravity="fill" />
</android.support.design.widget.TabLayout> </android.support.design.widget.TabLayout>
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/all_margin" android:layout_height="@dimen/all_margin"
android:background="@color/gray_zhouyu" /> android:background="@color/gray_zhouyu"
/>
<android.support.v4.view.ViewPager <android.support.v4.view.ViewPager
android:id="@+id/fragment_container" android:id="@+id/fragment_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent" />
/>
</LinearLayout> </LinearLayout>
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="@color/white_caocao" android:background="@color/white_caocao"
android:focusable="true"
android:focusableInTouchMode="true"
> >
......
...@@ -660,6 +660,9 @@ ...@@ -660,6 +660,9 @@
<string name="ticket_detail_no">销售单号:</string> <string name="ticket_detail_no">销售单号:</string>
<!--管理POS--> <!--管理POS-->
<string name="manage_replenishment_add">一键补货</string> <string name="manage_replenishment_add">一键补货</string>
<string name="manage_replenishment_unConfirmed">待确认</string>
<string name="manage_replenishment_unReceive">待收货</string>
<string name="manage_replenishment_finished">已入库</string>
</resources> </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