|
|
@ -15,6 +15,7 @@ import com.example.duken_mes.base.MyRecultCall;
|
|
|
|
import com.example.duken_mes.base.MyResult;
|
|
|
|
import com.example.duken_mes.base.MyResult;
|
|
|
|
import com.example.duken_mes.databinding.ActivityMainBinding;
|
|
|
|
import com.example.duken_mes.databinding.ActivityMainBinding;
|
|
|
|
import com.example.duken_mes.entity.IngredientInfo;
|
|
|
|
import com.example.duken_mes.entity.IngredientInfo;
|
|
|
|
|
|
|
|
import com.example.duken_mes.entity.Material;
|
|
|
|
import com.example.duken_mes.vm.MainVm;
|
|
|
|
import com.example.duken_mes.vm.MainVm;
|
|
|
|
import com.lzy.okgo.OkGo;
|
|
|
|
import com.lzy.okgo.OkGo;
|
|
|
|
import com.lzy.okgo.model.Response;
|
|
|
|
import com.lzy.okgo.model.Response;
|
|
|
@ -30,13 +31,12 @@ public class MainActivity extends BaseActivity {
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
ActivityMainBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
|
|
|
|
ActivityMainBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
|
|
|
|
mainVm = new MainVm();
|
|
|
|
mainVm = new MainVm();
|
|
|
|
mainVm.setGoodsCode("物料编码");
|
|
|
|
var type = getIntent().getBooleanExtra("type", false);
|
|
|
|
mainVm.setGoodsName("物料名称");
|
|
|
|
mainVm.setType(type);
|
|
|
|
mainVm.setGoodsNumber("100");
|
|
|
|
|
|
|
|
mainVm.setType(getIntent().getBooleanExtra("type", false));
|
|
|
|
|
|
|
|
binding.setVm(mainVm);
|
|
|
|
binding.setVm(mainVm);
|
|
|
|
binding.trayCodeid.setOnEditorActionListener((v, actionId, event) -> {
|
|
|
|
binding.trayCodeid.setOnEditorActionListener((v, actionId, event) -> {
|
|
|
|
mainVm.setGoodsVis(true);
|
|
|
|
selectGoods();
|
|
|
|
|
|
|
|
|
|
|
|
/*if (actionId == EditorInfo.IME_ACTION_DONE) {
|
|
|
|
/*if (actionId == EditorInfo.IME_ACTION_DONE) {
|
|
|
|
InputMethodManager imm = (InputMethodManager)v.getContext()
|
|
|
|
InputMethodManager imm = (InputMethodManager)v.getContext()
|
|
|
|
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
|
|
|
.getSystemService(Context.INPUT_METHOD_SERVICE);
|
|
|
@ -75,7 +75,7 @@ public class MainActivity extends BaseActivity {
|
|
|
|
mainVm.setTankCode(code);
|
|
|
|
mainVm.setTankCode(code);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
mainVm.setTrayCode(code);
|
|
|
|
mainVm.setTrayCode(code);
|
|
|
|
mainVm.setGoodsVis(true);
|
|
|
|
selectGoods();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -117,7 +117,8 @@ public class MainActivity extends BaseActivity {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
alertDialog.show();
|
|
|
|
alertDialog.show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private void submitRequest(){
|
|
|
|
|
|
|
|
|
|
|
|
private void submitRequest() {
|
|
|
|
var type = mainVm.isType();
|
|
|
|
var type = mainVm.isType();
|
|
|
|
Log.e("TAG", "submitRequest:" + type);
|
|
|
|
Log.e("TAG", "submitRequest:" + type);
|
|
|
|
if (type) {
|
|
|
|
if (type) {
|
|
|
@ -133,7 +134,7 @@ public class MainActivity extends BaseActivity {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
OkGo.<MyResult>post(url + "/api/IngCheck/" + (type ?"SmallMaterial": "BigMaterial" ))
|
|
|
|
OkGo.<MyResult>post(url + "/api/IngCheck/" + (type ? "SmallMaterial" : "BigMaterial"))
|
|
|
|
.tag(this)
|
|
|
|
.tag(this)
|
|
|
|
.upRequestBody(RequestBody.create(JSON, gson.toJson(ingredientInfo)))
|
|
|
|
.upRequestBody(RequestBody.create(JSON, gson.toJson(ingredientInfo)))
|
|
|
|
.execute(new MyRecultCall(dialog, this) {
|
|
|
|
.execute(new MyRecultCall(dialog, this) {
|
|
|
@ -154,4 +155,29 @@ public class MainActivity extends BaseActivity {
|
|
|
|
public void backAc(View view) {
|
|
|
|
public void backAc(View view) {
|
|
|
|
finish();
|
|
|
|
finish();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void selectGoods(){
|
|
|
|
|
|
|
|
OkGo.<MyResult>get(url + "/api/IngCheck/GetMcsMaterialInfo/" + mainVm.getTrayCode())
|
|
|
|
|
|
|
|
.tag(this)
|
|
|
|
|
|
|
|
.execute(new MyRecultCall(dialog, this) {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onSuccess(Response<MyResult> response) {
|
|
|
|
|
|
|
|
super.onSuccess(response);
|
|
|
|
|
|
|
|
var body = response.body();
|
|
|
|
|
|
|
|
if (body.getStatusCode()==200){
|
|
|
|
|
|
|
|
if (mainVm.isType()){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
// 大料
|
|
|
|
|
|
|
|
var material=gson.fromJson(body.getMessage(), Material.class);
|
|
|
|
|
|
|
|
mainVm.setGoodsCode(material.getMatCode());
|
|
|
|
|
|
|
|
mainVm.setGoodsName(material.getMatName());
|
|
|
|
|
|
|
|
mainVm.setGoodsNumber(material.getMatType());
|
|
|
|
|
|
|
|
mainVm.setGoodsVis(true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
Toast.makeText(MainActivity.this, body.getMessage(), Toast.LENGTH_SHORT).show();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|