|
|
|
@ -31,14 +31,15 @@ public class SemiActivity extends BaseActivity {
|
|
|
|
|
private List<Semi> list;
|
|
|
|
|
public ObservableField<String> locationCode;
|
|
|
|
|
public ObservableField<String> proCode;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
ActivitySemiBinding binding= DataBindingUtil.setContentView(this,R.layout.activity_semi);
|
|
|
|
|
adapter=new ItemSemiAdapter(this);
|
|
|
|
|
ActivitySemiBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_semi);
|
|
|
|
|
adapter = new ItemSemiAdapter(this);
|
|
|
|
|
binding.setAdapter(adapter);
|
|
|
|
|
locationCode=new ObservableField<>();
|
|
|
|
|
proCode=new ObservableField<>();
|
|
|
|
|
locationCode = new ObservableField<>();
|
|
|
|
|
proCode = new ObservableField<>();
|
|
|
|
|
binding.setVm(this);
|
|
|
|
|
binding.semiLocation.addTextChangedListener(new TextWatcher() {
|
|
|
|
|
@Override
|
|
|
|
@ -60,49 +61,53 @@ public class SemiActivity extends BaseActivity {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
initRequest();
|
|
|
|
|
initRequest();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void initRequest() {
|
|
|
|
|
OkGo.<MyResult>get(url + "/wms/mobile/getTransfers").tag(this)
|
|
|
|
|
.headers("Authorization", SharedPreferencesUtils.getstring("access_token", ""))
|
|
|
|
|
.execute(new MyRecultCall(dialog, this) {
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(Response<MyResult> response) {
|
|
|
|
|
super.onSuccess(response);
|
|
|
|
|
var body = response.body();
|
|
|
|
|
if (body.getTotal()==0) {
|
|
|
|
|
if (list != null) {
|
|
|
|
|
list.clear();
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(Response<MyResult> response) {
|
|
|
|
|
super.onSuccess(response);
|
|
|
|
|
var body = response.body();
|
|
|
|
|
if (body.getTotal() == 0) {
|
|
|
|
|
if (list != null) {
|
|
|
|
|
list.clear();
|
|
|
|
|
adapter.notifyDataSetChanged();
|
|
|
|
|
}
|
|
|
|
|
myToastUitls.show(body.getCode() == 200 ? "暂无记录" : body.getMsg());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
list = gson.fromJson(gson.toJson(body.getRows()), new TypeToken<List<Semi>>() {
|
|
|
|
|
}.getType());
|
|
|
|
|
adapter.setList(list);
|
|
|
|
|
adapter.notifyDataSetChanged();
|
|
|
|
|
}
|
|
|
|
|
myToastUitls.show( body.getCode() == 200 ? "暂无记录" : body.getMsg());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
list = gson.fromJson(gson.toJson(body.getRows()), new TypeToken<List<Semi>>() {}.getType());
|
|
|
|
|
adapter.setList(list);
|
|
|
|
|
adapter.notifyDataSetChanged();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public void submit(boolean b){
|
|
|
|
|
Map<String,String> map=new HashMap<>();
|
|
|
|
|
map.put("locationCode",locationCode.get());
|
|
|
|
|
map.put("materialBarcode",proCode.get());
|
|
|
|
|
OkGo.<MyResult>post(url+"/wms/mobile/"+(b?"transferOutstock":"transferInstock"))
|
|
|
|
|
|
|
|
|
|
public void submit(boolean b) {
|
|
|
|
|
Map<String, String> map = new HashMap<>();
|
|
|
|
|
map.put("locationCode", locationCode.get());
|
|
|
|
|
map.put("materialBarcode", proCode.get());
|
|
|
|
|
OkGo.<MyResult>post(url + "/wms/mobile/" + (b ? "transferOutstock" : "transferInstock"))
|
|
|
|
|
.headers("Authorization", SharedPreferencesUtils.getstring("access_token", ""))
|
|
|
|
|
.upRequestBody(RequestBody.create(JSON,gson.toJson(map)))
|
|
|
|
|
.execute(new MyRecultCall(dialog,this){
|
|
|
|
|
.upRequestBody(RequestBody.create(JSON, gson.toJson(map)))
|
|
|
|
|
.execute(new MyRecultCall(dialog, this) {
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(Response<MyResult> response) {
|
|
|
|
|
super.onSuccess(response);
|
|
|
|
|
var body = response.body();
|
|
|
|
|
if (body.getCode()==200){
|
|
|
|
|
initRequest();
|
|
|
|
|
if (body.getCode() == 200) {
|
|
|
|
|
locationCode.set(null);
|
|
|
|
|
proCode.set(null);
|
|
|
|
|
initRequest();
|
|
|
|
|
}
|
|
|
|
|
myToastUitls.show( body.getMsg());
|
|
|
|
|
myToastUitls.show(body.getMsg());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|