|
|
@@ -43,7 +43,7 @@ import java.util.List;
|
|
|
public class SpecialOutNewFragment extends BaseFragment implements CommonSelectPop.OnDataSelectListener {
|
|
|
private static final int SCAN_BARCODE_CODE = 333;
|
|
|
|
|
|
- private TextView mNumTv, mTitleTv, mLocationEt, mResultTv;
|
|
|
+ private TextView mNumTv, mTitleTv, mLocationEt, mResultTv, mNextTv;
|
|
|
private ClearableEditText mBarcodeEt, mDcEt, mReasonEt;
|
|
|
private ImageView mScanIv;
|
|
|
private LinearLayout mLocationLl;
|
|
|
@@ -75,6 +75,7 @@ public class SpecialOutNewFragment extends BaseFragment implements CommonSelectP
|
|
|
mLocationEt = (TextView) root.findViewById(R.id.special_out_new_location_et);
|
|
|
mConfirmBtn = root.findViewById(R.id.special_out_new_confirm_btn);
|
|
|
mResultTv = (TextView) root.findViewById(R.id.special_out_new_result_tv);
|
|
|
+ mNextTv = (TextView) root.findViewById(R.id.special_out_new_next_material_tv);
|
|
|
mReasonEt = root.findViewById(R.id.special_out_new_reason_et);
|
|
|
|
|
|
mSelectPop = new CommonSelectPop(mActivity);
|
|
|
@@ -141,8 +142,83 @@ public class SpecialOutNewFragment extends BaseFragment implements CommonSelectP
|
|
|
|
|
|
String dcCheck = SharedPreUtil.getString(mActivity, Constants.CONSTANT.STORAGE_OUT_DC, "");
|
|
|
mDcEt.setText(dcCheck);
|
|
|
+
|
|
|
+ if (CommonUtil.isNetWorkConnected(mActivity)) {
|
|
|
+ getNextMaterialInfo();
|
|
|
+ } else {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, getString(R.string.net_not_connect));
|
|
|
+ mNextTv.setText(getString(R.string.net_not_connect));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取下一采集货品信息
|
|
|
+ */
|
|
|
+ private void getNextMaterialInfo() {
|
|
|
+ progressDialog.show();
|
|
|
+ String url = GloableParams.ADDRESS_PDAIO_OUT_GETNEXTDATA + "?pi_id=" + pi_id;
|
|
|
+
|
|
|
+ VollyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
+ .url(url)
|
|
|
+ .method(Request.Method.GET)
|
|
|
+ .tag(TAG + "getnext")
|
|
|
+ .flag(0)
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ try {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ String result = o.toString();
|
|
|
+ com.alibaba.fastjson.JSONObject resultObject = JSON.parseObject(result);
|
|
|
+ com.alibaba.fastjson.JSONObject dataObject = resultObject.getJSONObject("data");
|
|
|
+ if (dataObject != null) {
|
|
|
+ com.alibaba.fastjson.JSONArray locationArray = dataObject.getJSONArray("BAR_LOCATION");
|
|
|
+ String locationStr = "";
|
|
|
+ if (locationArray != null && locationArray.size() > 0) {
|
|
|
+ for (int i = 0; i < locationArray.size(); i++) {
|
|
|
+ com.alibaba.fastjson.JSONObject locationObject = locationArray.getJSONObject(i);
|
|
|
+ if (locationObject != null) {
|
|
|
+ locationStr += FastjsonUtil.getText(locationObject, "DATA");
|
|
|
+ if (i < locationArray.size() - 1) {
|
|
|
+ locationStr += "\n\u3000\u3000\u3000";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String materialInfo =
|
|
|
+ "下一采集货品\n物料:" + FastjsonUtil.getText(dataObject, "PD_PRODCODE")
|
|
|
+ + "; \n数量:" + FastjsonUtil.getText(dataObject, "NEEDREADY")
|
|
|
+ + "; \n序号:" + FastjsonUtil.getText(dataObject, "PD_PDNO")
|
|
|
+ + "; \n品牌:" + FastjsonUtil.getText(dataObject, "PD_BRAND")
|
|
|
+ + "; \n仓库:" + FastjsonUtil.getText(dataObject, "PD_WHCODE")
|
|
|
+ + "; \n库位:" + locationStr
|
|
|
+// + "; \nDC:" + FastjsonUtil.getText(dataObject, "BAR_DATECODE")
|
|
|
+ ;
|
|
|
+ if (mNextTv != null) {
|
|
|
+ mNextTv.setText(materialInfo);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (mNextTv != null) {
|
|
|
+ mNextTv.setText("该出库单已经完成备料");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ if (mNextTv != null) {
|
|
|
+ mNextTv.setText(failStr);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
+
|
|
|
private void barcodeEnterEvent(boolean force) {
|
|
|
String barcode = mBarcodeEt.getText().toString().trim();
|
|
|
if (TextUtils.isEmpty(barcode)) {
|
|
|
@@ -231,6 +307,38 @@ public class SpecialOutNewFragment extends BaseFragment implements CommonSelectP
|
|
|
mResultTv.setVisibility(View.VISIBLE);
|
|
|
|
|
|
CommonUtil.toastNoRepeat(getActivity(), "采集成功");
|
|
|
+
|
|
|
+ Object next = dataObject.get("next");
|
|
|
+ if (next != null && !"null".equals(next.toString())) {
|
|
|
+ com.alibaba.fastjson.JSONObject nextObject = dataObject.getJSONObject("next");
|
|
|
+ if (nextObject != null) {
|
|
|
+ com.alibaba.fastjson.JSONArray locationArray = nextObject.getJSONArray("BAR_LOCATION");
|
|
|
+ String locationStr = "";
|
|
|
+ if (locationArray != null && locationArray.size() > 0) {
|
|
|
+ for (int i = 0; i < locationArray.size(); i++) {
|
|
|
+ com.alibaba.fastjson.JSONObject locationObject = locationArray.getJSONObject(i);
|
|
|
+ if (locationObject != null) {
|
|
|
+ locationStr += FastjsonUtil.getText(locationObject, "DATA");
|
|
|
+ if (i < locationArray.size() - 1) {
|
|
|
+ locationStr += "\n\u3000\u3000\u3000";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String materialInfo =
|
|
|
+ "下一采集货品\n物料:" + FastjsonUtil.getText(nextObject, "PD_PRODCODE")
|
|
|
+ + "; \n数量:" + FastjsonUtil.getText(nextObject, "NEEDREADY")
|
|
|
+ + "; \n序号:" + FastjsonUtil.getText(nextObject, "PD_PDNO")
|
|
|
+ + "; \n品牌:" + FastjsonUtil.getText(nextObject, "PD_BRAND")
|
|
|
+ + "; \n仓库:" + FastjsonUtil.getText(nextObject, "PD_WHCODE")
|
|
|
+ + "; \n库位:" + locationStr
|
|
|
+// + "; \nDC:" + FastjsonUtil.getText(nextObject, "BAR_DATECODE")
|
|
|
+ ;
|
|
|
+ mNextTv.setText(materialInfo);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ mNextTv.setText("该出库单已经完成备料");
|
|
|
+ }
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|