|
|
@@ -36,6 +36,7 @@ import com.android.volley.Request;
|
|
|
import com.uas.uas_mes_stw.R;
|
|
|
import com.uas.uas_mes_stw.activity.FunctionActivity;
|
|
|
import com.uas.uas_mes_stw.bean.InductionBean;
|
|
|
+import com.uas.uas_mes_stw.bean.PositionInfo;
|
|
|
import com.uas.uas_mes_stw.global.GloableParams;
|
|
|
import com.uas.uas_mes_stw.listener.MyEditorActionListener;
|
|
|
import com.uas.uas_mes_stw.util.CameraUtil;
|
|
|
@@ -46,7 +47,6 @@ import com.uas.uas_mes_stw.util.FragmentUtils;
|
|
|
import com.uas.uas_mes_stw.util.HttpCallback;
|
|
|
import com.uas.uas_mes_stw.util.HttpParams;
|
|
|
import com.uas.uas_mes_stw.util.JsonUtils;
|
|
|
-import com.uas.uas_mes_stw.util.LogUtil;
|
|
|
import com.uas.uas_mes_stw.util.StringUtil;
|
|
|
import com.uas.uas_mes_stw.util.UnshelvedMaterialsBean;
|
|
|
import com.uas.uas_mes_stw.util.VolleyRequest;
|
|
|
@@ -83,11 +83,20 @@ public class SmartShelvestFragment extends BaseFragment {
|
|
|
private SelectAdapter myAdapter;
|
|
|
private ArrayList<InductionBean> mFeededList;
|
|
|
private CheckBox cb_quanxuan;
|
|
|
- private String barIds = "";
|
|
|
+ private String barIds = ""; //条码ID
|
|
|
+ private int barNmber = 0; //条码数量
|
|
|
private RelativeLayout rl_quanxuan;
|
|
|
|
|
|
private String INNO = ""; //入库单
|
|
|
- private String UNUPCOUNT = ""; //未上架物料
|
|
|
+ private String INID = ""; //入库单ID
|
|
|
+ private String UNUPCOUNT = ""; //未上架物料数
|
|
|
+ private RelativeLayout rl_muqiancangwei; //目前仓位
|
|
|
+ private RecyclerView rv_muqiancangwei; //目前仓位List
|
|
|
+ private LinearLayout ll_store_info;
|
|
|
+ private LinearLayout ll_weishangjia;
|
|
|
+ private TextView tv_rukudan_value,tv_yishangjiawuliao_value,tv_weishangjiawuliao_value,tv_yigouxuanpanshu;
|
|
|
+ private CurrentPositionAdapter currentPositionAdapter;
|
|
|
+ private ArrayList<PositionInfo> positionInfos;
|
|
|
|
|
|
@Override
|
|
|
protected int getLayout() {
|
|
|
@@ -113,6 +122,17 @@ public class SmartShelvestFragment extends BaseFragment {
|
|
|
rv_data = mActivity.findViewById(R.id.rv_data);
|
|
|
cb_quanxuan = mActivity.findViewById(R.id.cb_quanxuan);
|
|
|
rl_quanxuan = mActivity.findViewById(R.id.rl_quanxuan);
|
|
|
+
|
|
|
+ ll_store_info = mActivity.findViewById(R.id.ll_store_info);
|
|
|
+ tv_rukudan_value = mActivity.findViewById(R.id.tv_rukudan_value);
|
|
|
+ ll_weishangjia = mActivity.findViewById(R.id.ll_weishangjia);
|
|
|
+ tv_yishangjiawuliao_value = mActivity.findViewById(R.id.tv_yishangjiawuliao_value);
|
|
|
+ tv_weishangjiawuliao_value = mActivity.findViewById(R.id.tv_weishangjiawuliao_value);
|
|
|
+ tv_yigouxuanpanshu = mActivity.findViewById(R.id.tv_yigouxuanpanshu);
|
|
|
+
|
|
|
+ rl_muqiancangwei = mActivity.findViewById(R.id.rl_muqiancangwei);
|
|
|
+ rv_muqiancangwei = mActivity.findViewById(R.id.rv_muqiancangwei);
|
|
|
+
|
|
|
mBarcodeEditText.requestFocus();
|
|
|
jsonObject = new org.json.JSONObject();
|
|
|
}
|
|
|
@@ -194,28 +214,43 @@ public class SmartShelvestFragment extends BaseFragment {
|
|
|
cb_quanxuan.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
@Override
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
|
- if (buttonView.isPressed()) { //只有当用户主动点击时才处理选中状态变化
|
|
|
- if (isChecked) {
|
|
|
- if (mFeededList.size() > 0) {
|
|
|
- barIds = "";
|
|
|
- for (int i = 0; i < mFeededList.size(); i++) {
|
|
|
- mFeededList.get(i).setCheck(true);
|
|
|
- barIds += mFeededList.get(i).getBAR_ID() + "," ;
|
|
|
+ try {
|
|
|
+ if (buttonView.isPressed()) { //只有当用户主动点击时才处理选中状态变化
|
|
|
+ if (isChecked) {
|
|
|
+ if (mFeededList.size() > 0) {
|
|
|
+ barIds = "";
|
|
|
+ barNmber = 0;
|
|
|
+ for (int i = 0; i < mFeededList.size(); i++) {
|
|
|
+ mFeededList.get(i).setCheck(true);
|
|
|
+ barIds += mFeededList.get(i).getBAR_ID() + "," ;
|
|
|
+ }
|
|
|
+ barNmber = mFeededList.size();
|
|
|
}
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (mFeededList.size() > 0) {
|
|
|
- barIds = "";
|
|
|
- for (int i = 0; i < mFeededList.size(); i++) {
|
|
|
- mFeededList.get(i).setCheck(false);
|
|
|
+ } else {
|
|
|
+ if (mFeededList.size() > 0) {
|
|
|
+ barIds = "";
|
|
|
+ barNmber = 0;
|
|
|
+ for (int i = 0; i < mFeededList.size(); i++) {
|
|
|
+ mFeededList.get(i).setCheck(false);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ tv_yigouxuanpanshu.setText(String.valueOf(barNmber));
|
|
|
+ setAdapter(mFeededList);
|
|
|
+ myAdapter.notifyDataSetChanged();
|
|
|
}
|
|
|
- setAdapter(mFeededList);
|
|
|
- myAdapter.notifyDataSetChanged();
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ ll_weishangjia.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ queryPID(INID);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
private void initPopupWindow() {
|
|
|
@@ -223,7 +258,7 @@ public class SmartShelvestFragment extends BaseFragment {
|
|
|
|
|
|
Button doneButton = (Button) view.findViewById(R.id.pop_storage_recharge_menu_1);
|
|
|
Button todoButton = (Button) view.findViewById(R.id.pop_storage_recharge_menu_2);
|
|
|
- Button bt_unshelved_materials = (Button) view.findViewById(R.id.bt_unshelved_materials);
|
|
|
+
|
|
|
doneButton.setText("仓位物料查询");
|
|
|
todoButton.setVisibility(View.GONE);
|
|
|
mFragment = new PositionInquiryFragment();
|
|
|
@@ -239,13 +274,6 @@ public class SmartShelvestFragment extends BaseFragment {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- bt_unshelved_materials.setOnClickListener(new View.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View v) {
|
|
|
- queryPID(INNO);
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
mMenuPopupWindow = new PopupWindow(view, LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT, true);
|
|
|
mMenuPopupWindow.setBackgroundDrawable(new BitmapDrawable());
|
|
|
mMenuPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
|
|
|
@@ -289,6 +317,7 @@ public class SmartShelvestFragment extends BaseFragment {
|
|
|
Fragment mFragment = new UnshelvedMaterialsFra();
|
|
|
Bundle bundle = new Bundle();
|
|
|
bundle.putString(Constants.FLAG.FLAG_INNO, INNO);
|
|
|
+ bundle.putString(Constants.FLAG.FLAG_INID, INID);
|
|
|
bundle.putString(Constants.FLAG.FLAG_UNUPCOUNT, UNUPCOUNT);
|
|
|
bundle.putSerializable(Constants.FLAG.FLAG_UNUPCOUNT_VALUE,(Serializable)list);
|
|
|
mFragment.setArguments(bundle);
|
|
|
@@ -308,6 +337,7 @@ public class SmartShelvestFragment extends BaseFragment {
|
|
|
mResultTextView.setVisibility(View.VISIBLE);
|
|
|
tv_newtext1.setVisibility(View.GONE);
|
|
|
tv_newtext2.setVisibility(View.GONE);
|
|
|
+ rl_muqiancangwei.setVisibility(View.GONE);
|
|
|
mResultTextView.setText(failStr);
|
|
|
}
|
|
|
});
|
|
|
@@ -323,6 +353,15 @@ public class SmartShelvestFragment extends BaseFragment {
|
|
|
|
|
|
@Override
|
|
|
protected void initDatas() {
|
|
|
+ positionInfos = new ArrayList<>();
|
|
|
+ currentPositionAdapter = new CurrentPositionAdapter(positionInfos);
|
|
|
+ rv_muqiancangwei.addItemDecoration(new DividerItemDecoration(mActivity, LinearLayout.VERTICAL));
|
|
|
+ rv_muqiancangwei.setLayoutManager(new LinearLayoutManager(mActivity));
|
|
|
+ //设置Item增加、移除动画
|
|
|
+ rv_muqiancangwei.setItemAnimator(new DefaultItemAnimator());
|
|
|
+ setCurrentPosition(positionInfos);
|
|
|
+ rv_muqiancangwei.setAdapter(currentPositionAdapter);
|
|
|
+
|
|
|
mFeededList = new ArrayList<>();
|
|
|
myAdapter = new SelectAdapter(mFeededList);
|
|
|
rv_data.addItemDecoration(new DividerItemDecoration(mActivity, LinearLayout.VERTICAL));
|
|
|
@@ -368,16 +407,49 @@ public class SmartShelvestFragment extends BaseFragment {
|
|
|
String LOCATIONS = dataObject.getString("LOCATIONS") == null ? "" : dataObject.getString("LOCATIONS");
|
|
|
mResultTextView.setTextColor(getResources().getColor(R.color.blue));
|
|
|
mResultTextView.setVisibility(View.VISIBLE);
|
|
|
- tv_newtext1.setVisibility(View.VISIBLE);
|
|
|
+ // tv_newtext1.setVisibility(View.VISIBLE);
|
|
|
tv_newtext2.setVisibility(View.VISIBLE);
|
|
|
- mResultTextView.setText(TYPE + ":" + mBarcodeEditText.getText().toString().trim()
|
|
|
- + "\n编号:" + BAR_PRODCODE + " 数量:" + BAR_REMAIN
|
|
|
- + "\n物料:" + PR_DETAIL
|
|
|
- + "\n规格:" + PR_SPEC
|
|
|
- + "\n默认仓位:" + PR_LOCATION);
|
|
|
- tv_newtext1.setText("目前仓位:" + BAR_LOCATION
|
|
|
- + "\n已存放仓位:" + LOCATIONS);
|
|
|
- tv_newtext2.setText("建议仓位:" + LOCATION);
|
|
|
+ mResultTextView.setText(TYPE + ": " + mBarcodeEditText.getText().toString().trim()
|
|
|
+ + "\n料号: " + BAR_PRODCODE + " 数量: " + BAR_REMAIN
|
|
|
+ + "\n物料: " + PR_DETAIL
|
|
|
+ + "\n规格: " + PR_SPEC
|
|
|
+ + "\n默认仓位: " + PR_LOCATION + " 目前仓位: " + BAR_LOCATION);
|
|
|
+ tv_newtext2.setText("建议仓位: " + LOCATION);
|
|
|
+ //tv_newtext1.setText("\n目前仓位:" + BAR_LOCATION);
|
|
|
+ //tv_newtext1.setText("已存放仓位:" + LOCATIONS);
|
|
|
+
|
|
|
+ //物料信息
|
|
|
+ JSONObject noprodlist = dataObject.getJSONObject("NOPRODLIST");
|
|
|
+ if (noprodlist != null) {
|
|
|
+ ll_store_info.setVisibility(View.VISIBLE);
|
|
|
+ INNO = noprodlist.getString("INNO"); //入库单
|
|
|
+ INID = noprodlist.getString("INID"); //入库单ID
|
|
|
+ UNUPCOUNT = noprodlist.getString("UNUPCOUNT"); //未上架物料数
|
|
|
+ tv_rukudan_value.setText(noprodlist.getString("INNO")); //入库单
|
|
|
+ tv_yishangjiawuliao_value.setText(noprodlist.getString("UPCOUNT"));
|
|
|
+ tv_weishangjiawuliao_value.setText(noprodlist.getString("UNUPCOUNT"));
|
|
|
+ }else {
|
|
|
+ ll_store_info.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
+ //目前已放仓位
|
|
|
+ JSONArray loclistArr = dataObject.getJSONArray("LOCLIST");
|
|
|
+ if (loclistArr != null && loclistArr.size() > 0) {
|
|
|
+ rl_muqiancangwei.setVisibility(View.VISIBLE);
|
|
|
+ positionInfos.clear();
|
|
|
+ for (int i = 0; i < loclistArr.size(); i++) {
|
|
|
+ JSONObject jsonObject = loclistArr.getJSONObject(i);
|
|
|
+ PositionInfo positionInfo = new PositionInfo();
|
|
|
+ positionInfo.setPL_CODE(FastjsonUtil.getText(jsonObject, "PL_CODE"));
|
|
|
+ positionInfo.setV_CAPACITY(FastjsonUtil.getInt(jsonObject, "V_CAPACITY"));
|
|
|
+ positionInfo.setPL_CAPACITY(FastjsonUtil.getInt(jsonObject, "PL_CAPACITY"));
|
|
|
+ positionInfos.add(positionInfo);
|
|
|
+ }
|
|
|
+ setCurrentPosition(positionInfos);
|
|
|
+ currentPositionAdapter.notifyDataSetChanged();
|
|
|
+ }else {
|
|
|
+ rl_muqiancangwei.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
+
|
|
|
if (!mLocationEditText.getText().toString().isEmpty() && !mBarcodeEditText.getText().toString().isEmpty()) {
|
|
|
saveBarAcceptCode("0");
|
|
|
} else {
|
|
|
@@ -385,9 +457,9 @@ public class SmartShelvestFragment extends BaseFragment {
|
|
|
}
|
|
|
JSONArray othersArr = dataObject.getJSONArray("OTHERS");
|
|
|
if (othersArr != null && othersArr.size() > 0) {
|
|
|
-
|
|
|
rl_quanxuan.setVisibility(View.VISIBLE);
|
|
|
cb_quanxuan.setChecked(false);
|
|
|
+ tv_yigouxuanpanshu.setText("0");
|
|
|
mFeededList.clear();
|
|
|
barIds = "";
|
|
|
for (int i = 0; i < othersArr.size(); i++) {
|
|
|
@@ -412,13 +484,12 @@ public class SmartShelvestFragment extends BaseFragment {
|
|
|
CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
mResultTextView.setTextColor(Color.RED);
|
|
|
mResultTextView.setVisibility(View.VISIBLE);
|
|
|
- tv_newtext1.setVisibility(View.GONE);
|
|
|
- tv_newtext2.setVisibility(View.GONE);
|
|
|
mResultTextView.setText(failStr);
|
|
|
mBarcodeEditText.requestFocus();
|
|
|
mBarcodeEditText.setText(null);
|
|
|
mLocationEditText.setText(null);
|
|
|
clearListData();
|
|
|
+ clearViewInfo();
|
|
|
}
|
|
|
});
|
|
|
} catch (Exception e) {
|
|
|
@@ -426,6 +497,13 @@ public class SmartShelvestFragment extends BaseFragment {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void clearViewInfo() {
|
|
|
+ tv_newtext1.setVisibility(View.GONE);
|
|
|
+ tv_newtext2.setVisibility(View.GONE);
|
|
|
+ ll_store_info.setVisibility(View.GONE);
|
|
|
+ rl_muqiancangwei.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
+
|
|
|
private void clearListData() {
|
|
|
rl_quanxuan.setVisibility(View.GONE);
|
|
|
mFeededList.clear();
|
|
|
@@ -464,8 +542,6 @@ public class SmartShelvestFragment extends BaseFragment {
|
|
|
public void onSuccess(int flag, Object o) throws Exception {
|
|
|
progressDialog.dismiss();
|
|
|
mResultTextView.setVisibility(View.VISIBLE);
|
|
|
- tv_newtext1.setVisibility(View.GONE);
|
|
|
- tv_newtext2.setVisibility(View.GONE);
|
|
|
mResultTextView.setTextColor(getResources().getColor(R.color.blue));
|
|
|
|
|
|
JSONObject dataObject = FastjsonUtil.getJSONObject(o.toString(), "data");
|
|
|
@@ -492,6 +568,7 @@ public class SmartShelvestFragment extends BaseFragment {
|
|
|
.setNegativeButton("否", null).show();
|
|
|
}
|
|
|
clearListData();
|
|
|
+ clearViewInfo();
|
|
|
mBarcodeEditText.requestFocus();
|
|
|
}
|
|
|
|
|
|
@@ -507,11 +584,10 @@ public class SmartShelvestFragment extends BaseFragment {
|
|
|
mBarcodeEditText.setText(null);
|
|
|
}
|
|
|
mResultTextView.setVisibility(View.VISIBLE);
|
|
|
- tv_newtext1.setVisibility(View.GONE);
|
|
|
- tv_newtext2.setVisibility(View.GONE);
|
|
|
mResultTextView.setTextColor(getResources().getColor(R.color.red));
|
|
|
mResultTextView.setText(failStr);
|
|
|
clearListData();
|
|
|
+ clearViewInfo();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
@@ -527,14 +603,13 @@ public class SmartShelvestFragment extends BaseFragment {
|
|
|
public void onSuccess(int flag, Object o) throws Exception {
|
|
|
progressDialog.dismiss();
|
|
|
mResultTextView.setVisibility(View.VISIBLE);
|
|
|
- tv_newtext1.setVisibility(View.GONE);
|
|
|
- tv_newtext2.setVisibility(View.GONE);
|
|
|
mResultTextView.setText(null);
|
|
|
mBarcodeEditText.setText(null);
|
|
|
mBarcodeEditText.requestFocus();
|
|
|
mResultTextView.setTextColor(getResources().getColor(R.color.blue));
|
|
|
mResultTextView.setText("结束上架操作成功");
|
|
|
clearListData();
|
|
|
+ clearViewInfo();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -543,16 +618,14 @@ public class SmartShelvestFragment extends BaseFragment {
|
|
|
CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
mResultTextView.setTextColor(getResources().getColor(R.color.red));
|
|
|
mResultTextView.setVisibility(View.VISIBLE);
|
|
|
- tv_newtext1.setVisibility(View.GONE);
|
|
|
- tv_newtext2.setVisibility(View.GONE);
|
|
|
mResultTextView.setText(failStr);
|
|
|
mBarcodeEditText.requestFocus();
|
|
|
mBarcodeEditText.setText(null);
|
|
|
mLocationEditText.setText(null);
|
|
|
clearListData();
|
|
|
+ clearViewInfo();
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -681,14 +754,17 @@ public class SmartShelvestFragment extends BaseFragment {
|
|
|
((ListItemViewHolder) holder).cb_danxuan.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
@Override
|
|
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
|
- if (buttonView.isPressed()) { //只有当用户主动点击时才处理选中状态变化
|
|
|
+ try {
|
|
|
+ if (buttonView.isPressed()) { //只有当用户主动点击时才处理选中状态变化
|
|
|
if (isChecked) {
|
|
|
if (!TextUtils.isEmpty(barIds)) {
|
|
|
if (!barIds.contains(mList.get(i).getBAR_ID())) {
|
|
|
barIds += mList.get(i).getBAR_ID() + ",";
|
|
|
+ barNmber++;
|
|
|
}
|
|
|
} else {
|
|
|
barIds = mList.get(i).getBAR_ID() + ",";
|
|
|
+ barNmber ++;
|
|
|
}
|
|
|
} else {
|
|
|
boolean checked = cb_quanxuan.isChecked();
|
|
|
@@ -701,15 +777,17 @@ public class SmartShelvestFragment extends BaseFragment {
|
|
|
int endIndex = startIndex + mList.get(i).getBAR_ID().length() + 1;
|
|
|
// 删除子串
|
|
|
barIds = barIds.substring(0, startIndex).concat(barIds.substring(endIndex));
|
|
|
- LogUtil.e("aaa","checkBox.setOnCheckedChangeListener长度是:" +barIds);
|
|
|
+ barNmber--;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ tv_yigouxuanpanshu.setText(String.valueOf(barNmber));
|
|
|
+ }
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -738,4 +816,154 @@ public class SmartShelvestFragment extends BaseFragment {
|
|
|
rv_data.setAdapter(myAdapter);
|
|
|
}
|
|
|
|
|
|
+ //目前仓位
|
|
|
+ public class CurrentPositionAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
|
|
+
|
|
|
+ private ArrayList<PositionInfo> mList = new ArrayList<>();
|
|
|
+ private SparseBooleanArray mSelectedPositions = new SparseBooleanArray();
|
|
|
+ private boolean mIsSelectable = false;
|
|
|
+
|
|
|
+ public CurrentPositionAdapter(ArrayList<PositionInfo> list) {
|
|
|
+ if (list == null) {
|
|
|
+ throw new IllegalArgumentException("model Data must not be null");
|
|
|
+ }
|
|
|
+ mList = list;
|
|
|
+ }
|
|
|
+
|
|
|
+ //更新adpter的数据和选择状态
|
|
|
+ public void updateDataSet(ArrayList<PositionInfo> list) {
|
|
|
+ this.mList = list;
|
|
|
+ mSelectedPositions = new SparseBooleanArray();
|
|
|
+ // ab.setTitle("已选择" + 0 + "项");
|
|
|
+ notifyDataSetChanged();
|
|
|
+ }
|
|
|
+
|
|
|
+ //获得选中条目的结果
|
|
|
+ public ArrayList<PositionInfo> getSelectedItem() {
|
|
|
+ ArrayList<PositionInfo> selectList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < mList.size(); i++) {
|
|
|
+ if (isItemChecked(i)) {
|
|
|
+ selectList.add(mList.get(i));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return selectList;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
|
|
|
+ View itemView = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_position_info, viewGroup, false);
|
|
|
+ return new ListItemViewHolder(itemView);
|
|
|
+ }
|
|
|
+
|
|
|
+ //设置给定位置条目的选择状态
|
|
|
+ private void setItemChecked(int position, boolean isChecked) {
|
|
|
+ mSelectedPositions.put(position, isChecked);
|
|
|
+ }
|
|
|
+
|
|
|
+ //根据位置判断条目是否选中
|
|
|
+ private boolean isItemChecked(int position) {
|
|
|
+ return mSelectedPositions.get(position);
|
|
|
+ }
|
|
|
+
|
|
|
+ //根据位置判断条目是否可选
|
|
|
+ private boolean isSelectable() {
|
|
|
+ return mIsSelectable;
|
|
|
+ }
|
|
|
+
|
|
|
+ //设置给定位置条目的可选与否的状态
|
|
|
+ private void setSelectable(boolean selectable) {
|
|
|
+ mIsSelectable = selectable;
|
|
|
+ }
|
|
|
+
|
|
|
+ //绑定界面,设置监听
|
|
|
+ @Override
|
|
|
+ public void onBindViewHolder(final RecyclerView.ViewHolder holder, @SuppressLint("RecyclerView") int i) {
|
|
|
+ if (i == 0) {
|
|
|
+ ((ListItemViewHolder) holder).tv_cangwei.setVisibility(View.VISIBLE);
|
|
|
+ ((ListItemViewHolder) holder).tv_rongliang.setVisibility(View.VISIBLE);
|
|
|
+ ((ListItemViewHolder) holder).tv_caozuo.setVisibility(View.VISIBLE);
|
|
|
+ }else {
|
|
|
+ ((ListItemViewHolder) holder).tv_cangwei.setVisibility(View.GONE);
|
|
|
+ ((ListItemViewHolder) holder).tv_rongliang.setVisibility(View.GONE);
|
|
|
+ ((ListItemViewHolder) holder).tv_caozuo.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
+
|
|
|
+ ((ListItemViewHolder) holder).tv_cangwei_value.setText(mList.get(i).getPL_CODE());
|
|
|
+ int v_capacity = mList.get(i).getV_CAPACITY();
|
|
|
+ int pl_capacity = mList.get(i).getPL_CAPACITY();
|
|
|
+ ((ListItemViewHolder) holder).tv_rongliang_value.setText(v_capacity + "/" + pl_capacity);
|
|
|
+ if (v_capacity == pl_capacity) {
|
|
|
+ ((ListItemViewHolder) holder).tv_caozuo_value.setText("已满仓");
|
|
|
+ ((ListItemViewHolder) holder).tv_caozuo_value.setEnabled(false);
|
|
|
+ ((ListItemViewHolder) holder).tv_caozuo_value.setTextColor(getActivity().getResources().getColor(R.color.gray1));
|
|
|
+ }else {
|
|
|
+ ((ListItemViewHolder) holder).tv_caozuo_value.setText("确认满仓");
|
|
|
+ ((ListItemViewHolder) holder).tv_caozuo_value.setTextColor(getActivity().getResources().getColor(R.color.button_focus));
|
|
|
+ ((ListItemViewHolder) holder).tv_caozuo_value.setEnabled(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ ((ListItemViewHolder) holder).tv_caozuo_value.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ progressDialog.show();
|
|
|
+ try {
|
|
|
+ VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_UPDATE_FULL_STATUS)
|
|
|
+ .method(Request.Method.POST)
|
|
|
+ .addParam("location", mList.get(i).getPL_CODE())
|
|
|
+ .addParam("qty", String.valueOf(v_capacity))
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ boolean success = FastjsonUtil.getBoolean(o.toString(), "success");
|
|
|
+ JSONObject dataObject = FastjsonUtil.getJSONObject(o.toString(), "data");
|
|
|
+ if (success) {
|
|
|
+ mList.get(i).setPL_CAPACITY(mList.get(i).getV_CAPACITY());
|
|
|
+ notifyDataSetChanged();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int getItemCount() {
|
|
|
+ return mList == null ? 0 : mList.size();
|
|
|
+ }
|
|
|
+
|
|
|
+ public class ListItemViewHolder extends RecyclerView.ViewHolder {
|
|
|
+ TextView tv_cangwei;
|
|
|
+ TextView tv_cangwei_value;
|
|
|
+ TextView tv_rongliang;
|
|
|
+ TextView tv_rongliang_value;
|
|
|
+ TextView tv_caozuo;
|
|
|
+ TextView tv_caozuo_value;
|
|
|
+
|
|
|
+ ListItemViewHolder(View view) {
|
|
|
+ super(view);
|
|
|
+ this.tv_cangwei = (TextView) view.findViewById(R.id.tv_cangwei);
|
|
|
+ this.tv_cangwei_value = (TextView) view.findViewById(R.id.tv_cangwei_value);
|
|
|
+ this.tv_rongliang = (TextView) view.findViewById(R.id.tv_rongliang);
|
|
|
+ this.tv_rongliang_value = (TextView) view.findViewById(R.id.tv_rongliang_value);
|
|
|
+ this.tv_caozuo = (TextView) view.findViewById(R.id.tv_caozuo);
|
|
|
+ this.tv_caozuo_value = (TextView) view.findViewById(R.id.tv_caozuo_value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void setCurrentPosition(ArrayList<PositionInfo> mList) {
|
|
|
+ currentPositionAdapter = new CurrentPositionAdapter(mList);
|
|
|
+ rv_muqiancangwei.setAdapter(currentPositionAdapter);
|
|
|
+ }
|
|
|
}
|