Commit c112a7f3 authored by hywang's avatar hywang

1.限制盘点页面的输入框软键盘弹出;

2.低频标签位数限制为15位;
3.修复同步数据报错一直请问的bug;
4.增加上传页面的未上传数量。
parent c1b40bdf
...@@ -8,8 +8,8 @@ android { ...@@ -8,8 +8,8 @@ android {
applicationId "com.phlx.wool" applicationId "com.phlx.wool"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 29 targetSdkVersion 29
versionCode 14 versionCode 18
versionName "1.1.4" versionName "1.1.8"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }
......
...@@ -17,18 +17,18 @@ ...@@ -17,18 +17,18 @@
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION " /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION " />
<application <application
android:name="App" android:name="App"
android:allowBackup="true" android:allowBackup="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:requestLegacyExternalStorage="true"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme" android:theme="@style/AppTheme">
android:requestLegacyExternalStorage="true" <activity
android:networkSecurityConfig="@xml/network_security_config"> android:name=".ui.login.LoginActivity"
<activity android:name=".ui.login.LoginActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize"> android:windowSoftInputMode="stateHidden|adjustResize">
...@@ -38,59 +38,73 @@ ...@@ -38,59 +38,73 @@
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".ui.main.MainActivity" <activity
android:name=".ui.main.MainActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:launchMode="singleTask"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize"/> android:windowSoftInputMode="stateHidden|adjustResize" />
<activity android:name=".ui.work.mark.MarkingActivity" <activity
android:name=".ui.work.mark.MarkingActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize"/> android:windowSoftInputMode="stateHidden|adjustResize" />
<activity android:name=".ui.work.harmless.HarmlessActivity" <activity
android:name=".ui.work.harmless.HarmlessActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize"/> android:windowSoftInputMode="stateHidden|adjustResize" />
<activity android:name=".ui.work.quarantine.QuarantineActivity" <activity
android:name=".ui.work.quarantine.QuarantineActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize"/> android:windowSoftInputMode="stateHidden|adjustResize" />
<activity android:name=".ui.inventory.InventoryActivity" <activity
android:name=".ui.inventory.InventoryActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize"/> android:windowSoftInputMode="stateHidden|adjustResize" />
<activity android:name=".ui.setting.SettingActivity" <activity
android:name=".ui.setting.SettingActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize"/> android:windowSoftInputMode="stateHidden|adjustResize" />
<activity android:name=".ui.work.unit.UnitActivity" <activity
android:name=".ui.work.unit.UnitActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize"/> android:windowSoftInputMode="stateHidden|adjustResize" />
<activity android:name=".ui.sync.activity.ClearActivity" <activity
android:name=".ui.sync.activity.ClearActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize"/> android:windowSoftInputMode="stateHidden|adjustResize" />
<activity android:name=".ui.sync.activity.UploadActivity" <activity
android:name=".ui.sync.activity.UploadActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize"/> android:windowSoftInputMode="stateHidden|adjustResize" />
<activity android:name=".ui.sync.activity.DownloadActivity" <activity
android:name=".ui.sync.activity.DownloadActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize"/> android:windowSoftInputMode="stateHidden|adjustResize" />
<activity android:name=".ui.splash.SplashActivity" <activity
android:name=".ui.splash.SplashActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize"/> android:windowSoftInputMode="stateHidden|adjustResize" />
<activity android:name=".ui.villus.VillusBuyActivity" <activity
android:name=".ui.villus.VillusBuyActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize"/> android:windowSoftInputMode="stateHidden|adjustResize" />
<activity android:name=".ui.villus.VillusGaugeActivity" <activity
android:name=".ui.villus.VillusGaugeActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize"/> android:windowSoftInputMode="stateHidden|adjustResize" />
<activity android:name=".ui.villus.BluetoothDeviceList"/> <activity android:name=".ui.villus.BluetoothDeviceList" />
</application> </application>
</manifest> </manifest>
\ No newline at end of file
...@@ -3,7 +3,15 @@ package com.phlx.wool.ui.inventory; ...@@ -3,7 +3,15 @@ package com.phlx.wool.ui.inventory;
import android.os.Bundle; import android.os.Bundle;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.text.method.BaseKeyListener;
import android.text.method.DigitsKeyListener;
import android.text.method.KeyListener;
import android.text.method.TextKeyListener;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View; import android.view.View;
import android.view.inputmethod.InputConnection;
import android.widget.EditText;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.lifecycle.Observer; import androidx.lifecycle.Observer;
...@@ -22,6 +30,8 @@ import com.phlx.wool.rfid.ModuleManager; ...@@ -22,6 +30,8 @@ import com.phlx.wool.rfid.ModuleManager;
import com.phlx.wool.ui.base.BaseActivity; import com.phlx.wool.ui.base.BaseActivity;
import com.uhf.structures.InventoryParams; import com.uhf.structures.InventoryParams;
import java.lang.reflect.Method;
import me.tatarka.bindingcollectionadapter2.BindingRecyclerViewAdapter; import me.tatarka.bindingcollectionadapter2.BindingRecyclerViewAdapter;
/** /**
...@@ -40,6 +50,8 @@ public class InventoryActivity extends BaseActivity<ActivityInventoryBinding, In ...@@ -40,6 +50,8 @@ public class InventoryActivity extends BaseActivity<ActivityInventoryBinding, In
private String labelStr = ""; private String labelStr = "";
private int tempCount, temp2Count, temp3Count;
@Override @Override
public void initParam() { public void initParam() {
super.initParam(); super.initParam();
...@@ -69,6 +81,8 @@ public class InventoryActivity extends BaseActivity<ActivityInventoryBinding, In ...@@ -69,6 +81,8 @@ public class InventoryActivity extends BaseActivity<ActivityInventoryBinding, In
public void initData() { public void initData() {
super.initData(); super.initData();
setSupportActionBar(binding.include.toolbar); setSupportActionBar(binding.include.toolbar);
disableShowSoftInput(binding.etInvDesc);
viewModel.initToolbar(type); viewModel.initToolbar(type);
binding.setAdapter(new BindingRecyclerViewAdapter()); binding.setAdapter(new BindingRecyclerViewAdapter());
if ("0".equals(Configs.FREQUENCY_CONFIG)) { if ("0".equals(Configs.FREQUENCY_CONFIG)) {
...@@ -99,6 +113,52 @@ public class InventoryActivity extends BaseActivity<ActivityInventoryBinding, In ...@@ -99,6 +113,52 @@ public class InventoryActivity extends BaseActivity<ActivityInventoryBinding, In
public void initViewObservable() { public void initViewObservable() {
super.initViewObservable(); super.initViewObservable();
// InputConnection ic = binding.etInvDesc.getContentDescription()
//
binding.etInvDesc.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View view, int i, KeyEvent keyEvent) {
if (keyEvent.getAction() == KeyEvent.ACTION_DOWN
&& keyEvent.getKeyCode() != KeyEvent.KEYCODE_ENTER
) {
tempCount++;
viewModel.setTest(tempCount + "");
Log.e("why", "tempCount++" + tempCount+"-"+keyEvent);
} else if (keyEvent.getAction() == KeyEvent.ACTION_UP) {
temp2Count++;
viewModel.setTest2(temp2Count + "");
Log.e("why", "temp2Count--" + temp2Count+"-"+keyEvent);
} else if(keyEvent.getAction() == KeyEvent.FLAG_LONG_PRESS){
temp3Count++;
viewModel.setTest3(temp3Count + "");
Log.e("why", "temp3Count==" + temp3Count+"-"+keyEvent);
}
// if (tempCount > 1) {
// tempCount = 0;
//
// binding.etInvDesc.dispatchKeyEvent(KeyEvent.changeAction(keyEvent, KeyEvent.ACTION_UP));
// }
return false;
}
});
// binding.etInvDesc.setKeyListener(new DigitsKeyListener(){
// @Override
// public boolean onKeyDown(View view, Editable content, int keyCode, KeyEvent event) {
// Log.e("why", "onKeyDown:" + event);
// return super.onKeyDown(view, content, keyCode, event);
// }
//
// @Override
// public boolean onKeyUp(View view, Editable content, int keyCode, KeyEvent event) {
// Log.e("why", "onKeyUp:" + event);
// return super.onKeyUp(view, content, keyCode, event);
// }
// });
binding.etInvDesc.addTextChangedListener(new TextWatcher() { binding.etInvDesc.addTextChangedListener(new TextWatcher() {
@Override @Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
...@@ -114,10 +174,17 @@ public class InventoryActivity extends BaseActivity<ActivityInventoryBinding, In ...@@ -114,10 +174,17 @@ public class InventoryActivity extends BaseActivity<ActivityInventoryBinding, In
public void afterTextChanged(Editable editable) { public void afterTextChanged(Editable editable) {
binding.etInvDesc.removeTextChangedListener(this); binding.etInvDesc.removeTextChangedListener(this);
viewModel.trim(); viewModel.trim();
// binding.etInvDesc.setFocusable(true);
// binding.etInvDesc.setFocusableInTouchMode(true);
binding.etInvDesc.requestFocus();
binding.etInvDesc.requestFocusFromTouch();
binding.etInvDesc.setSelection(editable.length()); binding.etInvDesc.setSelection(editable.length());
binding.etInvDesc.addTextChangedListener(this); binding.etInvDesc.addTextChangedListener(this);
} }
}); });
viewModel.inventoryBtnEvent.observe(this, aBoolean -> { viewModel.inventoryBtnEvent.observe(this, aBoolean -> {
if (binding.inventory.getText().equals("盘点")) { if (binding.inventory.getText().equals("盘点")) {
binding.inventory.setText("停止"); binding.inventory.setText("停止");
...@@ -153,4 +220,20 @@ public class InventoryActivity extends BaseActivity<ActivityInventoryBinding, In ...@@ -153,4 +220,20 @@ public class InventoryActivity extends BaseActivity<ActivityInventoryBinding, In
} }
/**
* 禁止Edittext弹出软件盘,光标依然正常显示。
*/
public static void disableShowSoftInput(EditText editText) {
Class<EditText> cls = EditText.class;
Method method;
try {
method = cls.getMethod("setShowSoftInputOnFocus", boolean.class);
method.setAccessible(true);
method.invoke(editText, false);
} catch (Exception e) {
// TODO: 2018/8/27 处理错误
}
}
} }
...@@ -64,6 +64,9 @@ public class InventoryVM extends BackBarVM<Repository> implements OnInventoryLis ...@@ -64,6 +64,9 @@ public class InventoryVM extends BackBarVM<Repository> implements OnInventoryLis
private SparseIntArray musicId; private SparseIntArray musicId;
public ObservableField<String> unitName = new ObservableField<>(""); public ObservableField<String> unitName = new ObservableField<>("");
public ObservableField<String> labelNum = new ObservableField<>(""); public ObservableField<String> labelNum = new ObservableField<>("");
public ObservableField<String> testlNum = new ObservableField<>("-");
public ObservableField<String> testpNum = new ObservableField<>("-");
public ObservableField<String> testyNum = new ObservableField<>("-");
public ObservableField<String> tipDesc = new ObservableField<>(""); public ObservableField<String> tipDesc = new ObservableField<>("");
public ObservableField<Integer> tipDescVis = new ObservableField<>(View.VISIBLE); public ObservableField<Integer> tipDescVis = new ObservableField<>(View.VISIBLE);
public ObservableField<Integer> invBtnVis = new ObservableField<>(View.GONE); public ObservableField<Integer> invBtnVis = new ObservableField<>(View.GONE);
...@@ -165,6 +168,12 @@ public class InventoryVM extends BackBarVM<Repository> implements OnInventoryLis ...@@ -165,6 +168,12 @@ public class InventoryVM extends BackBarVM<Repository> implements OnInventoryLis
@Override @Override
public void call() { public void call() {
if (tipDesc.get().length() != 15) {
tipDesc.set("");
ToastUtils.showShort("标签错误,请重新扫描标签");
return;
}
if ("".equals(tipDesc.get().trim())) { if ("".equals(tipDesc.get().trim())) {
ToastUtils.showShort("请扫描标签"); ToastUtils.showShort("请扫描标签");
return; return;
...@@ -261,6 +270,18 @@ public class InventoryVM extends BackBarVM<Repository> implements OnInventoryLis ...@@ -261,6 +270,18 @@ public class InventoryVM extends BackBarVM<Repository> implements OnInventoryLis
map.put(tag, mList.size() - 1); map.put(tag, mList.size() - 1);
} }
public void setTest(String testcount){
testlNum.set(testcount);
}
public void setTest2(String testcount){
testpNum.set(testcount);
}
public void setTest3(String testcount){
testyNum.set(testcount);
}
public void jumpToActivity() { public void jumpToActivity() {
if (mList != null && mList.size() > 0) { if (mList != null && mList.size() > 0) {
Bundle mBundle = new Bundle(); Bundle mBundle = new Bundle();
......
...@@ -82,8 +82,7 @@ public class SearchVeterinaryFragment extends DialogFragment implements DialogIn ...@@ -82,8 +82,7 @@ public class SearchVeterinaryFragment extends DialogFragment implements DialogIn
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Bundle savedInstanceState) {
view = inflater.inflate(R.layout.dialog_search, container, false); view = inflater.inflate(R.layout.dialog_search, container, false);
init();//实例化 init();//实例化
...@@ -265,8 +264,8 @@ public class SearchVeterinaryFragment extends DialogFragment implements DialogIn ...@@ -265,8 +264,8 @@ public class SearchVeterinaryFragment extends DialogFragment implements DialogIn
VeterinaryDao.Properties.VeterinaryPhone.eq(searchKey)); VeterinaryDao.Properties.VeterinaryPhone.eq(searchKey));
List<Veterinary> veterinaries = DbUtil.getInstance().queryAll(Veterinary.class, builder); List<Veterinary> veterinaries = DbUtil.getInstance().queryAll(Veterinary.class, builder);
if (veterinaries == null || veterinaries.size() == 0) { if (veterinaries == null || veterinaries.size() == 0) {
ToastUtils.showShort("未找到符合 "+searchKey+" 的搜索结果"); ToastUtils.showShort("未找到符合 " + searchKey + " 的搜索结果");
}else { } else {
onSearchVeterinaryClickListener.OnSelectedClick(veterinaries.get(0)); onSearchVeterinaryClickListener.OnSelectedClick(veterinaries.get(0));
hideAnim(); hideAnim();
} }
...@@ -285,18 +284,19 @@ public class SearchVeterinaryFragment extends DialogFragment implements DialogIn ...@@ -285,18 +284,19 @@ public class SearchVeterinaryFragment extends DialogFragment implements DialogIn
QueryBuilder<Veterinary> builder = QueryBuilder<Veterinary> builder =
DbUtil.getInstance().getQueryBuilder(Veterinary.class) DbUtil.getInstance().getQueryBuilder(Veterinary.class)
.whereOr(VeterinaryDao.Properties.VeterinaryName.like("%" + keyword + "%"), .whereOr(VeterinaryDao.Properties.VeterinaryName.like("%" + keyword + "%"),
VeterinaryDao.Properties.VeterinaryPhone.like( keyword + "%")); VeterinaryDao.Properties.VeterinaryPhone.like(keyword + "%"));
DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<Veterinary>() { DbUtil.getInstance().setDbQueryCallBack(new DbQueryCallBack<Veterinary>() {
@Override @Override
public void onSuccess(List<Veterinary> result) { public void onSuccess(List<Veterinary> result) {
if (result != null && result.size() > 0) { if (result != null && result.size() > 0) {
Veterinaries.addAll(result); Veterinaries.addAll(result);
veterinaryAdapter.notifyDataSetChanged(); veterinaryAdapter.notifyDataSetChanged();
}else { } else {
Veterinaries.clear(); Veterinaries.clear();
veterinaryAdapter.notifyDataSetChanged(); veterinaryAdapter.notifyDataSetChanged();
} }
} }
@Override @Override
public void onFailed() { public void onFailed() {
......
...@@ -53,7 +53,7 @@ public class SplashActivity extends BaseActivity<ActivitySplashBinding, SplashVM ...@@ -53,7 +53,7 @@ public class SplashActivity extends BaseActivity<ActivitySplashBinding, SplashVM
if (result != null && result.size() > 0) { if (result != null && result.size() > 0) {
inputTime = result.get(0).getTimestamp(); inputTime = result.get(0).getTimestamp();
} }
viewModel.requestLabel(1, inputTime, 100000); viewModel.requestLabel(1, inputTime, 50000);
} }
@Override @Override
......
...@@ -82,7 +82,7 @@ public class SplashVM extends MainBarVM<Repository> { ...@@ -82,7 +82,7 @@ public class SplashVM extends MainBarVM<Repository> {
} else { } else {
dismissDialog(); dismissDialog();
showDialog("正在同步数据,请勿关闭屏幕或退出程序!"); showDialog("正在同步数据,请勿关闭屏幕或退出程序!");
queryUnitInputTime(unitPageIndex, 100000); queryUnitInputTime(unitPageIndex, 50000);
} }
} else { } else {
......
...@@ -45,4 +45,11 @@ public class UploadActivity extends BaseActivity<ActivityUploadBinding, UploadVM ...@@ -45,4 +45,11 @@ public class UploadActivity extends BaseActivity<ActivityUploadBinding, UploadVM
setSupportActionBar(binding.include.toolbar); setSupportActionBar(binding.include.toolbar);
viewModel.initToolbar(); viewModel.initToolbar();
} }
@Override
protected void onResume() {
super.onResume();
viewModel.refreshUploadCount();
}
} }
...@@ -255,13 +255,13 @@ public class DownloadVM extends BackBarVM<Repository> { ...@@ -255,13 +255,13 @@ public class DownloadVM extends BackBarVM<Repository> {
private void requestUnit(int index, long inputTime, int count) { private void requestUnit(int index, long inputTime, int count) {
isUnitDownload = true;
PostParams postParams = new PostParams(); PostParams postParams = new PostParams();
postParams.setInputTime(inputTime); postParams.setInputTime(inputTime);
postParams.setPageNum(index); postParams.setPageNum(index);
postParams.setPageSize(count); postParams.setPageSize(count);
postParams.setYears(""); postParams.setYears("");
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), new Gson().toJson(postParams));
new Gson().toJson(postParams));
KLog.e("--Unit--" + postParams.toString()); KLog.e("--Unit--" + postParams.toString());
addSubscribe(model.getUnitList(body) addSubscribe(model.getUnitList(body)
.compose(RxUtils.bindToLifecycle(getLifecycleProvider())) .compose(RxUtils.bindToLifecycle(getLifecycleProvider()))
...@@ -280,7 +280,7 @@ public class DownloadVM extends BackBarVM<Repository> { ...@@ -280,7 +280,7 @@ public class DownloadVM extends BackBarVM<Repository> {
if (result) { if (result) {
unitPageIndex++; unitPageIndex++;
requestUnit(unitPageIndex, inputTime, count); requestUnit(unitPageIndex, inputTime, count);
}else{ } else {
downloadNext(); downloadNext();
} }
} }
...@@ -327,13 +327,13 @@ public class DownloadVM extends BackBarVM<Repository> { ...@@ -327,13 +327,13 @@ public class DownloadVM extends BackBarVM<Repository> {
} }
private void requestVeterinary() { private void requestVeterinary() {
isVeterinaryDownload = true;
PostParams postParams = new PostParams(); PostParams postParams = new PostParams();
postParams.setInputTime(0); postParams.setInputTime(0);
postParams.setPageNum(1); postParams.setPageNum(1);
postParams.setPageSize(200); postParams.setPageSize(200);
postParams.setYears(""); postParams.setYears("");
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), new Gson().toJson(postParams));
new Gson().toJson(postParams));
addSubscribe(model.getVeterinaryList(body) addSubscribe(model.getVeterinaryList(body)
.compose(RxUtils.bindToLifecycle(getLifecycleProvider())) .compose(RxUtils.bindToLifecycle(getLifecycleProvider()))
.compose(RxUtils.schedulersTransformer()) .compose(RxUtils.schedulersTransformer())
...@@ -376,6 +376,7 @@ public class DownloadVM extends BackBarVM<Repository> { ...@@ -376,6 +376,7 @@ public class DownloadVM extends BackBarVM<Repository> {
} }
private void requestVillusBuy() { private void requestVillusBuy() {
isVillusBuyDownload = true;
List<VillusBuyEntity> villusBuy = model.getVillusBuy(); List<VillusBuyEntity> villusBuy = model.getVillusBuy();
PostParams postParams = new PostParams(); PostParams postParams = new PostParams();
Date _date = null; Date _date = null;
...@@ -434,6 +435,8 @@ public class DownloadVM extends BackBarVM<Repository> { ...@@ -434,6 +435,8 @@ public class DownloadVM extends BackBarVM<Repository> {
} }
private void requestBasicInfo() { private void requestBasicInfo() {
isBasicDownload = true;
PostParams postParams = new PostParams(); PostParams postParams = new PostParams();
postParams.setInputTime(0); postParams.setInputTime(0);
postParams.setPageNum(1); postParams.setPageNum(1);
......
...@@ -58,6 +58,12 @@ public class UploadVM extends BackBarVM<Repository> { ...@@ -58,6 +58,12 @@ public class UploadVM extends BackBarVM<Repository> {
private String toastStr = ""; private String toastStr = "";
public ObservableField<String> markingLabelNum = new ObservableField<>("打标记录");
public ObservableField<String> harmlessLabelNum = new ObservableField<>("无害化处理");
public ObservableField<String> quarantineLabelNum = new ObservableField<>("检疫记录");
public ObservableField<String> villusBuyLabelNum = new ObservableField<>("绒毛购买");
public ObservableField<String> villusgaugelabelnum = new ObservableField<>("绒毛测量");
public ObservableField<Boolean> isUploadMarking = new ObservableField<Boolean>(false); public ObservableField<Boolean> isUploadMarking = new ObservableField<Boolean>(false);
public ObservableField<Boolean> isUploadHarmless = new ObservableField<Boolean>(false); public ObservableField<Boolean> isUploadHarmless = new ObservableField<Boolean>(false);
public ObservableField<Boolean> isUploadQuarantine = new ObservableField<Boolean>(false); public ObservableField<Boolean> isUploadQuarantine = new ObservableField<Boolean>(false);
...@@ -139,6 +145,17 @@ public class UploadVM extends BackBarVM<Repository> { ...@@ -139,6 +145,17 @@ public class UploadVM extends BackBarVM<Repository> {
isUploadVillusGauge.set(isSelected); isUploadVillusGauge.set(isSelected);
} }
//查询每项未上传记录数量
public void refreshUploadCount() {
markingLabelNum.set("打标记录 " + "(" + DbUtil.getInstance().count(Marking.class) + ")");
harmlessLabelNum.set("无害化处理 " + "(" + DbUtil.getInstance().count(Harmless.class) + ")");
quarantineLabelNum.set("检疫记录 " + "(" + DbUtil.getInstance().count(Quarantine.class) + ")");
villusBuyLabelNum.set("绒毛购买 " + "(" + DbUtil.getInstance().count(VillusBuyEntity.class) + ")");
villusgaugelabelnum.set("绒毛测量 " + "(" + DbUtil.getInstance().count(VillusGaugeEntity.class) + ")");
;
}
private void uploadNext() { private void uploadNext() {
if (isUploadMarking.get() && !isMarkingUpload) { if (isUploadMarking.get() && !isMarkingUpload) {
...@@ -152,6 +169,7 @@ public class UploadVM extends BackBarVM<Repository> { ...@@ -152,6 +169,7 @@ public class UploadVM extends BackBarVM<Repository> {
} else if (isUploadVillusGauge.get() && !isVillusGaugeUpload) { } else if (isUploadVillusGauge.get() && !isVillusGaugeUpload) {
uploadVillusGauge(); uploadVillusGauge();
} else { } else {
refreshUploadCount();
if (!isUploadMarking.get() && !isUploadHarmless.get() && !isUploadQuarantine.get() && !isUploadVillusBuy.get() && !isUploadVillusGauge.get()) { if (!isUploadMarking.get() && !isUploadHarmless.get() && !isUploadQuarantine.get() && !isUploadVillusBuy.get() && !isUploadVillusGauge.get()) {
ToastUtils.showShort("请选择上传的项目"); ToastUtils.showShort("请选择上传的项目");
} else if (!"".equals(toastStr)) { } else if (!"".equals(toastStr)) {
...@@ -218,7 +236,7 @@ public class UploadVM extends BackBarVM<Repository> { ...@@ -218,7 +236,7 @@ public class UploadVM extends BackBarVM<Repository> {
}).deleteAsyncBatch(Marking.class, result); }).deleteAsyncBatch(Marking.class, result);
} else { } else {
dismissDialog(); dismissDialog();
toastStr +="marking上传失败;"; toastStr += "marking上传失败;";
ToastUtils.showShort("marking上传失败"); ToastUtils.showShort("marking上传失败");
uploadNext(); uploadNext();
} }
...@@ -295,7 +313,7 @@ public class UploadVM extends BackBarVM<Repository> { ...@@ -295,7 +313,7 @@ public class UploadVM extends BackBarVM<Repository> {
} }
}).deleteAsyncBatch(Quarantine.class, result); }).deleteAsyncBatch(Quarantine.class, result);
} else { } else {
toastStr +="上传检疫数据失败;"; toastStr += "上传检疫数据失败;";
ToastUtils.showShort("上传检疫数据失败"); ToastUtils.showShort("上传检疫数据失败");
uploadNext(); uploadNext();
} }
...@@ -370,7 +388,7 @@ public class UploadVM extends BackBarVM<Repository> { ...@@ -370,7 +388,7 @@ public class UploadVM extends BackBarVM<Repository> {
} }
}).deleteAsyncBatch(Harmless.class, result); }).deleteAsyncBatch(Harmless.class, result);
} else { } else {
toastStr +="上传无害化失败;"; toastStr += "上传无害化失败;";
ToastUtils.showShort("上传无害化失败"); ToastUtils.showShort("上传无害化失败");
uploadNext(); uploadNext();
} }
...@@ -435,7 +453,7 @@ public class UploadVM extends BackBarVM<Repository> { ...@@ -435,7 +453,7 @@ public class UploadVM extends BackBarVM<Repository> {
} }
}).updateAsyncBatch(VillusBuyEntity.class, result); }).updateAsyncBatch(VillusBuyEntity.class, result);
} else { } else {
toastStr +="上传绒毛购买数据失败;"; toastStr += "上传绒毛购买数据失败;";
ToastUtils.showShort("上传绒毛购买数据失败"); ToastUtils.showShort("上传绒毛购买数据失败");
uploadNext(); uploadNext();
} }
...@@ -500,7 +518,7 @@ public class UploadVM extends BackBarVM<Repository> { ...@@ -500,7 +518,7 @@ public class UploadVM extends BackBarVM<Repository> {
} }
}).updateAsyncBatch(VillusGaugeEntity.class, result); }).updateAsyncBatch(VillusGaugeEntity.class, result);
} else { } else {
toastStr +="上传绒毛测量数据失败;"; toastStr += "上传绒毛测量数据失败;";
ToastUtils.showShort("上传绒毛测量数据失败"); ToastUtils.showShort("上传绒毛测量数据失败");
uploadNext(); uploadNext();
} }
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:id="@+id/inventory_num" android:id="@+id/inventory_num"
android:layout_width="wrap_content" android:layout_width="@dimen/dp_70"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_20" android:layout_marginStart="@dimen/dp_20"
android:text="@={viewModel.labelNum}" android:text="@={viewModel.labelNum}"
...@@ -92,6 +92,38 @@ ...@@ -92,6 +92,38 @@
binding:layout_constraintBaseline_toBaselineOf="@id/inventory_num_desc" binding:layout_constraintBaseline_toBaselineOf="@id/inventory_num_desc"
binding:layout_constraintStart_toEndOf="@+id/inventory_num_desc" /> binding:layout_constraintStart_toEndOf="@+id/inventory_num_desc" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/testl_num"
android:layout_width="@dimen/dp_30"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_20"
android:text="@={viewModel.testlNum}"
android:textColor="#2d2f33"
android:textSize="@dimen/desc_text_size"
binding:layout_constraintBaseline_toBaselineOf="@id/inventory_num_desc"
binding:layout_constraintLeft_toRightOf="@+id/inventory_num"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/testp_num"
android:layout_width="@dimen/dp_30"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_20"
android:text="@={viewModel.testpNum}"
android:textColor="#2d2f33"
android:textSize="@dimen/desc_text_size"
binding:layout_constraintBaseline_toBaselineOf="@id/inventory_num_desc"
binding:layout_constraintLeft_toRightOf="@+id/testl_num"/>
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="@dimen/dp_30"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_20"
android:text="@={viewModel.testyNum}"
android:textColor="#2d2f33"
android:textSize="@dimen/desc_text_size"
binding:layout_constraintBaseline_toBaselineOf="@id/inventory_num_desc"
binding:layout_constraintLeft_toRightOf="@+id/testp_num"/>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
android:layout_marginStart="@dimen/dp_20" android:layout_marginStart="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_20" android:layout_marginTop="@dimen/dp_20"
android:checked="@{viewModel.isUploadMarking}" android:checked="@{viewModel.isUploadMarking}"
android:text="打标记录" android:text="@{viewModel.markingLabelNum}"
android:textColor="@color/black" android:textColor="@color/black"
binding:layout_constraintStart_toStartOf="parent" binding:layout_constraintStart_toStartOf="parent"
binding:layout_constraintTop_toTopOf="parent" binding:layout_constraintTop_toTopOf="parent"
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
android:layout_marginTop="@dimen/dp_20" android:layout_marginTop="@dimen/dp_20"
android:layout_marginEnd="@dimen/dp_20" android:layout_marginEnd="@dimen/dp_20"
android:checked="@{viewModel.isUploadHarmless}" android:checked="@{viewModel.isUploadHarmless}"
android:text="无害化处理" android:text="@{viewModel.harmlessLabelNum}"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="@dimen/desc_text_size" android:textSize="@dimen/desc_text_size"
binding:layout_constraintEnd_toEndOf="parent" binding:layout_constraintEnd_toEndOf="parent"
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_20" android:layout_marginTop="@dimen/dp_20"
android:checked="@{viewModel.isUploadQuarantine}" android:checked="@{viewModel.isUploadQuarantine}"
android:text="检疫记录" android:text="@{viewModel.quarantineLabelNum}"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="@dimen/desc_text_size" android:textSize="@dimen/desc_text_size"
binding:layout_constraintStart_toStartOf="@id/marking_info_desc" binding:layout_constraintStart_toStartOf="@id/marking_info_desc"
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
android:layout_marginTop="@dimen/dp_20" android:layout_marginTop="@dimen/dp_20"
android:layout_marginEnd="@dimen/dp_20" android:layout_marginEnd="@dimen/dp_20"
android:checked="@{viewModel.isUploadVillusBuy}" android:checked="@{viewModel.isUploadVillusBuy}"
android:text="绒毛购买" android:text="@{viewModel.villusBuyLabelNum}"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="@dimen/desc_text_size" android:textSize="@dimen/desc_text_size"
binding:layout_constraintStart_toStartOf="@id/harmless_info_desc" binding:layout_constraintStart_toStartOf="@id/harmless_info_desc"
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_20" android:layout_marginTop="@dimen/dp_20"
android:checked="@{viewModel.isUploadVillusGauge}" android:checked="@{viewModel.isUploadVillusGauge}"
android:text="绒毛测量" android:text="@{viewModel.villusgaugelabelnum}"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="@dimen/desc_text_size" android:textSize="@dimen/desc_text_size"
binding:layout_constraintStart_toStartOf="@id/marking_info_desc" binding:layout_constraintStart_toStartOf="@id/marking_info_desc"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment