增加 出库

idata
wangh 1 year ago
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);
}
}

@ -25,9 +25,13 @@ public class HomePageActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
ActivityHomePageBinding binding= DataBindingUtil. setContentView(this,R.layout.activity_home_page);
List<HomeIcon> list = new ArrayList<>();
list.add(new HomeIcon(R.mipmap.home_in, "轮挡入库", InActivity.class));
list.add(new HomeIcon(R.mipmap.home_out, "轮挡领用出库", OutActivity.class));
list.add(new HomeIcon(R.mipmap.home_in1, "轮挡入库", InActivity.class));
list.add(new HomeIcon(R.mipmap.home_out1, "轮挡领用出库", OutActivity.class));
list.add(new HomeIcon(R.mipmap.home_store_check, "仓库盘点", OutActivity.class));
list.add(new HomeIcon(R.mipmap.home_check, "轮挡巡检", CheckActivity.class));
list.add(new HomeIcon(R.mipmap.home_check, "轮挡报废", CheckActivity.class));
list.add(new HomeIcon(R.mipmap.home_in, "废品入库", CheckActivity.class));
list.add(new HomeIcon(R.mipmap.home_out, "废品出库", CheckActivity.class));
/* try {
if (!loginUser.equals("admin")) {

@ -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();
}
}
});
}
}

@ -60,11 +60,11 @@ public class MyApplication extends Application {
builder.sslSocketFactory(sslParams1.sSLSocketFactory, sslParams1.trustManager);
builder.addInterceptor(loggingInterceptor);
// 全局的读取超时时间
builder.readTimeout(OkGo.DEFAULT_MILLISECONDS, TimeUnit.MILLISECONDS);
builder.readTimeout(3000, TimeUnit.MILLISECONDS);
// 全局的写入超时时间
builder.writeTimeout(OkGo.DEFAULT_MILLISECONDS, TimeUnit.MILLISECONDS);
builder.writeTimeout(3000, TimeUnit.MILLISECONDS);
// 全局的连接超时时间
builder.connectTimeout(OkGo.DEFAULT_MILLISECONDS, TimeUnit.MILLISECONDS);
builder.connectTimeout(3000, TimeUnit.MILLISECONDS);
// 使用内存保持cookieapp退出后cookie消失
builder.cookieJar(new CookieJarImpl(new MemoryCookieStore()));
OkGo.getInstance().init(this).setOkHttpClient(builder.build()) // 建议设置OkHttpClient不设置将使用默认的

@ -1,7 +1,13 @@
package com.example.beijing_daxing.vm;
import android.view.View;
import android.widget.AdapterView;
import androidx.databinding.BaseObservable;
import com.example.beijing_daxing.entity.BaseLocation;
import java.util.ArrayList;
import java.util.List;
/**
@ -16,6 +22,9 @@ public class OutStoreVm extends BaseObservable {
private List<String> areaList;
public void selectAreaCode(AdapterView<?> adapterView, View view,int p,long id){
this.areaCode=areaList.get(p);
}
public List<String> getEpcList() {
return epcList;
@ -53,7 +62,9 @@ public class OutStoreVm extends BaseObservable {
return areaList;
}
public void setAreaList(List<String> areaList) {
this.areaList = areaList;
public void setAreaList( List<BaseLocation> baseLocationList) {
areaList=new ArrayList<>();
baseLocationList.forEach(t->areaList.add(t.getLocationCode()));
notifyChange();
}
}

@ -27,7 +27,6 @@
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="300dp"
android:background="@color/white"
android:padding="10dp" />
@ -60,7 +59,6 @@
android:layout_width="110dp"
android:layout_height="match_parent"
android:background="@color/bg1"
android:text="选择原因:" />
<Spinner

@ -7,6 +7,9 @@
<variable
name="vm"
type="com.example.beijing_daxing.vm.OutStoreVm" />
<variable
name="adapter"
type="com.example.beijing_daxing.adapter.InAdapter" />
</data>
<LinearLayout
@ -27,7 +30,8 @@
android:layout_height="300dp"
android:layout_marginTop="10dp"
android:background="@color/white"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:adapter="@{adapter}"
android:padding="10dp" />
<LinearLayout
android:layout_width="match_parent"
@ -45,7 +49,9 @@
<Spinner
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAlignment="center"/>
android:textAlignment="center"
android:onItemSelected="@{vm.selectAreaCode}"
android:entries="@{vm.areaList}"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
@ -63,7 +69,11 @@
<EditText
style="@style/info_text1"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent"
android:maxLines="1"
android:singleLine="true"
android:imeOptions="actionDone"
android:text="@={vm.useUser}"/>
</LinearLayout>
<Button
@ -71,6 +81,7 @@
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="10dp"
android:onClick="out_submit"
android:text="提交" />
</LinearLayout>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 432 KiB

Loading…
Cancel
Save