增加 出库
parent
deb54169e6
commit
38ee648bb1
@ -1,14 +1,17 @@
|
||||
package com.example.beijing_daxing;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.example.beijing_daxing.databinding.ActivityCheckBinding;
|
||||
|
||||
public class CheckActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_check);
|
||||
ActivityCheckBinding binding= DataBindingUtil.setContentView(this,R.layout.activity_check);
|
||||
}
|
||||
}
|
@ -1,14 +1,89 @@
|
||||
package com.example.beijing_daxing;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
import com.example.beijing_daxing.adapter.InAdapter;
|
||||
import com.example.beijing_daxing.base.AdapterClickCall;
|
||||
import com.example.beijing_daxing.base.BaseActivity;
|
||||
import com.example.beijing_daxing.base.MyRecultCall;
|
||||
import com.example.beijing_daxing.base.MyResult;
|
||||
import com.example.beijing_daxing.been.InStoreSelectBody;
|
||||
import com.example.beijing_daxing.databinding.ActivityOutBinding;
|
||||
import com.example.beijing_daxing.entity.BaseLocation;
|
||||
import com.example.beijing_daxing.uitls.SharedPreferencesUtils;
|
||||
import com.example.beijing_daxing.vm.OutStoreVm;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.model.Response;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
public class OutActivity extends AppCompatActivity {
|
||||
|
||||
public class OutActivity extends BaseActivity implements AdapterClickCall {
|
||||
private InAdapter adapter;
|
||||
private OutStoreVm outVm;
|
||||
private List<String> epcList;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_out);
|
||||
ActivityOutBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_out);
|
||||
adapter=new InAdapter(this);
|
||||
epcList=new ArrayList<>();
|
||||
adapter.setList(epcList);
|
||||
adapter.setAdapterClickCall(this);
|
||||
binding.setAdapter(adapter);
|
||||
outVm=new OutStoreVm();
|
||||
binding.setVm(outVm);
|
||||
initRequest();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void sanRfid(List<String> epcs) {
|
||||
epcs.stream().forEach(t -> {
|
||||
if (!epcList.contains(t)) {
|
||||
epcList.add(t);
|
||||
}
|
||||
});
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clickItem(int index) {
|
||||
epcList.remove(index);
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
private void initRequest() {
|
||||
OkGo.<MyResult>post(url + "/outStore/select").tag(this).execute(new MyRecultCall(dialog, this) {
|
||||
@Override
|
||||
public void onSuccess(Response<MyResult> response) {
|
||||
super.onSuccess(response);
|
||||
List<BaseLocation> baseLocationList=gson.fromJson(response.body().getData().toString(), new TypeToken<List<BaseLocation>>(){}.getType());
|
||||
outVm.setAreaList(baseLocationList);
|
||||
}
|
||||
});
|
||||
}
|
||||
public void out_submit(View view) {
|
||||
String useUser = outVm.getUseUser();
|
||||
if (useUser == null || epcList.isEmpty()) return;
|
||||
outVm.setEpcList(epcList);
|
||||
outVm.setSubmitUser(SharedPreferencesUtils.getstring("user","test"));
|
||||
OkGo.<MyResult>post(url + "/outStore/submit")
|
||||
.upRequestBody(RequestBody.create(JSON, gson.toJson(outVm)))
|
||||
.execute(new MyRecultCall(dialog,this){
|
||||
@Override
|
||||
public void onSuccess(Response<MyResult> response) {
|
||||
super.onSuccess(response);
|
||||
if (response.body().getCode()==0){
|
||||
Toast.makeText(OutActivity.this, "提交成功", Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
}else {
|
||||
Toast.makeText(OutActivity.this, response.body().getMsg(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 432 KiB |
Loading…
Reference in New Issue