|
@@ -1,21 +1,16 @@
|
|
|
package xn.hxp.ui.plan.already;
|
|
|
|
|
|
-import android.content.DialogInterface;
|
|
|
import android.content.Intent;
|
|
|
import android.os.Bundle;
|
|
|
-import android.text.InputType;
|
|
|
import android.text.TextUtils;
|
|
|
import android.util.Log;
|
|
|
import android.view.View;
|
|
|
-import android.widget.Button;
|
|
|
-import android.widget.EditText;
|
|
|
import android.widget.RadioGroup;
|
|
|
|
|
|
import androidx.activity.result.ActivityResult;
|
|
|
import androidx.activity.result.ActivityResultCallback;
|
|
|
import androidx.activity.result.ActivityResultLauncher;
|
|
|
import androidx.activity.result.contract.ActivityResultContracts;
|
|
|
-import androidx.appcompat.app.AlertDialog;
|
|
|
import androidx.viewbinding.ViewBinding;
|
|
|
|
|
|
import com.blankj.utilcode.util.ClickUtils;
|
|
@@ -62,6 +57,7 @@ import xn.hxp.ui.plan.room.dao.HxpDoorDAO;
|
|
|
import xn.hxp.ui.plan.room.dao.HxpInventoryDAO;
|
|
|
import xn.hxp.ui.plan.save_list.SaveListActivity;
|
|
|
import xn.hxp.ui.plan.unlock.UnlockActivity;
|
|
|
+import xn.hxp.weidith.SelectAlreadyDialog;
|
|
|
|
|
|
public class AlreadyActivity extends BaseActivity {
|
|
|
private ActivityAlreadyBinding binding;
|
|
@@ -76,7 +72,9 @@ public class AlreadyActivity extends BaseActivity {
|
|
|
private String applyUserName;// 申领人
|
|
|
private String topicUserName;// 归属人
|
|
|
|
|
|
- private String[] applyArray;
|
|
|
+ private List<String> applicantList;// 申领人选择列
|
|
|
+ private List<String> ownerList;// 归属人选择列
|
|
|
+ private List<String> applyOrderNumberList;// 申领单号选择列
|
|
|
|
|
|
private ActivityResultLauncher<Intent> intentActivityResultLauncher;
|
|
|
|
|
@@ -159,7 +157,7 @@ public class AlreadyActivity extends BaseActivity {
|
|
|
alreadyAdapter.update(type);
|
|
|
LogUtils.json(waitArray);
|
|
|
} else {
|
|
|
- showLoading("未有可操作的数据!");
|
|
|
+ showToast("未有可操作的数据!");
|
|
|
binding.selectAllCB.setChecked(false);
|
|
|
}
|
|
|
}
|
|
@@ -185,24 +183,23 @@ public class AlreadyActivity extends BaseActivity {
|
|
|
binding.applicantCodeSearchRL.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
- if (null != applyArray) {
|
|
|
- AlertDialog.Builder builder = new AlertDialog.Builder(AlreadyActivity.this);
|
|
|
- builder.setTitle("选择申领单号查询");
|
|
|
- builder.setItems(applyArray, (dialog, which) -> {
|
|
|
- applyOrder = applyArray[which];
|
|
|
- binding.applicantCodeSearchTV.setText(applyOrder);
|
|
|
- binding.applicantCodeSearchTV.setSelected(true);
|
|
|
- getHxpStockWait(true);
|
|
|
- });
|
|
|
- builder.setNeutralButton("清空", new DialogInterface.OnClickListener() {
|
|
|
+ if (null != applyOrderNumberList) {
|
|
|
+ new SelectAlreadyDialog(AlreadyActivity.this, "选择申领单号", applyOrderNumberList, new SelectAlreadyDialog.SelectedListener() {
|
|
|
@Override
|
|
|
- public void onClick(DialogInterface dialog, int which) {
|
|
|
+ public void selected(String string) {
|
|
|
+ applyOrder = string;
|
|
|
+ binding.applicantCodeSearchTV.setText(applyOrder);
|
|
|
+ binding.applicantCodeSearchTV.setSelected(true);
|
|
|
+ getHxpStockWait(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void clear() {
|
|
|
applyOrder = "";
|
|
|
binding.applicantCodeSearchTV.setText("申领单号");
|
|
|
getHxpStockWait(true);
|
|
|
}
|
|
|
- });
|
|
|
- builder.show();
|
|
|
+ }).show();
|
|
|
} else {
|
|
|
showLoading("申领单号查询中...");
|
|
|
getApplyList();
|
|
@@ -214,88 +211,54 @@ public class AlreadyActivity extends BaseActivity {
|
|
|
binding.applicantSearchRL.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
- AlertDialog.Builder builder = new AlertDialog.Builder(AlreadyActivity.this);
|
|
|
- builder.setTitle("请输入申领人姓名");
|
|
|
- final EditText editText = new EditText(AlreadyActivity.this);
|
|
|
- editText.setInputType(InputType.TYPE_CLASS_TEXT); // 设置输入类型为文本
|
|
|
- builder.setView(editText);
|
|
|
- builder.setNeutralButton("清空", new DialogInterface.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(DialogInterface dialog, int which) {
|
|
|
- applyUserName = "";
|
|
|
- binding.applicantSearchTV.setText("申领人");
|
|
|
- getHxpStockWait(true);
|
|
|
- }
|
|
|
- });
|
|
|
- builder.setPositiveButton("确定", null);
|
|
|
- builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(DialogInterface dialog, int which) {
|
|
|
- dialog.dismiss();
|
|
|
- }
|
|
|
- });
|
|
|
- AlertDialog dialog = builder.create();
|
|
|
- dialog.show();
|
|
|
- Button positiveButton = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
|
|
|
- positiveButton.setOnClickListener(new View.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View v) {
|
|
|
- String input = editText.getText().toString();
|
|
|
- if (input.isEmpty()) {
|
|
|
- editText.setSelected(true);
|
|
|
- editText.setError("请输入姓名!");
|
|
|
- } else {
|
|
|
- applyUserName = input;
|
|
|
+ if (null != applicantList) {
|
|
|
+ new SelectAlreadyDialog(AlreadyActivity.this, "选择申领人", applicantList, new SelectAlreadyDialog.SelectedListener() {
|
|
|
+ @Override
|
|
|
+ public void selected(String string) {
|
|
|
+ applyUserName = string;
|
|
|
binding.applicantSearchTV.setText(applyUserName);
|
|
|
+ binding.applicantSearchTV.setSelected(true);
|
|
|
getHxpStockWait(true);
|
|
|
- dialog.dismiss();
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void clear() {
|
|
|
+ applyUserName = "";
|
|
|
+ binding.applicantSearchTV.setText("申领人");
|
|
|
+ getHxpStockWait(true);
|
|
|
+ }
|
|
|
+ }).show();
|
|
|
+ } else {
|
|
|
+ showLoading("申领人查询中...");
|
|
|
+ getApplyList();
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
// 根据归属人查询
|
|
|
binding.belongSearchRL.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
- AlertDialog.Builder builder = new AlertDialog.Builder(AlreadyActivity.this);
|
|
|
- builder.setTitle("请输入归属人姓名");
|
|
|
- final EditText editText = new EditText(AlreadyActivity.this);
|
|
|
- editText.setInputType(InputType.TYPE_CLASS_TEXT); // 设置输入类型为文本
|
|
|
- builder.setView(editText);
|
|
|
- builder.setPositiveButton("确定", null);
|
|
|
- builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(DialogInterface dialog, int which) {
|
|
|
- dialog.dismiss();
|
|
|
- }
|
|
|
- });
|
|
|
- builder.setNeutralButton("清空", new DialogInterface.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(DialogInterface dialog, int which) {
|
|
|
- topicUserName = "";
|
|
|
- binding.belongSearchTV.setText("归属人");
|
|
|
- getHxpStockWait(true);
|
|
|
- }
|
|
|
- });
|
|
|
- AlertDialog dialog = builder.create();
|
|
|
- dialog.show();
|
|
|
- Button positiveButton = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
|
|
|
- positiveButton.setOnClickListener(new View.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View v) {
|
|
|
- String input = editText.getText().toString();
|
|
|
- if (input.isEmpty()) {
|
|
|
- editText.setSelected(true);
|
|
|
- editText.setError("请输入姓名!");
|
|
|
- } else {
|
|
|
- topicUserName = input;
|
|
|
+ if (null != ownerList) {
|
|
|
+ new SelectAlreadyDialog(AlreadyActivity.this, "选择归属人", ownerList, new SelectAlreadyDialog.SelectedListener() {
|
|
|
+ @Override
|
|
|
+ public void selected(String string) {
|
|
|
+ topicUserName = string;
|
|
|
binding.belongSearchTV.setText(topicUserName);
|
|
|
+ binding.belongSearchTV.setSelected(true);
|
|
|
getHxpStockWait(true);
|
|
|
- dialog.dismiss();
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void clear() {
|
|
|
+ topicUserName = "";
|
|
|
+ binding.belongSearchTV.setText("归属人");
|
|
|
+ getHxpStockWait(true);
|
|
|
+ }
|
|
|
+ }).show();
|
|
|
+ } else {
|
|
|
+ showLoading("归属人查询中...");
|
|
|
+ getApplyList();
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
// 一键入库
|
|
@@ -507,6 +470,7 @@ public class AlreadyActivity extends BaseActivity {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 获取单号检索列表
|
|
|
*/
|
|
@@ -518,24 +482,23 @@ public class AlreadyActivity extends BaseActivity {
|
|
|
String json = response.body().string();
|
|
|
JSONObject jsonObject = new JSONObject(json);
|
|
|
if (jsonObject.getInt("code") == 200) {
|
|
|
- JSONArray jsonArray = jsonObject.getJSONArray("data");
|
|
|
- return GsonUtils.fromJson(jsonArray.toString(), new TypeToken<ArrayList<String>>() {
|
|
|
+ JSONObject data = jsonObject.getJSONObject("data");
|
|
|
+ applicantList = GsonUtils.fromJson(data.getJSONArray("applicants").toString(), new TypeToken<ArrayList<String>>() {
|
|
|
+ }.getType());
|
|
|
+ ownerList = GsonUtils.fromJson(data.getJSONArray("owners").toString(), new TypeToken<ArrayList<String>>() {
|
|
|
+ }.getType());
|
|
|
+ applyOrderNumberList = GsonUtils.fromJson(data.getJSONArray("applyOrderNumbers").toString(), new TypeToken<ArrayList<String>>() {
|
|
|
}.getType());
|
|
|
} else {
|
|
|
String msg = jsonObject.getString("message");
|
|
|
ToastUtils.showLong(msg);
|
|
|
- return null;
|
|
|
}
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onSuccess(List<String> applyList) {
|
|
|
dismissLoading();
|
|
|
- if (applyList == null) {
|
|
|
- showToast("获取申领单号失败!");
|
|
|
- } else {
|
|
|
- applyArray = applyList.toArray(new String[0]);
|
|
|
- }
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -574,7 +537,6 @@ public class AlreadyActivity extends BaseActivity {
|
|
|
RoomTool.getInstance().hxpDoorDAO().insertAll(hxpCabinetDoorVoList);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
} else {
|
|
|
throw new NetException("" + hxpCabinetListVo.getCode(), hxpCabinetListVo.getMessage());
|
|
@@ -631,6 +593,8 @@ public class AlreadyActivity extends BaseActivity {
|
|
|
List<HxpChemicalVo> resultRecords = result.getPageData().getRecords();
|
|
|
if (null != resultRecords && !resultRecords.isEmpty()) {
|
|
|
hxpChemicalVoList.addAll(resultRecords);
|
|
|
+ } else {
|
|
|
+ showToast("暂无数据!");
|
|
|
}
|
|
|
|
|
|
for (String checkWaitId : checkWaitIdSet) {
|
|
@@ -648,16 +612,12 @@ public class AlreadyActivity extends BaseActivity {
|
|
|
} else {
|
|
|
alreadyAdapter.update(type);
|
|
|
}
|
|
|
- int total = result.getPageData().getTotal();
|
|
|
if (result.isAdmin()) {
|
|
|
binding.typeRG.setVisibility(View.VISIBLE);
|
|
|
- if (binding.relatedRB.isChecked()) {
|
|
|
- binding.relatedRB.setText("与我相关(" + total + ")");
|
|
|
- }
|
|
|
- if (binding.otherRB.isChecked()) {
|
|
|
- binding.otherRB.setText("其它(" + total + ")");
|
|
|
- }
|
|
|
+ binding.relatedRB.setText("与我相关(" + result.getPersonal() + ")");
|
|
|
+ binding.otherRB.setText("其它(" + result.getOther() + ")");
|
|
|
} else {
|
|
|
+ int total = result.getPageData().getTotal();
|
|
|
binding.alreadyName.setText("已申领危化品存储(" + total + ")");
|
|
|
if (total == 0) {
|
|
|
showToast("暂无您可处理的危化品!");
|