|
|
@@ -0,0 +1,204 @@
|
|
|
+package com.uas.keg_wms_new.fragment;
|
|
|
+
|
|
|
+import android.graphics.Color;
|
|
|
+import android.support.v4.content.ContextCompat;
|
|
|
+import android.text.TextUtils;
|
|
|
+import android.view.KeyEvent;
|
|
|
+import android.view.View;
|
|
|
+import android.view.WindowManager;
|
|
|
+import android.widget.Button;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.android.volley.Request;
|
|
|
+import com.bin.david.form.core.SmartTable;
|
|
|
+import com.bin.david.form.core.TableConfig;
|
|
|
+import com.bin.david.form.data.CellInfo;
|
|
|
+import com.bin.david.form.data.column.Column;
|
|
|
+import com.bin.david.form.data.format.bg.BaseCellBackgroundFormat;
|
|
|
+import com.bin.david.form.data.style.FontStyle;
|
|
|
+import com.bin.david.form.data.table.TableData;
|
|
|
+import com.uas.keg_wms_new.R;
|
|
|
+import com.uas.keg_wms_new.activity.FunctionActivity;
|
|
|
+import com.uas.keg_wms_new.bean.InventoryVerificationStorageLocationBean;
|
|
|
+import com.uas.keg_wms_new.global.GloableParams;
|
|
|
+import com.uas.keg_wms_new.util.CommonUtil;
|
|
|
+import com.uas.keg_wms_new.util.HttpCallback;
|
|
|
+import com.uas.keg_wms_new.util.HttpParams;
|
|
|
+import com.uas.keg_wms_new.util.VolleyRequest;
|
|
|
+import com.uas.keg_wms_new.view.ClearableEditText;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+public
|
|
|
+ /**
|
|
|
+ * Created by sw on 2024-12-31
|
|
|
+ */
|
|
|
+class InventoryVerificationStorageLocationsFra extends BaseFragment{
|
|
|
+
|
|
|
+ private ClearableEditText cet_bar_code,cet_position;
|
|
|
+ private Button bt_query;
|
|
|
+ private List<InventoryVerificationStorageLocationBean> ivslbList;
|
|
|
+ private Column<String> BAR_LOCATIO, BAR_PRODCODE, BAR_REMAIN ;
|
|
|
+ private SmartTable st_data;
|
|
|
+ private TableData mTableData;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected int getLayout() {
|
|
|
+ return R.layout.fra_inventory_veriflcation_storage_location;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void initViews() {
|
|
|
+ FunctionActivity.setTitle(getResources().getString(R.string.Inventory_verification_of_storage_locations));
|
|
|
+ cet_bar_code = root.findViewById(R.id.cet_bar_code);
|
|
|
+ cet_position = root.findViewById(R.id.cet_position);
|
|
|
+ bt_query = root.findViewById(R.id.bt_query);
|
|
|
+ st_data = root.findViewById(R.id.st_data);
|
|
|
+
|
|
|
+ cet_bar_code.requestFocus();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void initEvents() {
|
|
|
+ bt_query.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ getQueryData();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void getQueryData() {
|
|
|
+ String barCode = cet_bar_code.getText().toString().trim();
|
|
|
+ String position = cet_position.getText().toString().trim();
|
|
|
+ if (TextUtils.isEmpty(barCode) && TextUtils.isEmpty(position)) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "请输入需要查询的(料号/条码)或仓位");
|
|
|
+ if (TextUtils.isEmpty(barCode)) {
|
|
|
+ cet_bar_code.requestFocus();
|
|
|
+ }else {
|
|
|
+ cet_position.requestFocus();
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ progressDialog.show();
|
|
|
+ VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_LOCATION_CHECK)
|
|
|
+ .method(Request.Method.GET)
|
|
|
+ .addParam("pr_code",barCode)
|
|
|
+ .addParam("location",position)
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ String result = o.toString();
|
|
|
+ JSONObject resultObject = JSON.parseObject(result);
|
|
|
+ JSONArray dataArr = resultObject.getJSONArray("data");
|
|
|
+ if (dataArr != null) {
|
|
|
+ if (dataArr.size() > 0) {
|
|
|
+ for (int i = 0; i < dataArr.size(); i++) {
|
|
|
+ JSONObject jsonObject = dataArr.getJSONObject(i);
|
|
|
+ InventoryVerificationStorageLocationBean ivslb = new InventoryVerificationStorageLocationBean();
|
|
|
+ ivslb.setBAR_REMAIN(jsonObject.getInteger("BAR_REMAIN"));
|
|
|
+ ivslb.setBAR_LOCATION(jsonObject.getString("BAR_LOCATION"));
|
|
|
+ ivslb.setPR_SPEC(jsonObject.getString("PR_SPEC"));
|
|
|
+ ivslb.setPR_DETAIL(jsonObject.getString("PR_DETAIL"));
|
|
|
+ ivslb.setBAR_PRODCODE(jsonObject.getString("BAR_PRODCODE"));
|
|
|
+ ivslbList.add(ivslb);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "未匹配到数据");
|
|
|
+ }
|
|
|
+ if (ivslbList.size() > 0) {
|
|
|
+ setFilterTableData(ivslbList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ cet_bar_code.setText("");
|
|
|
+ cet_position.setText("");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void initDatas() {
|
|
|
+ ivslbList = new ArrayList();
|
|
|
+
|
|
|
+ WindowManager wm = mActivity.getWindowManager();
|
|
|
+ int screenWith = wm.getDefaultDisplay().getWidth();
|
|
|
+ st_data.getConfig().setMinTableWidth(screenWith)
|
|
|
+ .setShowXSequence(false)
|
|
|
+ .setShowYSequence(false)
|
|
|
+ .setShowTableTitle(false)
|
|
|
+ .setFixedTitle(true)
|
|
|
+ .setVerticalPadding(CommonUtil.dip2px(mActivity, 12))
|
|
|
+ .setColumnTitleVerticalPadding(CommonUtil.dip2px(mActivity, 12))
|
|
|
+ .setHorizontalPadding(CommonUtil.dip2px(mActivity, 10))
|
|
|
+ .setSequenceHorizontalPadding(CommonUtil.dip2px(mActivity, 10))
|
|
|
+ .setColumnTitleHorizontalPadding(CommonUtil.dip2px(mActivity, 10))
|
|
|
+ .setColumnTitleStyle(new FontStyle(CommonUtil.sp2px(mActivity, 15), Color.parseColor("#000000")))
|
|
|
+ .setContentCellBackgroundFormat(new BaseCellBackgroundFormat<CellInfo>() {
|
|
|
+ @Override
|
|
|
+ public int getBackGroundColor(CellInfo cellInfo) {
|
|
|
+ if (cellInfo.row % 2 == 0) {
|
|
|
+ return ContextCompat.getColor(mActivity, R.color.blue_50);
|
|
|
+ }
|
|
|
+ return TableConfig.INVALID_COLOR;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ BAR_LOCATIO = new Column<String>("仓位", "BAR_LOCATIO");
|
|
|
+ BAR_PRODCODE = new Column<String>("物料编号", "BAR_PRODCODE");
|
|
|
+ BAR_REMAIN = new Column<String>("数量", "BAR_REMAIN");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void setFilterTableData(List<InventoryVerificationStorageLocationBean> filterTableData) {
|
|
|
+ mTableData = new TableData<InventoryVerificationStorageLocationBean>("出库单列表", filterTableData,
|
|
|
+ BAR_LOCATIO, BAR_PRODCODE, BAR_REMAIN);
|
|
|
+ st_data.setTableData(mTableData);
|
|
|
+ // st_data.requestLayout();
|
|
|
+ st_data.postDelayed(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ st_data.postInvalidate();
|
|
|
+ }
|
|
|
+ }, 100);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean onKeyDown(int keyCode, KeyEvent event) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean onFragmentBackPressed() {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onHiddenChanged(boolean hidden) {
|
|
|
+ super.onHiddenChanged(hidden);
|
|
|
+ // if (!hidden) {
|
|
|
+ // FunctionActivity.setTitle(getResources().getString(R.string.free_listing));
|
|
|
+ // ((FunctionActivity) getActivity()).setMoreBtnVisible(true);
|
|
|
+ // }else {
|
|
|
+ // ((FunctionActivity) getActivity()).setMoreBtnVisible(false);
|
|
|
+ // }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onDestroyView() {
|
|
|
+ super.onDestroyView();
|
|
|
+ // ((FunctionActivity) getActivity()).setMoreBtnVisible(false);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|