|
|
|
@ -3,6 +3,9 @@ package com.example.jingyuan_mes.store;
|
|
|
|
|
import androidx.databinding.DataBindingUtil;
|
|
|
|
|
|
|
|
|
|
import android.os.Bundle;
|
|
|
|
|
import android.text.Editable;
|
|
|
|
|
import android.text.TextWatcher;
|
|
|
|
|
import android.util.Log;
|
|
|
|
|
import android.view.View;
|
|
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
|
|
|
@ -20,42 +23,62 @@ import okhttp3.RequestBody;
|
|
|
|
|
|
|
|
|
|
public class MaterialInActivity extends BaseActivity {
|
|
|
|
|
private MaterialInVm vm;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
ActivityMaterialInBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_material_in);
|
|
|
|
|
binding.setTitle("原材料入库");
|
|
|
|
|
vm=new MaterialInVm();
|
|
|
|
|
vm.setInstockAmount(1);
|
|
|
|
|
vm = new MaterialInVm();
|
|
|
|
|
vm.setInstockAmount("1");
|
|
|
|
|
binding.setVm(vm);
|
|
|
|
|
binding.materialInGoods.addTextChangedListener(new TextWatcher() {
|
|
|
|
|
@Override
|
|
|
|
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
|
|
|
Log.e("TAG", "start:" + start + "before:" + before + "count:" + count);
|
|
|
|
|
|
|
|
|
|
if (start == 0 && count > 10) {
|
|
|
|
|
binding.materialInGoods.clearFocus();
|
|
|
|
|
binding.materialInLocation.requestFocus();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void afterTextChanged(Editable s) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void sanCodeCall(String code) {
|
|
|
|
|
var materialBarcode = vm.getMaterialBarcode();
|
|
|
|
|
if (materialBarcode ==null|| materialBarcode.isEmpty()){
|
|
|
|
|
vm.setMaterialBarcode(code);
|
|
|
|
|
}else {
|
|
|
|
|
vm.setLocationCode(code);
|
|
|
|
|
}
|
|
|
|
|
if (materialBarcode == null || materialBarcode.isEmpty()) {
|
|
|
|
|
vm.setMaterialBarcode(code);
|
|
|
|
|
} else {
|
|
|
|
|
vm.setLocationCode(code);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void material_in_submit(View view){
|
|
|
|
|
OkGo.<MyResult>post(url+"/wms/mobile/addRawInstock")
|
|
|
|
|
.headers("Authorization", SharedPreferencesUtils.getstring("access_token", ""))
|
|
|
|
|
.upRequestBody(RequestBody.create(JSON,gson.toJson(vm)))
|
|
|
|
|
.execute(new MyRecultCall(dialog,this){
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(Response<MyResult> response) {
|
|
|
|
|
super.onSuccess(response);
|
|
|
|
|
var body = response.body();
|
|
|
|
|
if (body.getCode()==200){
|
|
|
|
|
finish();
|
|
|
|
|
}
|
|
|
|
|
Toast.makeText(MaterialInActivity.this, body.getMsg(), Toast.LENGTH_SHORT).show();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
public void material_in_submit(View view) {
|
|
|
|
|
OkGo.<MyResult>post(url + "/wms/mobile/addRawInstock").headers("Authorization", SharedPreferencesUtils.getstring("access_token", "")).upRequestBody(RequestBody.create(JSON, gson.toJson(vm))).execute(new MyRecultCall(dialog, this) {
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(Response<MyResult> response) {
|
|
|
|
|
super.onSuccess(response);
|
|
|
|
|
var body = response.body();
|
|
|
|
|
if (body.getCode() == 200) {
|
|
|
|
|
finish();
|
|
|
|
|
}
|
|
|
|
|
Toast.makeText(MaterialInActivity.this, body.getMsg(), Toast.LENGTH_SHORT).show();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|