|
|
@@ -0,0 +1,232 @@
|
|
|
+package com.uas.keg_wms_new.fragment;
|
|
|
+
|
|
|
+import android.text.TextUtils;
|
|
|
+import android.view.KeyEvent;
|
|
|
+import android.view.View;
|
|
|
+import android.widget.Button;
|
|
|
+import android.widget.LinearLayout;
|
|
|
+import android.widget.TextView;
|
|
|
+
|
|
|
+import com.android.volley.Request;
|
|
|
+import com.uas.keg_wms_new.R;
|
|
|
+import com.uas.keg_wms_new.activity.FunctionActivity;
|
|
|
+import com.uas.keg_wms_new.global.GloableParams;
|
|
|
+import com.uas.keg_wms_new.listener.MyEditorActionListener;
|
|
|
+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;
|
|
|
+
|
|
|
+public
|
|
|
+ /**
|
|
|
+ * Created by sw on 2024-12-19
|
|
|
+ */
|
|
|
+class LightEmptyStorageSpaceFragment extends BaseFragment{
|
|
|
+
|
|
|
+
|
|
|
+ private ClearableEditText cet_material_rack;
|
|
|
+ private Button bt_light_empty_storage_space,bt_extinguish_empty_storage_space;
|
|
|
+ private TextView tv_result;
|
|
|
+ private LinearLayout ll_result;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected int getLayout() {
|
|
|
+ return R.layout.fragment_light_empty_storage_space;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void initViews() {
|
|
|
+ FunctionActivity.setTitle(getResources().getString(R.string.light_empty_storage_space));
|
|
|
+
|
|
|
+ cet_material_rack = root.findViewById(R.id.cet_material_rack);
|
|
|
+ bt_light_empty_storage_space = root.findViewById(R.id.bt_light_empty_storage_space);
|
|
|
+ bt_extinguish_empty_storage_space = root.findViewById(R.id.bt_extinguish_empty_storage_space);
|
|
|
+ tv_result = root.findViewById(R.id.tv_result);
|
|
|
+ ll_result = root.findViewById(R.id.ll_result);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void initEvents() {
|
|
|
+ //料架回车
|
|
|
+ CommonUtil.setEditorActionListener(cet_material_rack, new MyEditorActionListener() {
|
|
|
+ @Override
|
|
|
+ public void MyEditorAction(String text, int actionId, KeyEvent event) {
|
|
|
+ if (!text.isEmpty()&&!cet_material_rack.getText().toString().isEmpty()){
|
|
|
+ materialRackCode();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ bt_light_empty_storage_space.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ getlightEmptyStorage(cet_material_rack.getText().toString().trim());
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ bt_extinguish_empty_storage_space.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ getExtinguishEmptyStorageSpace(cet_material_rack.getText().toString().trim());
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void getExtinguishEmptyStorageSpace(String shcode) {
|
|
|
+ String materialRack = cet_material_rack.getText().toString().trim();
|
|
|
+ if (TextUtils.isEmpty(materialRack)) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, getResources().getString(R.string.Please_enter_the_material_rack));
|
|
|
+ cet_material_rack.requestFocus();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ progressDialog.show();
|
|
|
+ VolleyRequest.getInstance().stringRequest60(new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_SHELF_LIGHT_ON_EMPTY_LOCATION)
|
|
|
+ .method(Request.Method.GET)
|
|
|
+ .addParam("shcode",shcode)
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ org.json.JSONObject resultObject = new org.json.JSONObject(o.toString());
|
|
|
+ ll_result.setVisibility(View.VISIBLE);
|
|
|
+ if (resultObject.optBoolean("success")) {
|
|
|
+ tv_result.setTextColor(getResources().getColor(R.color.blue));
|
|
|
+ tv_result.setText(resultObject.getString("data"));
|
|
|
+ cet_material_rack.setText("");
|
|
|
+ }else {
|
|
|
+ tv_result.setTextColor(getResources().getColor(R.color.red));
|
|
|
+ tv_result.setText(resultObject.getString("message"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ cet_material_rack.setText(null);
|
|
|
+ cet_material_rack.requestFocus();
|
|
|
+ ll_result.setVisibility(View.VISIBLE);
|
|
|
+ tv_result.setTextColor(getResources().getColor(R.color.red));
|
|
|
+ tv_result.setText(failStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void getlightEmptyStorage(String shcode) {
|
|
|
+ String materialRack = cet_material_rack.getText().toString().trim();
|
|
|
+ if (TextUtils.isEmpty(materialRack)) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, getResources().getString(R.string.Please_enter_the_material_rack));
|
|
|
+ cet_material_rack.requestFocus();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ progressDialog.show();
|
|
|
+ VolleyRequest.getInstance().stringRequest60(new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_SHELF_LIGHT_ON_EMPTY_LOCATION)
|
|
|
+ .method(Request.Method.GET)
|
|
|
+ .addParam("shcode",shcode)
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ org.json.JSONObject resultObject = new org.json.JSONObject(o.toString());
|
|
|
+ ll_result.setVisibility(View.VISIBLE);
|
|
|
+ if (resultObject.optBoolean("success")) {
|
|
|
+ tv_result.setTextColor(getResources().getColor(R.color.blue));
|
|
|
+ tv_result.setText(resultObject.getString("data"));
|
|
|
+ cet_material_rack.setText("");
|
|
|
+ }else {
|
|
|
+ tv_result.setTextColor(getResources().getColor(R.color.red));
|
|
|
+ tv_result.setText(resultObject.getString("message"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ cet_material_rack.setText(null);
|
|
|
+ cet_material_rack.requestFocus();
|
|
|
+ ll_result.setVisibility(View.VISIBLE);
|
|
|
+ tv_result.setTextColor(getResources().getColor(R.color.red));
|
|
|
+ tv_result.setText(failStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void materialRackCode() {
|
|
|
+ String materialRack = cet_material_rack.getText().toString().trim();
|
|
|
+ if (TextUtils.isEmpty(materialRack)) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, getResources().getString(R.string.Please_enter_the_material_rack));
|
|
|
+ cet_material_rack.requestFocus();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ progressDialog.show();
|
|
|
+ VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_GET_SHELF)
|
|
|
+ .method(Request.Method.GET)
|
|
|
+ .addParam("shcode",materialRack)
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ org.json.JSONObject resultObject = new org.json.JSONObject(o.toString());
|
|
|
+ ll_result.setVisibility(View.VISIBLE);
|
|
|
+ if (resultObject.optBoolean("success")) {
|
|
|
+ tv_result.setTextColor(getResources().getColor(R.color.blue));
|
|
|
+ tv_result.setText(getResources().getText(R.string.Shelf_validation_successful));
|
|
|
+ cet_material_rack.setText("");
|
|
|
+ }else {
|
|
|
+ tv_result.setTextColor(getResources().getColor(R.color.red));
|
|
|
+ tv_result.setText(resultObject.getString("message"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ cet_material_rack.setText(null);
|
|
|
+ cet_material_rack.requestFocus();
|
|
|
+ ll_result.setVisibility(View.VISIBLE);
|
|
|
+ tv_result.setTextColor(getResources().getColor(R.color.red));
|
|
|
+ tv_result.setText(failStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void initDatas() {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @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);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|