|
|
|
@ -1,22 +1,19 @@
|
|
|
|
|
package com.example.haiwei_mom.wms.raw;
|
|
|
|
|
|
|
|
|
|
import androidx.databinding.DataBindingUtil;
|
|
|
|
|
|
|
|
|
|
import android.annotation.SuppressLint;
|
|
|
|
|
import android.content.Context;
|
|
|
|
|
import android.content.Intent;
|
|
|
|
|
import android.os.Bundle;
|
|
|
|
|
import android.util.Log;
|
|
|
|
|
import android.view.MotionEvent;
|
|
|
|
|
import android.view.View;
|
|
|
|
|
import android.view.inputmethod.InputMethodManager;
|
|
|
|
|
import android.widget.EditText;
|
|
|
|
|
|
|
|
|
|
import androidx.databinding.DataBindingUtil;
|
|
|
|
|
|
|
|
|
|
import com.example.haiwei_mom.R;
|
|
|
|
|
import com.example.haiwei_mom.base.BaseActivity;
|
|
|
|
|
import com.example.haiwei_mom.base.MyRecultCall;
|
|
|
|
|
import com.example.haiwei_mom.base.MyResult;
|
|
|
|
|
import com.example.haiwei_mom.data.RawReturnVo;
|
|
|
|
|
import com.example.haiwei_mom.data.RawReturnSubmitBeen;
|
|
|
|
|
import com.example.haiwei_mom.data.RawReturnVo;
|
|
|
|
|
import com.example.haiwei_mom.databinding.ActivityRawReturnBinding;
|
|
|
|
|
import com.lzy.okgo.OkGo;
|
|
|
|
|
import com.lzy.okgo.model.Response;
|
|
|
|
@ -25,32 +22,28 @@ import java.math.BigDecimal;
|
|
|
|
|
|
|
|
|
|
import okhttp3.RequestBody;
|
|
|
|
|
|
|
|
|
|
public class RawReturnActivity extends BaseActivity implements View.OnFocusChangeListener {
|
|
|
|
|
private RawReturnVo params;
|
|
|
|
|
public class RawReturnActivity extends BaseActivity {
|
|
|
|
|
ActivityRawReturnBinding binding;
|
|
|
|
|
private RawReturnVo params;
|
|
|
|
|
private int type;
|
|
|
|
|
|
|
|
|
|
@SuppressLint("ClickableViewAccessibility")
|
|
|
|
|
@Override
|
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
|
|
|
|
|
binding = DataBindingUtil.setContentView(this, R.layout.activity_raw_return);
|
|
|
|
|
binding.rawReturnCode.setOnFocusChangeListener(this);
|
|
|
|
|
binding.rawReturnCode.setOnTouchListener((v, event) -> {
|
|
|
|
|
final int DRAWABLE_RIGHT = 2;
|
|
|
|
|
if (event.getAction() == MotionEvent.ACTION_UP) {
|
|
|
|
|
// 获取触摸的位置
|
|
|
|
|
int x = (int) event.getX();
|
|
|
|
|
// 获取图标的边界
|
|
|
|
|
int drawableRightWidth = binding.rawReturnCode.getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width();
|
|
|
|
|
int drawableRightStart = (int) (binding.rawReturnCode.getWidth() - binding.rawReturnCode.getPaddingRight() - drawableRightWidth);
|
|
|
|
|
// 判断是否点击了右侧图标
|
|
|
|
|
if (x >= drawableRightStart && x <= (binding.rawReturnCode.getWidth() - binding.rawReturnCode.getPaddingRight())) {
|
|
|
|
|
selectCode();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
Intent intent = getIntent();
|
|
|
|
|
String title = intent.getStringExtra("title");
|
|
|
|
|
binding.setTitle(title);
|
|
|
|
|
assert title != null;
|
|
|
|
|
if (title.equals("原材料退库")) {
|
|
|
|
|
type = 1;
|
|
|
|
|
} else if (title.equals("半成品退库")) {
|
|
|
|
|
type = 2;
|
|
|
|
|
}
|
|
|
|
|
binding.rawReturnCode.setOnEditorActionListener((v, actionId, event) -> {
|
|
|
|
|
selectCode();
|
|
|
|
|
return true;
|
|
|
|
|
});
|
|
|
|
|
params = new RawReturnVo();
|
|
|
|
|
binding.setVo(params);
|
|
|
|
@ -59,6 +52,7 @@ public class RawReturnActivity extends BaseActivity implements View.OnFocusChang
|
|
|
|
|
private void selectCode() {
|
|
|
|
|
OkGo.<MyResult>post(url + "/wms/pda/raw/returnSelectCode")
|
|
|
|
|
.params("code", params.getBatchCode())
|
|
|
|
|
.params("type", type)
|
|
|
|
|
.execute(new MyRecultCall(dialog, this) {
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(Response<MyResult> response) {
|
|
|
|
@ -113,31 +107,15 @@ public class RawReturnActivity extends BaseActivity implements View.OnFocusChang
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private EditText focusedView;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void getScannerData(String data) {
|
|
|
|
|
super.getScannerData(data);
|
|
|
|
|
Log.e("TAG", "getScannerData:" + data);
|
|
|
|
|
if (focusedView!=null){
|
|
|
|
|
EditText editText = focusedView;
|
|
|
|
|
// 将接收到的数据添加到 EditText 中
|
|
|
|
|
editText.append(data);
|
|
|
|
|
if (editText==binding.rawReturnCode){
|
|
|
|
|
selectCode();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
binding.rawReturnCode.setText(data);
|
|
|
|
|
|
|
|
|
|
selectCode();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onFocusChange(View v, boolean hasFocus) {
|
|
|
|
|
if (hasFocus) {
|
|
|
|
|
Log.e("TAG", "onFocusChange:" + v.getId());
|
|
|
|
|
focusedView = (EditText) v;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|