|
@@ -1,6 +1,7 @@
|
|
|
package com.uas.jc_wms.fragment;
|
|
|
|
|
|
import android.app.Activity;
|
|
|
+import android.content.DialogInterface;
|
|
|
import android.content.Intent;
|
|
|
import android.graphics.drawable.BitmapDrawable;
|
|
|
import android.os.Bundle;
|
|
@@ -67,6 +68,7 @@ public class InventoryCollectFragment extends BaseFragment implements View.OnCli
|
|
|
private List<InventoryCollctBean> mStockTaskMultipleBeans;
|
|
|
private CheckBox mCheckBox;
|
|
|
private String bar_remain;
|
|
|
+ private AlertDialog alertDialog;
|
|
|
|
|
|
@Override
|
|
|
protected int getLayout() {
|
|
@@ -86,6 +88,8 @@ public class InventoryCollectFragment extends BaseFragment implements View.OnCli
|
|
|
mNumTextView = root.findViewById(R.id.inventory_collect_num_tv);
|
|
|
mClassTextView = root.findViewById(R.id.inventory_collect_class_tv);
|
|
|
cb_caiji=root.findViewById(R.id.cb_caiji);
|
|
|
+ tvPiInoutno=root.findViewById(R.id.tv_pi_inoutno);
|
|
|
+
|
|
|
|
|
|
mBarcodeEditText.requestFocus();
|
|
|
|
|
@@ -214,6 +218,7 @@ public class InventoryCollectFragment extends BaseFragment implements View.OnCli
|
|
|
.tag(TAG + "getbarcodeinfo")
|
|
|
.flag(0)
|
|
|
.addParam("barcode", barcode)
|
|
|
+// .addParam("code", pi_inoutno)
|
|
|
.build(), new HttpCallback() {
|
|
|
@Override
|
|
|
public void onSuccess(int flag, Object o) throws Exception {
|
|
@@ -229,89 +234,109 @@ public class InventoryCollectFragment extends BaseFragment implements View.OnCli
|
|
|
|
|
|
View dialogView = View.inflate(getActivity(), R.layout.dialog_confirm_quantity, null);
|
|
|
final EditText modifyEditText = dialogView.findViewById(R.id.recharge_modify_et);
|
|
|
- final AlertDialog alertDialog = new AlertDialog.Builder(getActivity()).setTitle("确认数量")
|
|
|
+
|
|
|
+// TextView tv_uninventoried_quantity = dialogView.findViewById(R.id.tv_uninventoried_quantity);
|
|
|
+// TextView tv_material_no = dialogView.findViewById(R.id.tv_material_no);
|
|
|
+// TextView tv_material_name = dialogView.findViewById(R.id.tv_material_name);
|
|
|
+// TextView tv_material_specification = dialogView.findViewById(R.id.tv_material_specification);
|
|
|
+//
|
|
|
+// tv_uninventoried_quantity.setText(FastjsonUtil.getText(dataObject, "UNQTY"));
|
|
|
+// tv_material_no.setText(FastjsonUtil.getText(dataObject, "BAR_PRODCODE"));
|
|
|
+// tv_material_name.setText(FastjsonUtil.getText(dataObject, "PR_DETAIL"));
|
|
|
+// tv_material_specification.setText(FastjsonUtil.getText(dataObject, "PR_SPEC"));
|
|
|
+
|
|
|
+ alertDialog = new AlertDialog.Builder(getActivity()).setTitle("确认数量")
|
|
|
.setView(dialogView)
|
|
|
.setNegativeButton(R.string.cancel, null)
|
|
|
- .setPositiveButton(R.string.confirm, null).create();
|
|
|
- alertDialog.show();
|
|
|
- modifyEditText.setText(bar_remain);
|
|
|
- modifyEditText.setSelection(modifyEditText.getText().length());
|
|
|
- alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View view) {
|
|
|
- if (StringUtil.isEmpty(modifyEditText.getText().toString().trim())) {
|
|
|
- CommonUtil.toastNoRepeat(getActivity(), "请输入条码数量");
|
|
|
- return;
|
|
|
- }
|
|
|
- double quantity = -1;
|
|
|
- try {
|
|
|
- quantity = Double.parseDouble(modifyEditText.getText().toString().trim());
|
|
|
- } catch (Exception e) {
|
|
|
- CommonUtil.toastNoRepeat(getActivity(), "请输入正确的数字");
|
|
|
- return;
|
|
|
- }
|
|
|
- if (quantity <= 0) {
|
|
|
- CommonUtil.toastNoRepeat(getActivity(), "数量必须大于0");
|
|
|
- return;
|
|
|
- }
|
|
|
- VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
- .url(GloableParams.ADDRESS_BARSTOCK_GETBARCODEINFO)
|
|
|
- .method(Request.Method.GET)
|
|
|
- .tag(TAG + "getbarcodeinfo")
|
|
|
- .flag(0)
|
|
|
- .addParam("inoutno", pi_inoutno)
|
|
|
- //.addParam("deadline", deadLine)
|
|
|
- .addParam("barcode", barcode)
|
|
|
- .addParam("iscancel", isChecked + "")
|
|
|
- .addParam("bar_remain", modifyEditText.getText().toString().trim())
|
|
|
- .build(), new HttpCallback() {
|
|
|
+ .setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
|
|
|
@Override
|
|
|
- public void onSuccess(int flag, Object o) throws Exception {
|
|
|
- alertDialog.dismiss();
|
|
|
+ public void onClick(DialogInterface dialog, int which) {
|
|
|
+ if (StringUtil.isEmpty(modifyEditText.getText().toString().trim())) {
|
|
|
+ CommonUtil.toastNoRepeat(getActivity(), "请输入条码数量");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ double quantity = -1;
|
|
|
try {
|
|
|
- mBarcodeEditText.setText("");
|
|
|
- String result = o.toString();
|
|
|
- JSONObject resultObject = JSON.parseObject(result);
|
|
|
- JSONObject dataObject = resultObject.getJSONObject("data");
|
|
|
- if (dataObject != null) {
|
|
|
- String type = FastjsonUtil.getText(dataObject, "BI_TYPE");
|
|
|
- String prompt = "采集成功!";
|
|
|
- if (!"超期".equals(type)) {
|
|
|
- mResultTextView.setTextColor(mActivity.getResources().getColor(R.color.black));
|
|
|
- prompt = "采集成功!";
|
|
|
- } else {
|
|
|
- mResultTextView.setTextColor(mActivity.getResources().getColor(R.color.red));
|
|
|
- prompt = "采集成功!已超期";
|
|
|
+ quantity = Double.parseDouble(modifyEditText.getText().toString().trim());
|
|
|
+ } catch (Exception e) {
|
|
|
+ CommonUtil.toastNoRepeat(getActivity(), "请输入正确的数字");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (quantity <= 0) {
|
|
|
+ CommonUtil.toastNoRepeat(getActivity(), "数量必须大于0");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_BARSTOCK_GETBARCODEINFO)
|
|
|
+ .method(Request.Method.GET)
|
|
|
+ .tag(TAG + "getbarcodeinfo")
|
|
|
+ .flag(0)
|
|
|
+ .addParam("inoutno", pi_inoutno)
|
|
|
+ //.addParam("deadline", deadLine)
|
|
|
+ .addParam("barcode", barcode)
|
|
|
+ .addParam("iscancel", isChecked + "")
|
|
|
+ .addParam("bar_remain", modifyEditText.getText().toString().trim())
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ alertDialog.dismiss();
|
|
|
+ try {
|
|
|
+ mBarcodeEditText.setText("");
|
|
|
+ String result = o.toString();
|
|
|
+ JSONObject resultObject = JSON.parseObject(result);
|
|
|
+ JSONObject dataObject = resultObject.getJSONObject("data");
|
|
|
+ if (dataObject != null) {
|
|
|
+ String type = FastjsonUtil.getText(dataObject, "BI_TYPE");
|
|
|
+ String prompt = "采集成功!";
|
|
|
+ if (!"超期".equals(type)) {
|
|
|
+ mResultTextView.setTextColor(mActivity.getResources().getColor(R.color.black));
|
|
|
+ prompt = "采集成功!";
|
|
|
+ } else {
|
|
|
+ mResultTextView.setTextColor(mActivity.getResources().getColor(R.color.red));
|
|
|
+ prompt = "采集成功!已超期";
|
|
|
+ }
|
|
|
+
|
|
|
+ mResultTextView.setVisibility(View.VISIBLE);
|
|
|
+ mResultTextView.setText(prompt
|
|
|
+ + "\n物料:" + FastjsonUtil.getText(dataObject, "BI_PRODCODE")
|
|
|
+ // + "\n品牌:" + FastjsonUtil.getText(dataObject, "BI_BRAND")
|
|
|
+ // + "\nLOTNO:" + FastjsonUtil.getText(dataObject, "BI_LOTNO")
|
|
|
+ // + "\nDC:" + FastjsonUtil.getText(dataObject, "BI_DATECODE")
|
|
|
+ + "\n型号:" + FastjsonUtil.getText(dataObject, "PR_ORISPECCODE")
|
|
|
+ + "\n条码号:" + FastjsonUtil.getText(dataObject, "BI_BARCODE")
|
|
|
+ + "\n数量:" + FastjsonUtil.getText(dataObject, "BI_INQTY")
|
|
|
+ );
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ alertDialog.dismiss();
|
|
|
+ mBarcodeEditText.setText("");
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
mResultTextView.setVisibility(View.VISIBLE);
|
|
|
- mResultTextView.setText(prompt
|
|
|
- + "\n物料:" + FastjsonUtil.getText(dataObject, "BI_PRODCODE")
|
|
|
- // + "\n品牌:" + FastjsonUtil.getText(dataObject, "BI_BRAND")
|
|
|
- // + "\nLOTNO:" + FastjsonUtil.getText(dataObject, "BI_LOTNO")
|
|
|
- // + "\nDC:" + FastjsonUtil.getText(dataObject, "BI_DATECODE")
|
|
|
- + "\n型号:" + FastjsonUtil.getText(dataObject, "PR_ORISPECCODE")
|
|
|
- + "\n条码号:" + FastjsonUtil.getText(dataObject, "BI_BARCODE")
|
|
|
- + "\n数量:" + FastjsonUtil.getText(dataObject, "BI_INQTY")
|
|
|
- );
|
|
|
+ mResultTextView.setText(failStr);
|
|
|
}
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
+ });
|
|
|
}
|
|
|
+ }).create();
|
|
|
+ modifyEditText.setText(bar_remain);
|
|
|
+ modifyEditText.setSelection(modifyEditText.getText().length());
|
|
|
+// alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() {
|
|
|
+// @Override
|
|
|
+// public void onClick(View view) {
|
|
|
+//
|
|
|
+// }
|
|
|
+// });
|
|
|
|
|
|
- @Override
|
|
|
- public void onFail(int flag, String failStr) throws Exception {
|
|
|
- alertDialog.dismiss();
|
|
|
- mBarcodeEditText.setText("");
|
|
|
- progressDialog.dismiss();
|
|
|
- CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
- mResultTextView.setVisibility(View.VISIBLE);
|
|
|
- mResultTextView.setText(failStr);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
+ // 禁用屏幕外点击
|
|
|
+ alertDialog.setCancelable(false);
|
|
|
+ alertDialog.setCanceledOnTouchOutside(false);
|
|
|
+ alertDialog.show();
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|