|
@@ -0,0 +1,153 @@
|
|
|
+package com.warewms.gizmo.ware_wms_gzlt.ui.activity;
|
|
|
+
|
|
|
+import android.content.Intent;
|
|
|
+import android.os.Bundle;
|
|
|
+import android.widget.Button;
|
|
|
+import android.widget.EditText;
|
|
|
+import android.widget.LinearLayout;
|
|
|
+
|
|
|
+import androidx.annotation.Nullable;
|
|
|
+
|
|
|
+import com.blankj.utilcode.util.ToastUtils;
|
|
|
+import com.warewms.gizmo.ware_wms_gzlt.R;
|
|
|
+import com.warewms.gizmo.ware_wms_gzlt.entity.BaseResponse;
|
|
|
+import com.warewms.gizmo.ware_wms_gzlt.entity.bean.BarcodeData;
|
|
|
+import com.warewms.gizmo.ware_wms_gzlt.entity.response.LocationModel;
|
|
|
+import com.warewms.gizmo.ware_wms_gzlt.event.Event;
|
|
|
+import com.warewms.gizmo.ware_wms_gzlt.network.Api;
|
|
|
+import com.warewms.gizmo.ware_wms_gzlt.network.BaseObserver;
|
|
|
+import com.warewms.gizmo.ware_wms_gzlt.network.RetrofitHelper;
|
|
|
+import com.warewms.gizmo.ware_wms_gzlt.network.RxUtil;
|
|
|
+import com.warewms.gizmo.ware_wms_gzlt.ui.base.BaseToolbarActivity;
|
|
|
+import com.warewms.gizmo.ware_wms_gzlt.util.BarcodeSingleton;
|
|
|
+
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+import butterknife.BindView;
|
|
|
+
|
|
|
+public class InventoryInActivity extends BaseToolbarActivity {
|
|
|
+
|
|
|
+ @BindView(R.id.et_transit_loc)
|
|
|
+ EditText etTransitLoc;
|
|
|
+ @BindView(R.id.btn_transit_loc)
|
|
|
+ Button btnTransitLoc;
|
|
|
+ @BindView(R.id.et_goods_code)
|
|
|
+ EditText etGoodsCode;
|
|
|
+ @BindView(R.id.layout_scroll_view)
|
|
|
+ LinearLayout layoutScrollView;
|
|
|
+ @BindView(R.id.btn_submit)
|
|
|
+ Button btnSubmit;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String getToolBarTitle() {
|
|
|
+ return "库存录入";
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int getEventCode() {
|
|
|
+ return BarcodeSingleton.EVENT_CODE_FIRST;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void onScanReceive(BarcodeData barcodeData, EditText editText) {
|
|
|
+
|
|
|
+ editText.setText(barcodeData.getData());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void onEventProcess(Event event) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected int getContentView() {
|
|
|
+ return R.layout.activity_inventory_in;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void initView() {
|
|
|
+
|
|
|
+ setGestureOnLayout(layoutScrollView);
|
|
|
+
|
|
|
+ etTransitLoc.requestFocus();
|
|
|
+
|
|
|
+ btnSubmit.setOnClickListener(v -> {
|
|
|
+
|
|
|
+ if (judgeCompleteness()) {
|
|
|
+
|
|
|
+ submit();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ btnTransitLoc.setOnClickListener(l -> {
|
|
|
+
|
|
|
+ Bundle bundle = new Bundle();
|
|
|
+ bundle.putString(LocationSelectionActivity.PARAM_KEY_SELECT_TYPE, "2");
|
|
|
+ sendIntentForResult(LocationSelectionActivity.class, LocationSelectionActivity.PARAM_RESULT_CODE_CHOSE, bundle);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void initData() {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 判断当前页面是否可提交
|
|
|
+ *
|
|
|
+ * @return 是否可提交
|
|
|
+ */
|
|
|
+ private boolean judgeCompleteness() {
|
|
|
+
|
|
|
+ if (etTransitLoc.length() == 0) {
|
|
|
+
|
|
|
+ ToastUtils.showShort("请输入库存货位");
|
|
|
+ etTransitLoc.requestFocus();
|
|
|
+ return false;
|
|
|
+ } else if (etGoodsCode.length() == 0) {
|
|
|
+
|
|
|
+ ToastUtils.showShort("请输入物料");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void submit() {
|
|
|
+
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("locationId", etTransitLoc.getText().toString());
|
|
|
+ map.put("material", etGoodsCode.getText().toString());
|
|
|
+ Map<String, Object> param = new HashMap<>();
|
|
|
+ param.put("details", map);
|
|
|
+
|
|
|
+ RetrofitHelper.create(Api.class)
|
|
|
+ .docAsnAdd(RetrofitHelper.appendCommonParam(param, this))
|
|
|
+ .compose(RxUtil.observableToMain())
|
|
|
+ .as(RxUtil.bindLifecycle(this))
|
|
|
+ .subscribe(new BaseObserver<Object>(getLoadingDialog()) {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onSuccess(BaseResponse<Object> response) {
|
|
|
+
|
|
|
+ ToastUtils.showShort(response.getMsg());
|
|
|
+ finish();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
|
|
+ super.onActivityResult(requestCode, resultCode, data);
|
|
|
+
|
|
|
+
|
|
|
+ if (resultCode == LocationSelectionActivity.PARAM_RESULT_CODE_CHOSE) {
|
|
|
+
|
|
|
+ LocationModel locationModel = data.getParcelableExtra(LocationListActivity.BLOCK_LOCATION_MODEL);
|
|
|
+ etTransitLoc.setText(locationModel.getLocationNo());
|
|
|
+ etGoodsCode.requestFocus();
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|