|
|
@@ -730,14 +730,15 @@ public class IOCOutMakeMaterialOper extends BaseFragment implements View.OnClick
|
|
|
/**
|
|
|
* 在线模式确认按钮提交事件
|
|
|
*/
|
|
|
- private void barcodeEnterEvent(boolean msdcheck) {
|
|
|
+ private void barcodeEnterEvent(boolean msdcheck, boolean datecheck) {
|
|
|
progressDialog.show();
|
|
|
// currentBarcode = etBarCode.getText().toString().trim();
|
|
|
String url = (isMultiple ? GloableParams.ADDRESS_OUT_BYBATCH_DEAL : GloableParams.ADDRESS_OUT_BYBATCH_DEAL)
|
|
|
+ "?barcode=" + currentBarcode
|
|
|
+ (isMultiple ? "&ids=" : "&ids=")
|
|
|
+ pi_id + "&whcode=" + pd_whcode
|
|
|
- + "&type=barcode&msdcheck=" + msdcheck;
|
|
|
+ + "&type=barcode&msdcheck=" + msdcheck
|
|
|
+ + "&datecheck=" + datecheck;
|
|
|
try {
|
|
|
if (mProdOutType != null && mCollectType != null) {
|
|
|
if (mProdOutType.equals("byProdcode")) {
|
|
|
@@ -746,14 +747,16 @@ public class IOCOutMakeMaterialOper extends BaseFragment implements View.OnClick
|
|
|
+ "?barcode=" + URLEncoder.encode(currentBarcode, "utf-8")
|
|
|
+ (isMultiple ? "&ids=" : "&ids=")
|
|
|
+ pi_id + "&whcode=" + pd_whcode
|
|
|
- + "&type=barcode&msdcheck=" + msdcheck;
|
|
|
+ + "&type=barcode&msdcheck=" + msdcheck
|
|
|
+ + "&datecheck=" + datecheck;
|
|
|
|
|
|
} else if (mCollectType.equals("byBatchcode")) {
|
|
|
url = (isMultiple ? GloableParams.ADDRESS_OUT_BYBATCH_DEAL : GloableParams.ADDRESS_OUT_BYBATCH_DEAL)
|
|
|
+ "?barcode=" + URLEncoder.encode(currentBarcode, "utf-8")
|
|
|
+ (isMultiple ? "&ids=" : "&ids=")
|
|
|
+ pi_id + "&whcode=" + pd_whcode
|
|
|
- + "&type=batchcode&msdcheck=" + msdcheck;
|
|
|
+ + "&type=batchcode&msdcheck=" + msdcheck
|
|
|
+ + "&datecheck=" + datecheck;
|
|
|
}
|
|
|
} else if (mProdOutType.equals("byBatch")) {
|
|
|
if (mCollectType.equals("byBarcode")) {
|
|
|
@@ -761,13 +764,15 @@ public class IOCOutMakeMaterialOper extends BaseFragment implements View.OnClick
|
|
|
+ "?barcode=" + URLEncoder.encode(currentBarcode, "utf-8")
|
|
|
+ (isMultiple ? "&ids=" : "&ids=")
|
|
|
+ pi_id + "&whcode=" + pd_whcode
|
|
|
- + "&type=barcode&msdcheck=" + msdcheck;
|
|
|
+ + "&type=barcode&msdcheck=" + msdcheck
|
|
|
+ + "&datecheck=" + datecheck;
|
|
|
} else if (mCollectType.equals("byBatchcode")) {
|
|
|
url = (isMultiple ? GloableParams.ADDRESS_OUT_BYBATCH_DEAL : GloableParams.ADDRESS_OUT_BYBATCH_DEAL)
|
|
|
+ "?barcode=" + URLEncoder.encode(currentBarcode, "utf-8")
|
|
|
+ (isMultiple ? "&ids=" : "&ids=")
|
|
|
+ pi_id + "&whcode=" + pd_whcode
|
|
|
- + "&type=batchcode&msdcheck=" + msdcheck;
|
|
|
+ + "&type=batchcode&msdcheck=" + msdcheck
|
|
|
+ + "&datecheck=" + datecheck;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -794,7 +799,18 @@ public class IOCOutMakeMaterialOper extends BaseFragment implements View.OnClick
|
|
|
}
|
|
|
JSONObject messageObject = dataObject.getJSONObject("barcode");
|
|
|
|
|
|
- if (messageObject.has("ISMSD")) {
|
|
|
+ if (messageObject.has("IFOVER") && messageObject.optBoolean("IFOVER")) {
|
|
|
+ new AlertDialog.Builder(mActivity)
|
|
|
+ .setMessage("采集条码[" + messageObject.optString("BAR_CODE") + "]有效期已过,是否继续采集?")
|
|
|
+ .setNegativeButton(R.string.cancel, null)
|
|
|
+ .setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialogInterface, int i) {
|
|
|
+ dialogInterface.dismiss();
|
|
|
+ barcodeEnterEvent(false, false);
|
|
|
+ }
|
|
|
+ }).create().show();
|
|
|
+ } else if (messageObject.has("ISMSD")) {
|
|
|
if (messageObject.optBoolean("ISMSD")) {
|
|
|
//成功,有返回值,判断返回值message中isMsd是否存在,存在判断if(isMsd)true,弹出显示框
|
|
|
iocOutMakeMaterialOperMsd = JsonTools.parseJsonToBean(jsonObject.toString(), IOCOutMakeMaterialOperMsd.class);
|
|
|
@@ -1343,7 +1359,7 @@ public class IOCOutMakeMaterialOper extends BaseFragment implements View.OnClick
|
|
|
spliteBarcode(currentBarcode, bar_remain + "", restqty + "");
|
|
|
} else {
|
|
|
closePopupWindow();
|
|
|
- barcodeEnterEvent(true);
|
|
|
+ barcodeEnterEvent(true, false);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1516,7 +1532,192 @@ public class IOCOutMakeMaterialOper extends BaseFragment implements View.OnClick
|
|
|
String url = isMultiple ? GloableParams.ADDRESS_OUT_BYBATCH_BREAK_DEAL : GloableParams.ADDRESS_OUT_BYBATCH_BREAK_DEAL;
|
|
|
Log.d("breakDeal", url);
|
|
|
|
|
|
- RequestBody requestBody = new FormBody.Builder()
|
|
|
+ VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
+ .url(url)
|
|
|
+ .method(Request.Method.POST)
|
|
|
+ .addParam("ids", pi_id)
|
|
|
+ .addParam("barcode", currentBarcode)
|
|
|
+ .addParam("or_remain", mBarRemain)
|
|
|
+ .addParam("bar_remain", mRestqty)
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+
|
|
|
+ String s = o.toString();
|
|
|
+ if (popupWindow != null && popupWindow.isShowing())
|
|
|
+ closePopupWindow();
|
|
|
+ mResults = new ArrayList<>();
|
|
|
+ mCollectTypeRadioGroup.setEnabled(true);
|
|
|
+ LogUtil.e("breaking", s);
|
|
|
+ try {
|
|
|
+ JSONObject jsonObject = new JSONObject(s);
|
|
|
+ JSONObject dataObject = jsonObject.optJSONObject("data");
|
|
|
+ if (dataObject == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ JSONObject messageObject = dataObject.optJSONObject("barcode");
|
|
|
+ if (messageObject == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (messageObject.has("ISMSD")) {
|
|
|
+ if (messageObject.optBoolean("ISMSD")) {
|
|
|
+ //成功,有返回值,判断返回值message中isMsd是否存在,存在判断if(isMsd)true,弹出显示框
|
|
|
+ iocOutMakeMaterialOperMsd = JsonTools.parseJsonToBean(jsonObject.toString(), IOCOutMakeMaterialOperMsd.class);
|
|
|
+// Log.i("msdresult", iocOutMakeMaterialOperMsd.toString());
|
|
|
+ mBarRemain = CommonUtil.doubleFormat(iocOutMakeMaterialOperMsd.getData().getBarcode().getBAR_REMAIN());
|
|
|
+ mRestqty = CommonUtil.doubleFormat(iocOutMakeMaterialOperMsd.getData().getBarcode().getRESTQTY());
|
|
|
+ showDewPopupWindow();
|
|
|
+ } else {
|
|
|
+ mIocoutMaterialSplitBean = JsonTools.parseJsonToBean(messageObject.toString(), IOCOutmakeMaterialSplitBean.class);
|
|
|
+ mBarRemain = CommonUtil.doubleFormat(mIocoutMaterialSplitBean.getBAR_REMAIN());
|
|
|
+ mRestqty = CommonUtil.doubleFormat(mIocoutMaterialSplitBean.getRESTQTY());
|
|
|
+ if (CommonUtil.doubleCompare(mIocoutMaterialSplitBean.getBAR_REMAIN(), mIocoutMaterialSplitBean.getRESTQTY()) == 1) {
|
|
|
+ spliteBarcode(currentBarcode, mBarRemain, mRestqty);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ mCollectResultTextView.setVisibility(View.VISIBLE);
|
|
|
+ mCollectResultTextView.setText(null);
|
|
|
+ JSONArray listArray = dataObject.optJSONArray("nolist");
|
|
|
+ if (mCollectType.equals("byBarcode") || mCollectType.equals("byBatchcode")) {
|
|
|
+ String barcodeResult = "采集成功;" + JsonUtils.optStringNotNull(dataObject, "finishno")
|
|
|
+ + "\n条码:" + JsonUtils.optStringNotNull(messageObject, "BAR_CODE")
|
|
|
+ + ";数量:" + CommonUtil.doubleFormat(messageObject.optDouble("BAR_REMAIN"))
|
|
|
+ + ";批号:" + JsonUtils.optStringNotNull(messageObject, "BAR_BATCHCODE")
|
|
|
+ + ";料号:" + JsonUtils.optStringNotNull(messageObject, "BAR_PRODCODE")
|
|
|
+ + ";名称规格:" + messageObject.optString("PR_DETAIL")
|
|
|
+ + " " + JsonUtils.optStringNotNull(messageObject, "PR_SPEC")
|
|
|
+ + ";仓位:" + JsonUtils.optStringNotNull(messageObject, "BAR_LOCATION");
|
|
|
+
|
|
|
+ if (listArray != null && listArray.length() > 0) {
|
|
|
+ for (int i = 0; i < listArray.length(); i++) {
|
|
|
+ JSONObject listObject = listArray.optJSONObject(i);
|
|
|
+ barcodeResult = barcodeResult
|
|
|
+ + "\n单号:" + JsonUtils.optStringNotNull(listObject, "PI_INOUTNO")
|
|
|
+ + ";条码号:" + JsonUtils.optStringNotNull(listObject, "BAR_CODE")
|
|
|
+ + ";数量:" + CommonUtil.doubleFormat(JsonUtils.optDoubleNotNull(listObject, "BAR_REMAIN"));
|
|
|
+ }
|
|
|
+
|
|
|
+ //弹出拆分结果弹框
|
|
|
+ initBreakPopupWindow(listArray);
|
|
|
+ }
|
|
|
+
|
|
|
+ mCollectResultTextView.setText(barcodeResult);
|
|
|
+
|
|
|
+
|
|
|
+ mBarcodeTableLayout.setVisibility(View.GONE);
|
|
|
+ mBoxTableLayout.setVisibility(View.GONE);
|
|
|
+
|
|
|
+ tvBarcodeCollectionSuccess.setVisibility(View.VISIBLE);
|
|
|
+ tvBarcodeCollectionSuccess.setText("采集成功");
|
|
|
+
|
|
|
+ mResult1 = messageObject.optString("BAR_CODE");
|
|
|
+ mResult2 = messageObject.optDouble("BAR_REMAIN") + "";
|
|
|
+ mResult3 = messageObject.optString("BAR_PRODCODE");
|
|
|
+
|
|
|
+ mResults.add(mResult1);
|
|
|
+ mResults.add(mResult2);
|
|
|
+ mResults.add(mResult3);
|
|
|
+
|
|
|
+ mCollectBarcodeTv.setText(mResult1);
|
|
|
+ mCollectBarRemainTv.setText(mResult2);
|
|
|
+ mCollectBarProdcodeTv.setText(mResult3);
|
|
|
+
|
|
|
+ PdaApplication.putDataCache2Map(Constants.FLAG.MATERIAL_COLLECT_BARCODE_RESULT + pi_inoutno, mResults);
|
|
|
+ } else if (false) {
|
|
|
+ String boxResult = "采集成功;" + JsonUtils.optStringNotNull(dataObject, "finishno")
|
|
|
+ + "\n箱号:" + JsonUtils.optStringNotNull(messageObject, "BAR_OUTBOXCODE1")
|
|
|
+ + ";数量:" + CommonUtil.doubleFormat(messageObject.optDouble("BAR_REMAIN"))
|
|
|
+ + ";批号:" + JsonUtils.optStringNotNull(messageObject, "BAR_BATCHCODE")
|
|
|
+ + ";料号:" + JsonUtils.optStringNotNull(messageObject, "BAR_PRODCODE")
|
|
|
+ + ";名称规格:" + JsonUtils.optStringNotNull(messageObject, "PR_DETAIL")
|
|
|
+ + " " + JsonUtils.optStringNotNull(messageObject, "PR_SPEC");
|
|
|
+
|
|
|
+
|
|
|
+ if (listArray != null && listArray.length() > 0) {
|
|
|
+ for (int i = 0; i < listArray.length(); i++) {
|
|
|
+ JSONObject listObject = listArray.optJSONObject(i);
|
|
|
+ boxResult = boxResult
|
|
|
+ + "\n单号:" + JsonUtils.optStringNotNull(listObject, "PI_INOUTNO")
|
|
|
+ + ";条码号:" + JsonUtils.optStringNotNull(listObject, "BAR_CODE")
|
|
|
+ + ";数量:" + CommonUtil.doubleFormat(JsonUtils.optDoubleNotNull(listObject, "BAR_REMAIN"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ mCollectResultTextView.setText(boxResult);
|
|
|
+
|
|
|
+
|
|
|
+ mBarcodeTableLayout.setVisibility(View.GONE);
|
|
|
+ mBoxTableLayout.setVisibility(View.GONE);
|
|
|
+
|
|
|
+ tvBoxCollectionSuccess.setVisibility(View.VISIBLE);
|
|
|
+ tvBoxCollectionSuccess.setText("采集成功");
|
|
|
+
|
|
|
+ mResult1 = messageObject.optString("PA_OUTBOXCODE");
|
|
|
+ mResult2 = messageObject.optInt("PA_TOTALQTY") + "";
|
|
|
+ mResult3 = messageObject.optString("PA_PRODCODE");
|
|
|
+ mResult4 = messageObject.optString("PA_WHCODE");
|
|
|
+
|
|
|
+ mResults.add(mResult1);
|
|
|
+ mResults.add(mResult2);
|
|
|
+ mResults.add(mResult3);
|
|
|
+ mResults.add(mResult4);
|
|
|
+
|
|
|
+ mCollectBoxTv.setText(mResult1);
|
|
|
+ mCollectBoxNumTv.setText(mResult2);
|
|
|
+ mCollectBoxrProdcodeTv.setText(mResult3);
|
|
|
+ mCollectBoxWhcodeTv.setText(mResult4);
|
|
|
+
|
|
|
+ PdaApplication.putDataCache2Map(Constants.FLAG.MATERIAL_COLLECT_BOX_RESULT + pi_inoutno, mResults);
|
|
|
+ }
|
|
|
+ CommonUtil.toastNoRepeat(getActivity(), "采集成功");
|
|
|
+
|
|
|
+ Object next = jsonObject.getJSONObject("data").get("next");
|
|
|
+ if (next != null && !"null".equals(next.toString())) {
|
|
|
+ JSONObject nextObject = jsonObject.getJSONObject("data").getJSONObject("next");
|
|
|
+ MaterialInformationBean.DataBean materialInformationBean = JsonTools.parseJsonToBean(nextObject.toString(), MaterialInformationBean.DataBean.class);
|
|
|
+ if (materialInformationBean != null) {
|
|
|
+ String materialInfo =
|
|
|
+ "物料:" + (materialInformationBean.getPD_PRODCODE() == null ? "" : materialInformationBean.getPD_PRODCODE())
|
|
|
+ + "; 名称规格:" + (materialInformationBean.getPR_DETAIL() == null ? "" : materialInformationBean.getPR_DETAIL())
|
|
|
+ + " " + (materialInformationBean.getPR_SPEC() == null ? "" : materialInformationBean.getPR_SPEC())
|
|
|
+ + "; 未备料数:" + (materialInformationBean.getPD_RESTQTY() == null ? "" : materialInformationBean.getPD_RESTQTY())
|
|
|
+ + "; 批数量:" + (CommonUtil.doubleFormat(materialInformationBean.getBAR_REMAIN()))
|
|
|
+ + "; 仓位:" + (materialInformationBean.getBAR_LOCATION() == null ? "" : materialInformationBean.getBAR_LOCATION());
|
|
|
+ if (materialInformationBean.getPD_BATCHCODE() != null) {
|
|
|
+ materialInfo = materialInfo + "; 批号:" + materialInformationBean.getPD_BATCHCODE();
|
|
|
+ }
|
|
|
+ mMaterialInforTextView.setText(materialInfo);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ mMaterialInforTextView.setText("该出库单已经完成备料");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (JSONException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ if (getActivity() != null) {
|
|
|
+ try {
|
|
|
+ etBarCode.setText(null);
|
|
|
+ CommonUtil.editTextGetFocus(etBarCode);
|
|
|
+ CommonUtil.makeNotice();
|
|
|
+ CommonUtil.toastNoRepeat(getActivity(), failStr);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ /*RequestBody requestBody = new FormBody.Builder()
|
|
|
.add("ids", pi_id)
|
|
|
.add("barcode", currentBarcode)
|
|
|
.add("or_remain", mBarRemain)
|
|
|
@@ -1564,7 +1765,7 @@ public class IOCOutMakeMaterialOper extends BaseFragment implements View.OnClick
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
+*/
|
|
|
/*stringRequest = new StringRequest(Request.Method.POST, url,
|
|
|
new Response.Listener<String>() {
|
|
|
@Override
|
|
|
@@ -1975,7 +2176,7 @@ public class IOCOutMakeMaterialOper extends BaseFragment implements View.OnClick
|
|
|
} else {
|
|
|
if (mCollectModel == 1) {
|
|
|
if (CommonUtil.isNetWorkConnected(getActivity())) {
|
|
|
- barcodeEnterEvent(false);
|
|
|
+ barcodeEnterEvent(false, true);
|
|
|
} else {
|
|
|
CommonUtil.toastNoRepeat(getActivity(), getResources().getString(R.string.str_net_not_connect));
|
|
|
}
|