Commit 5526a8d8 authored by 陈前's avatar 陈前

盘点

parent bcafe356
......@@ -110,6 +110,10 @@
android:name=".ui.manage.replenishment.ReplenishmentActivity"
android:configChanges="keyboard|orientation|screenSize|keyboardHidden"
android:windowSoftInputMode="adjustUnspecified|stateHidden" />
<activity
android:name=".ui.manage.inventory.InventoryActivity"
android:configChanges="keyboard|orientation|screenSize|keyboardHidden"
android:windowSoftInputMode="adjustUnspecified|stateHidden" />
</application>
</manifest>
\ No newline at end of file
package com.xingdata.zzdpos.ui.manage.inventory;
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;
import com.xingdata.zzdpos.databinding.ActivityInventoryBinding;
import com.xingdata.zzdpos.model.Cs;
import com.xingdata.zzdpos.model.CsDetail;
import com.xingdata.zzdpos.model.Sssku;
import com.xingdata.zzdpos.ui.dialog.LoadingDialog;
import com.xingdata.zzdpos.ui.manage.inventory.fragment.InventoryFragment;
import java.util.List;
public class InventoryActivity extends BaseActivity<InventoryPresenter, ActivityInventoryBinding> implements InventoryContract.View {
private InventoryFragment mInventoryFragment = new InventoryFragment();
// private InventoryAddFragment mInventoryAddFragment = new InventoryAddFragment();
// private InventoryDetailDialog mInventoryDetailDialog = new InventoryDetailDialog();
LoadingDialog mLoadingDialog = new LoadingDialog();
@Override
public int getLayoutId() {
return R.layout.activity_inventory;
}
@Override
public void initView() {
loadRootFragment(R.id.f_bottom, mInventoryFragment, true, false);
}
@Override
public void addCsGoodItem(String key) {
// if (ActivityUtils.getTopActivity().equals(this) && FragmentUtils.getTopShow(getSupportFragmentManager()).equals(mInventoryAddFragment)) {
// mInventoryAddFragment.addCsGoodItem(key);
// }
}
@Override
public void addInventoryDetailItem(CsDetail csDetail, Sssku sssku) {
// mInventoryAddFragment.addInventoryDetailItem(csDetail, sssku);
}
@Override
public void addInventoryGoodsItem(List<Sssku> ssskuList) {
// mInventoryAddFragment.addInventoryGoodsItem(ssskuList);
}
@Override
public void addInventoryGoodsItem(Sssku sssku) {
// mInventoryAddFragment.addInventoryGoodsItem(sssku);
}
@Override
public void showInventoryDetailDialog(Cs cs) {
// mInventoryDetailDialog.setData(cs).show(this);
}
@Override
public void disInventoryDetailFragment(Boolean idChange) {
if (idChange) {
// mInventoryAddFragment.pop();
mPresenter.refreshCs();
} else {
// mInventoryAddFragment.pop();
}
}
@Override
public void loadCs(List<Cs> csList, boolean isRefresh, boolean isLastPage) {
mInventoryFragment.setData(csList, isRefresh, isLastPage);
}
@Override
public void setInventoryCount(int count) {
// mInventoryFragment.setCount(count);
}
@Override
public void openInventoryAddFragment(Cs cs) {
// mInventoryFragment.isShowLoading(false);
// mInventoryAddFragment.setCs(cs);
// start(mInventoryAddFragment);
}
@Override
public void showDateAlert(Boolean f) {
// mInventoryFragment.showDateAlert(f);
}
@Override
protected void onPause() {
KeyboardUtils.hideSoftInput(this);
super.onPause();
}
@Override
public void searchGoodsSuc() {
// mInventoryAddFragment.searchGoodsSuc();
}
@Override
public void isShowLoading(Boolean is) {
if (is) {
mLoadingDialog.show((BaseActivity) mContext);
} else {
if (mLoadingDialog.isShowing) {
mLoadingDialog.dismiss();
}
}
}
}
package com.xingdata.zzdpos.ui.manage.inventory;
import com.xingdata.zzdpos.base.BasePresenter;
import com.xingdata.zzdpos.base.BaseView;
import com.xingdata.zzdpos.model.Cs;
import com.xingdata.zzdpos.model.CsDetail;
import com.xingdata.zzdpos.model.Sssku;
import java.util.List;
/**
* Created by Eurus on 2017/11/23.
*/
public interface InventoryContract {
interface View extends BaseView {
/**
* 添加盘库 搜索商品成功
*/
void searchGoodsSuc();
void isShowLoading(Boolean is);
/**
* 添加盘库商品条目
*/
void addCsGoodItem(String key);
/**
* 设置盘库记录条目数量
*/
void setInventoryCount(int count);
/**
* 关闭添加盘库详情界面
*/
void disInventoryDetailFragment(Boolean isChange);
/**
* 添加左侧详情商品条目
*/
void addInventoryDetailItem(CsDetail csDetail, Sssku sssku);
/**
* 添加商品条目
*/
void addInventoryGoodsItem(List<Sssku> ssskuList);
void addInventoryGoodsItem(Sssku sssku);
//________________________________________
/**
* 展示记录详情Dialog
*/
void showInventoryDetailDialog(Cs csDetailList);
/**
* 加载列表
*/
void loadCs(List<Cs> csList, boolean isRefresh, boolean isLastPage);
/**
* 跳转盘库页
*/
void openInventoryAddFragment(Cs cs);
/**
* 盘库页面-展示日期警告
*/
void showDateAlert(Boolean f);
}
abstract class Presenter extends BasePresenter<View> {
/**
* 盘库添加页面 - 取消退出这次盘库的记录
*
* @param cs 盘库记录
*/
public abstract void cancelInventoryAdd(Cs cs);
/**
* 盘库添加页面 - 结束盘库记录
*/
public abstract void exitInventoryAdd();
/**
* 盘库添加页面-确认盘库明细
*/
public abstract void clickOkCsDetail(Sssku ssku, Cs cs);
/**
* 根据条形码获取商品
*
* @param barcode 条形码
*/
public abstract void getProductByBarcode(String barcode);
/**
* 盘库列表页面 - 删除列表里的记录
*
* @param cs 盘库记录
*/
public abstract void delInventoryItem(Cs cs);
/**
* 盘库列表页面 - 点击列表里的记录
*
* @param cs 盘库记录
*/
public abstract void clickInventoryItem(Cs cs);
/**
* 盘库列表页面-检查日期合法性
*
* @param dateStart 起始时间
* @param dateEnd 终止时间
*/
public abstract void inspectDate(String dateStart, String dateEnd, int pageSize);
/**
* 盘库列表页面-点击开始盘库
*/
public abstract void clickStartInventory();
/**
* 获取盘库列表
*/
public abstract void getInventoryList(long start, long end);
/**
* 获取盘库列表
*/
public abstract void getInventoryList(long start, long end, int PageNumber, int pageSize);
/**
* 盘库列表页面 - 加载更多
*/
public abstract void loadMoreCs();
/**
* 盘库列表页面 - 刷新
*/
public abstract void refreshCs();
}
}
package com.xingdata.zzdpos.ui.manage.inventory;
import com.blankj.utilcode.util.TimeUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.xingdata.zzdpos.api.ApiFactory;
import com.xingdata.zzdpos.db.DBFactory;
import com.xingdata.zzdpos.model.Cs;
import com.xingdata.zzdpos.model.CsDetail;
import com.xingdata.zzdpos.model.Sssku;
import com.xingdata.zzdpos.util.StringUtil;
import java.text.SimpleDateFormat;
public class InventoryPresenter extends InventoryContract.Presenter {
private int nowPageNumber = 1;
private int nowPageSize = 1;
private long start;
private long end;
@Override
public void onAttached() {
}
@Override
public void clickOkCsDetail(Sssku sssku, Cs mCs) {
CsDetail csDetail = new CsDetail();
csDetail.setSpuName(sssku.getSpuName());
csDetail.setSkuId(sssku.getSkuId());
csDetail.setSpuBarcode(sssku.getSpuBarcode());
csDetail.setSkuCnt(sssku.getSkuStock());
csDetail.setSpuUnitName(sssku.getSpuUnitName());
csDetail.setCsCnt((long) sssku.getInventoryCut());
csDetail.setChannelMapId(mCs.getChannelMapId().longValue());
csDetail.setCsNo(mCs.getCsNo());
csDetail.setSkuId(sssku.getSkuId());
csDetail.setOpMapId(mCs.getOpMapId().longValue());
if (csDetail.getCsCnt() == csDetail.getSkuCnt()) {
csDetail.setCsResultFlag(0);
} else if (csDetail.getCsCnt() > csDetail.getSkuCnt()) {
csDetail.setCsResultFlag(1);
} else {
csDetail.setCsResultFlag(2);
}
ApiFactory.CsDetail.addCsDetail(csDetail)
.subscribe(detail -> {
mView.addInventoryDetailItem(detail, sssku);
}, throwable -> {
ToastUtils.showShort(throwable.getMessage());
});
}
@Override
public void getProductByBarcode(String barcode) {
}
@Override
public void clickInventoryItem(Cs cs) {
mView.isShowLoading(true);
ApiFactory.Cs.getCsDetail(cs.getId()).doFinally(() -> mView.isShowLoading(false))
.subscribe(cslist -> {
mView.showInventoryDetailDialog(cslist);
}, throwable -> {
ToastUtils.showShort(throwable.getMessage());
});
}
@Override
public void delInventoryItem(Cs cs) {
ApiFactory.Cs.delCsDetail(cs.getId(), cs.getCsNo())
.subscribe(object -> {
refreshCs();
}, throwable -> {
ToastUtils.showShort(throwable.getMessage());
});
}
@Override
public void cancelInventoryAdd(Cs cs) {
ApiFactory.Cs.delCsDetail(cs.getId(), cs.getCsNo())
.subscribe(object -> {
mView.disInventoryDetailFragment(false);
}, throwable -> {
ToastUtils.showShort(throwable.getMessage());
});
}
@Override
public void exitInventoryAdd() {
mView.disInventoryDetailFragment(true);
}
@Override
public void inspectDate(String dateStart, String dateEnd, int pageSize) {
long longStart = TimeUtils.string2Millis(dateStart, new SimpleDateFormat(StringUtil.defaultDatePattern));
long longEnd = TimeUtils.string2Millis(dateEnd, new SimpleDateFormat(StringUtil.defaultDatePattern)) + 86400000L;
if (longStart > longEnd) {
ToastUtils.showShort("日期不符合区间");
mView.showDateAlert(true);
} else {
mView.showDateAlert(false);
getInventoryList(longStart, longEnd, 1, pageSize);
}
}
@Override
public void clickStartInventory() {
mView.isShowLoading(true);
ApiFactory.Cs.addCs().doFinally(() -> {
mView.isShowLoading(false);
}).subscribe(cs -> {
if (cs.getCreateTime() == null) {
cs.setCreateTime(System.currentTimeMillis());
}
mView.openInventoryAddFragment(cs);
}, throwable -> {
ToastUtils.showShort(throwable.getMessage());
});
}
@Override
public void getInventoryList(long start, long end) {
ApiFactory.Cs.querCsList(nowPageNumber, nowPageSize, start, end)
.subscribe(csPager -> {
//判断是否能加载更多
mView.loadCs(csPager.getList(), nowPageNumber == 1, csPager.isLastPage());
mView.setInventoryCount(csPager.getTotalRow());
}, throwable -> {
ToastUtils.showShort(throwable.getMessage());
});
}
@Override
public void getInventoryList(long startdate, long enddate, int pageNumber, int pageSize) {
this.nowPageNumber = pageNumber;
this.start = startdate;
this.end = enddate;
this.nowPageSize = pageSize;
getInventoryList(start, end);
}
@Override
public void loadMoreCs() {
this.nowPageNumber++;
getInventoryList(start, end);
}
@Override
public void refreshCs() {
this.nowPageNumber = 1;
getInventoryList(start, end);
}
}
//package com.xingdata.zzdpos.ui.manage.inventory.adpter;
//
//
//import android.graphics.drawable.Drawable;
//import android.support.annotation.Nullable;
//import android.view.View;
//import android.view.ViewGroup;
//
//import com.blankj.utilcode.util.TimeUtils;
//import com.xingdata.zzdpos.R;
//import com.xingdata.zzdpos.model.Cs;
//
//import java.util.List;
//
//
//public class InventoryAdapter extends BaseAdapter<Cs, ItemInventoryBinding> {
//
//
// public InventoryAdapter(@Nullable List<Cs> data) {
// super(R.layout.item_inventory, data);
//
// }
//
//
// @Override
// protected void convert(ItemInventoryBinding mViewBinding, Cs item) {
// Drawable drawable=mContext.getResources().getDrawable(R.mipmap.icon_time);
// drawable.setBounds(0,0,(int)mViewBinding.tvDate.getTextSize(),(int)mViewBinding.tvDate.getTextSize());
//
// mViewBinding.tvDate.setCompoundDrawablesRelative(drawable,null,null,null);
// mViewBinding.tvDate.setCompoundDrawablePadding(10);
// mViewBinding.tvName.setText(item.getOperName());
// mViewBinding.tvDate.setText(TimeUtils.millis2String(item.getCreateTime())+"");
// mViewBinding.tvNum.setText(item.getCsdetailCount()+"");
// switch (item.getCsResultFlag()){
// case 0:
// mViewBinding.tvResult.setText("相符");
// mViewBinding.imgInventory.setImageResource(R.mipmap.icon_consistent);
// break;
// case 1:
// mViewBinding.tvResult.setText("不相符");
// mViewBinding.imgInventory.setImageResource(R.mipmap.icon_no_consistent);
// break;
// }
//
//
// }
//
// @Override
// protected View getItemView(int layoutResId, ViewGroup parent) {
// return super.getItemView(layoutResId, parent);
// }
//
//
//}
//package com.xingdata.zzdpos.ui.manage.inventory.adpter;
//
//
//import android.support.annotation.Nullable;
//import android.view.View;
//import android.view.ViewGroup;
//
//
//import java.util.List;
//
//public class InventoryDetailAdapter extends BaseAdapter<CsDetail, ItemInventoryLeftBinding> {
// private int count = 1;
//
// public InventoryDetailAdapter(@Nullable List<CsDetail> data) {
// super(R.layout.item_inventory_left, data);
//
// }
//
//
// @Override
// protected void convert(ItemInventoryLeftBinding mViewBinding, CsDetail item) {
//
// mViewBinding.tvName.setText(item.getSpuName());
// mViewBinding.tvStockCount.setText(item.getSkuCnt() + "");
// mViewBinding.tvResultCount.setText(item.getCsCnt() + "");
// switch (item.getCsResultFlag()) {
// case 0://相等
// mViewBinding.imgResult.setImageResource(R.mipmap.icon_mark_equal);
// break;
// case 1://盘多
// mViewBinding.imgResult.setImageResource(R.mipmap.icon_mark_offer_more);
// break;
// case 2://盘少
// mViewBinding.imgResult.setImageResource(R.mipmap.icon_mark_offer_less);
// break;
// }
// }
//
// @Override
// protected View getItemView(int layoutResId, ViewGroup parent) {
// return super.getItemView(layoutResId, parent);
// }
//
//
//}
//package com.xingdata.zzdpos.ui.manage.inventory.adpter;
//
//
//import android.support.annotation.Nullable;
//import android.text.Editable;
//import android.text.TextWatcher;
//import android.view.View;
//import android.view.ViewGroup;
//import android.widget.EditText;
//
//import com.facebook.drawee.view.SimpleDraweeView;
//import com.xingdata.zzdhd.R;
//import com.xingdata.zzdhd.base.BaseAdapter;
//import com.xingdata.zzdhd.base.BaseViewHolder;
//import com.xingdata.zzdhd.databinding.ItemInventoryGoodsBinding;
//import com.xingdata.zzdhd.model.Sssku;
//import com.xingdata.zzdhd.util.ConvertUtil;
//
//import java.util.List;
//
//public class InventoryGoodsAdapter extends BaseAdapter<Sssku, ItemInventoryGoodsBinding> {
// private int count ;
//
// public InventoryGoodsAdapter(@Nullable List<Sssku> data) {
// super(R.layout.item_inventory_goods, data);
//
// }
//
//
// @Override
// protected void convert(BaseViewHolder helper, 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_num, item.getSkuStock() + "");
//
// ((SimpleDraweeView) helper.getView(R.id.img_goods)).setImageURI(item.getSpuImg());
// helper.getView(R.id.btn_up).setOnClickListener(v -> {
// if (count > 0 && count < 9999) {
// helper.setText(R.id.et_count, String.valueOf(++count));
// item.setInventoryCut(count);
// }
// });
// helper.getView(R.id.btn_down).setOnClickListener(v -> {
// if (count == 1) {
// item.setInventoryCut(count);
//
//
// return;
// }
// if (count > 1 && count < 100) {
// helper.setText(R.id.et_count, String.valueOf(--count));
// item.setInventoryCut(count);
// }
// });
// ((EditText) helper.getView(R.id.et_count)).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());
// item.setInventoryCut(count);
// }
//
// @Override
// public void afterTextChanged(Editable editable) {
// }
// }));
// helper.addOnClickListener(R.id.btn_ok);
//
// super.convert(helper, item);
// }
//
// @Override
// protected void convert(ItemInventoryGoodsBinding mViewBinding, Sssku item) {
//
// }
//
// @Override
// protected View getItemView(int layoutResId, ViewGroup parent) {
// return super.getItemView(layoutResId, parent);
// }
//
//
//}
//package com.xingdata.zzdpos.ui.manage.inventory.dialog;
//
//import android.support.v7.widget.LinearLayoutManager;
//import android.view.View;
//
//import com.blankj.utilcode.util.TimeUtils;
//import com.blankj.utilcode.util.ToastUtils;
//import com.xingdata.api.print.ZX_PrintPOS;
//import com.xingdata.zzdhd.R;
//import com.xingdata.zzdhd.base.BaseDialog;
//import com.xingdata.zzdhd.databinding.DialogInventoryDetailBinding;
//import com.xingdata.zzdhd.model.Cs;
//import com.xingdata.zzdhd.model.CsDetail;
//import com.xingdata.zzdhd.ui.manager.inventory.InventoryPresenter;
//import com.xingdata.zzdhd.ui.manager.inventory.adpter.InventoryDetailAdapter;
//
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * Created by Administrator on 2017/12/4.
// */
//
//public class InventoryDetailDialog extends BaseDialog<InventoryPresenter, DialogInventoryDetailBinding> {
// private InventoryDetailAdapter mInventoryDetailAdapter;
// private List<CsDetail> csDetails = new ArrayList<>();
// private Cs cs;
// private long mExitTime=0;
//
//
// @Override
// public int getLayoutId() {
// return R.layout.dialog_inventory_detail;
// }
//
// @Override
// public void initView() {
// initLeftRecycler();
// if (cs == null) {
// ToastUtils.showShort("未获取到相关数据");
// return;
// }
// setBtnName("取消", "打印清单");
// mViewBinding.setOperName(cs.getOperName());
// mViewBinding.setDate(TimeUtils.millis2String(cs.getCreateTime()));
// mViewBinding.setSumNum(cs.getCount() + "");
// switch (cs.getCsResultFlag()) {
// case 0:
// mViewBinding.setFinallyResult("相符");
// break;
// case 1:
// mViewBinding.setFinallyResult("不相符");
// break;
// }
// csDetails.clear();
// csDetails.addAll(cs.getCsdetailList());
// mInventoryDetailAdapter.notifyDataSetChanged();
// getDialog().setCanceledOnTouchOutside(false);
//
// }
//
// @Override
// protected boolean isShowTitle() {
// return false;
// }
//
// public InventoryDetailDialog setData(Cs csDetailList) {
// this.cs = csDetailList;
// return this;
// }
//
// private void initLeftRecycler() {
// mViewBinding.replenishmentLeftRecycler.setLayoutManager(new LinearLayoutManager(getActivity()));
// mInventoryDetailAdapter = new InventoryDetailAdapter(csDetails);
// mViewBinding.replenishmentLeftRecycler.setAdapter(mInventoryDetailAdapter);
// }
//
// @Override
// public void onConfirmClick(View view) {
// if ((System.currentTimeMillis() - mExitTime) > 2000) {
// ZX_PrintPOS.getInstance(mContext).printInventory(1,cs);
// } else {
//
// }
// super.onConfirmClick(view);
// }
//}
//package com.xingdata.zzdpos.ui.manage.inventory.fragment;
//
//import android.support.v7.widget.LinearLayoutManager;
//import android.view.KeyEvent;
//import android.view.View;
//
//import com.blankj.utilcode.util.KeyboardUtils;
//import com.blankj.utilcode.util.TimeUtils;
//import com.blankj.utilcode.util.ToastUtils;
//import com.xingdata.api.print.ZX_PrintPOS;
//import com.xingdata.zzdpos.ui.manage.inventory.InventoryPresenter;
//
//
//import java.util.ArrayList;
//import java.util.List;
//
//
///**
// * Created by Administrator on 2017/11/24.
// */
//
//public class InventoryAddFragment extends BaseFragment<InventoryPresenter, FragmentInventoryAddBinding> {
// private List<CsDetail> leftCsList = new ArrayList<>();
// private List<Sssku> rightCsList = new ArrayList<>();
// private InventoryGoodsAdapter mInventoryGoodsAdapter;
// private InventoryDetailAdapter mInventoryDetailAdapter;
// private Cs mCs;
// private boolean isResult = true;
//
// @Override
// public int getLayoutId() {
// return R.layout.fragment_inventory_add;
// }
//
// @Override
// public void initView() {
// initData();
// initLeftRecycler();
// initRightRecycler();
// mViewBinding.etKeyword.requestFocus();
// mViewBinding.btnSearch.setOnClickListener(view -> {
// if (mViewBinding.etKeyword.getText().toString().trim().length() == 0) {
// ToastUtils.showShort("请输入商品条码");
// return;
// }
// mPresenter.getProductByBarcode(mViewBinding.etKeyword.getText().toString());
// });
// mViewBinding.etKeyword.setOnKeyListener((v, keyCode, event) -> {
// if (keyCode == KeyEvent.KEYCODE_ENTER)
// if (mViewBinding.etKeyword.getText().toString().trim().length() != 0) {
// mPresenter.getProductByBarcode(mViewBinding.etKeyword.getText().toString());
// }
// return false;
// });
// mViewBinding.btnEnd.setOnClickListener(view -> {
// mPresenter.exitInventoryAdd();
// });
// mViewBinding.btnDel.setOnClickListener(view -> {
// {
// 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) {
// ZX_PrintPOS.getInstance(mContext).printInventory(1, mCs);
// }
// });
//
// }
//
// private void initLeftRecycler() {
// leftCsList.clear();
// mViewBinding.replenishmentLeftRecycler.setLayoutManager(new LinearLayoutManager(getActivity()));
// mInventoryDetailAdapter = new InventoryDetailAdapter(leftCsList);
// mViewBinding.replenishmentLeftRecycler.setAdapter(mInventoryDetailAdapter);
//
// mViewBinding.setSumNum("0");
// mViewBinding.setFinallyResult("暂无");
// }
//
// private void initRightRecycler() {
// mViewBinding.replenishmentRightRecycler.setLayoutManager(new LinearLayoutManager(getActivity()));
// mInventoryGoodsAdapter = new InventoryGoodsAdapter(rightCsList);
// mInventoryGoodsAdapter.setOnItemLongClickListener((adapter, view, position) -> {
// PromptDialog delDialog = new PromptDialog();
// delDialog.setDialogType(PromptDialog.PROMPTDIALOG_SELECT, "是否删除").setClick(new View.OnClickListener() {
// @Override
// public void onClick(View view) {
// adapter.getData().remove(position);
// adapter.notifyDataSetChanged();
// delDialog.dismiss();
// }
// }, new View.OnClickListener() {
// @Override
// public void onClick(View view) {
// delDialog.dismiss();
// }
// }).setCancelables(false).show((BaseActivity) mContext);
// return false;
// });
// mInventoryGoodsAdapter.setOnItemChildClickListener((adapter, view, position) -> {
// switch (view.getId()) {
// case R.id.btn_ok:
// PromptDialog promptDialog = new PromptDialog();
// promptDialog.setDialogType(PromptDialog.PROMPTDIALOG_SELECT, "请确认添加记录").setClick(view1 -> {
// mPresenter.clickOkCsDetail(mInventoryGoodsAdapter.getData().get(position), mCs);
// promptDialog.dismiss();
// }, view1 -> {
// promptDialog.dismiss();
// }).setCancelables(false).show((BaseActivity) mContext);
//
// break;
//
// }
//
// });
// mViewBinding.replenishmentRightRecycler.setAdapter(mInventoryGoodsAdapter);
//
// }
//
// private void initData() {
// if (mCs != null) {
// mViewBinding.setOperName(mCs.getOperName());
// mViewBinding.setDate(TimeUtils.millis2String(mCs.getCreateTime()));
// }
// }
//
// public void addInventoryGoodsItem(List<Sssku> list) {
// for (Sssku s : list) {
// if (rightCsList.contains(s)) {
// ToastUtils.showShort("商品已存在");
// } else {
// if (leftCsList.contains(s)) {
// ToastUtils.showShort("商品已盘点");
// } else {
// rightCsList.add(s);
// }
// }
// }
// mInventoryGoodsAdapter.notifyDataSetChanged();
// }
//
//
// public void addInventoryGoodsItem(Sssku sssku) {
// if (!rightCsList.contains(sssku)) {
// if (leftCsList.contains(sssku)) {
// ToastUtils.showShort("商品已盘点");
// } else {
// rightCsList.add(sssku);
// }
//
// } else {
// ToastUtils.showShort("商品已存在");
//
// }
//
// mInventoryGoodsAdapter.notifyDataSetChanged();
// }
//
// public void addInventoryDetailItem(CsDetail csDetail, Sssku sssku) {
// if (csDetail.getCsResultFlag() != 0) {
// isResult = false;
// }
// leftCsList.add(csDetail);
// mInventoryDetailAdapter.notifyDataSetChanged();
// mViewBinding.setSumNum(leftCsList.size() + "");
// rightCsList.remove(sssku);
// mInventoryGoodsAdapter.notifyDataSetChanged();
// if (isResult) {
// mViewBinding.setFinallyResult("相符");
// } else {
// mViewBinding.setFinallyResult("不相符");
// }
// }
//
//
// public void setCs(Cs cs) {
// mCs = cs;
// mCs.setCsdetailList(leftCsList);
// }
//
// public void addCsGoodItem(String key) {
// mViewBinding.etKeyword.setText(key);
// mViewBinding.btnSearch.performClick();
// }
//
// public void searchGoodsSuc() {
// mViewBinding.etKeyword.setText("");
// KeyboardUtils.hideSoftInput(getActivity());
// }
//}
package com.xingdata.zzdpos.ui.manage.inventory.fragment;
import android.databinding.DataBindingUtil;
import android.graphics.drawable.ColorDrawable;
import android.support.v7.widget.GridLayoutManager;
import android.text.Html;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.DatePicker;
import android.widget.PopupWindow;
import android.widget.TextView;
import com.xingdata.zzdpos.R;
import com.xingdata.zzdpos.base.BaseActivity;
import com.xingdata.zzdpos.base.BaseFragment;
import com.xingdata.zzdpos.databinding.FragmentInventoryBinding;
import com.xingdata.zzdpos.ui.dialog.LoadingDialog;
import com.xingdata.zzdpos.ui.manage.inventory.InventoryPresenter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Administrator on 2017/11/24.
*/
public class InventoryFragment extends BaseFragment<InventoryPresenter, FragmentInventoryBinding> {
// private InventoryAdapter mInventoryAdapter;
private PopupWindow mDateStartWindow;
private PopupWindow mDateEndWindow;
private String dateStart, dateEnd;
private float textSize;
LoadingDialog mLoadingDialog = new LoadingDialog();
@Override
public int getLayoutId() {
return R.layout.fragment_inventory;
}
@Override
public void initView() {
// initData();
// initEditAndPopup();
// mViewBinding.rlProduct.setLayoutManager(new GridLayoutManager(getActivity(), 4));
// mInventoryAdapter = new InventoryAdapter(new ArrayList<>());
// mInventoryAdapter.setEmptyView(getEmptyView());
// mViewBinding.rlProduct.setAdapter(mInventoryAdapter);
// mViewBinding.srlProduct.setOnRefreshListener(this::onRefresh);
// mInventoryAdapter.setOnLoadMoreListener(this::onLoadMore, mViewBinding.rlProduct);
// mInventoryAdapter.setOnItemClickListener((adapter, view, position) -> {
// mPresenter.clickInventoryItem(mInventoryAdapter.getData().get(position));
// });
// mViewBinding.btnAdd.setOnClickListener(new OnClickListener() {
// @Override
// protected void myOnClickListener(View v) {
// isShowLoading(true);
// mPresenter.clickStartInventory();
// }
// }
// );
// mInventoryAdapter.setOnItemLongClickListener((adapter, view, position) -> {
// PromptDialog promptDialog = new PromptDialog();
// promptDialog.setDialogType(PromptDialog.PROMPTDIALOG_SELECT, "请确认删除此记录").setClick(view1 -> {
// mPresenter.delInventoryItem(mInventoryAdapter.getData().get(position));
// promptDialog.dismiss();
// }, view1 -> {
// promptDialog.dismiss();
// }).setCancelables(false).show((BaseActivity) mContext);
// return false;
// });
}
// public void initData() {
// dateStart = StringUtil.monthStart();
// mViewBinding.dateStart.setText(dateStart);
// dateEnd = com.blankj.utilcode.util.TimeUtils.getNowString(new SimpleDateFormat(StringUtil.defaultDatePattern));
// mViewBinding.dateEnd.setText(dateEnd);
// mViewBinding.btnAdd.setText(R.string.inventory_add);
// setCount(0);
// mPresenter.inspectDate(mViewBinding.dateStart.getText().toString(), mViewBinding.dateEnd.getText().toString(), getPageSize());
//
// }
//
// public void setCount(int count) {
// mViewBinding.tvCount.setText(Html.fromHtml(getString(R.string.inventory_order, "<font color='#1f7bdb'><big> " + count + " </big></font>")));
// }
//
// private void onRefresh() {
// mPresenter.refreshCs();
// }
//
// private void onLoadMore() {
// mPresenter.loadMoreCs();
// }
/**
* 设置数据
*
* @param list 数据
* @param isRefresh 是否刷新
*/
public void setData(List list, boolean isRefresh, boolean lastPage) {
// if (isRefresh) {
// mInventoryAdapter.setEnableLoadMore(true);
// mViewBinding.srlProduct.setRefreshing(false);
// }
// if (isRefresh) mInventoryAdapter.setNewData(list);
// else if (list.size() > 0) mInventoryAdapter.addData(list);
// if (lastPage) mInventoryAdapter.loadMoreEnd(isRefresh);
// else mInventoryAdapter.loadMoreComplete();
}
protected int getPageSize() {
return 4;
}
private View getEmptyView() {
View view = getLayoutInflater().inflate(R.layout.view_empty, null);
TextView textView = view.findViewById(R.id.tv_empty);
textView.setText(R.string.inventory_empty_hint);
return view;
}
public void isShowLoading(Boolean is) {
if (is) {
mLoadingDialog.show((BaseActivity) mContext);
} else {
if (mLoadingDialog.isShowing) {
mLoadingDialog.dismiss();
}
}
}
}
......@@ -11,6 +11,7 @@ import com.chad.library.adapter.base.BaseQuickAdapter;
import com.xingdata.zzdpos.C;
import com.xingdata.zzdpos.R;
import com.xingdata.zzdpos.databinding.ActivityMarketingMenuBinding;
import com.xingdata.zzdpos.ui.manage.inventory.InventoryActivity;
import com.xingdata.zzdpos.ui.manage.otherselect.OtherSelectActivity;
import com.xingdata.zzdpos.ui.manage.replenishment.ReplenishmentActivity;
import com.xingdata.zzdpos.ui.marketing.integral.IntegralActivity;
......@@ -79,7 +80,7 @@ public class ManageMenuActivity extends AppCompatActivity {
}
break;
case C.MENU.MENU_MANAGER_INVENTORY: {
ActivityUtils.startActivity(ManageMenuActivity.this, InventoryActivity.class);
}
break;
default: {
......
......@@ -37,7 +37,6 @@ public class ReplenishmentPresenter extends ReplenishmentContract.Presenter {
} else {
mView.openReplenishmentDetailFragment(ssskuPager.getList());
}
}, throwable -> {
ToastUtils.showShort(throwable.getMessage());
});
......
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/f_bottom"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
</FrameLayout>
</android.support.constraint.ConstraintLayout>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:tools="http://schemas.android.com/tools">
<data>
</data>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white_caocao"
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_kongming" />
<LinearLayout
android:id="@+id/btn_add"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawablePadding="@dimen/dp_4"
android:drawableStart="@mipmap/but_add"
android:gravity="center"
android:padding="@dimen/all_padding"
android:text="@string/manage_inventory_add"
android:textColor="@color/red_lvzhi"
android:textSize="@dimen/big_text_size" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/view_line_L050"
android:background="@color/gray_kongming" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/gray_zhouyu"
android:paddingBottom="@dimen/all_padding"
android:paddingStart="@dimen/all_padding_left_right"
android:paddingTop="@dimen/all_padding"
android:text="共0人次盘库记录"
android:textColor="@color/black_baozheng"
android:textSize="@dimen/all_text_size_low"
android:textStyle="bold" />
<android.support.v4.view.ViewPager
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</layout>
\ No newline at end of file
......@@ -670,6 +670,6 @@
<string name="manage_replenishment_unConfirmed">待确认</string>
<string name="manage_replenishment_unReceive">待收货</string>
<string name="manage_replenishment_finished">已入库</string>
<string name="manage_inventory_add">开始盘库</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