|
|
@@ -11,12 +11,14 @@ import android.graphics.drawable.ColorDrawable;
|
|
|
import android.os.Bundle;
|
|
|
import android.os.Handler;
|
|
|
import android.util.DisplayMetrics;
|
|
|
+import android.util.SparseBooleanArray;
|
|
|
import android.view.Gravity;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
|
import android.view.WindowManager;
|
|
|
import android.widget.AdapterView;
|
|
|
+import android.widget.ArrayAdapter;
|
|
|
import android.widget.Button;
|
|
|
import android.widget.EditText;
|
|
|
import android.widget.ImageView;
|
|
|
@@ -217,11 +219,10 @@ public class StockOutBindActivity extends BaseActivity {
|
|
|
|
|
|
private void setNewItemAreaValue(List<MaterialStockModel> materialStockModelList){
|
|
|
for (MaterialStockModel lineAreaModel:materialStockModelList){
|
|
|
- if(lineAreaModel.getAreaCode().startsWith("A")){
|
|
|
- continue;
|
|
|
+ if(lineAreaModel.getAreaCode().startsWith("B")){
|
|
|
+ View areaView = addAreaItem();
|
|
|
+ setStockItemValue(lineAreaModel, areaView);
|
|
|
}
|
|
|
- View areaView = addAreaItem();
|
|
|
- setStockItemValue(lineAreaModel, areaView);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -335,7 +336,7 @@ public class StockOutBindActivity extends BaseActivity {
|
|
|
params.addBodyParameter("outstockId", lineModel.getOutstockId().toString());
|
|
|
params.addBodyParameter("lineId", lineModel.getLineId().toString());
|
|
|
params.addBodyParameter("erpOutstockCode", erpOutstockCode);
|
|
|
- if("-1".equals(batchCode)){
|
|
|
+ if("随机".equals(batchCode)){
|
|
|
params.addBodyParameter("outMode", "0");
|
|
|
}else{
|
|
|
params.addBodyParameter("outMode", "1");
|
|
|
@@ -895,51 +896,62 @@ public class StockOutBindActivity extends BaseActivity {
|
|
|
||"1".equals(lineModel.getStatus())){
|
|
|
return;
|
|
|
}
|
|
|
- List<Map<String,String>> params = new ArrayList<>();
|
|
|
- Map<String,String> defaultParam = new HashMap<>();
|
|
|
- defaultParam.put("name", "随机");
|
|
|
- defaultParam.put("value", "-1");
|
|
|
- params.add(defaultParam);
|
|
|
+ List<String> params1 = new ArrayList<>();
|
|
|
+ params1.add("随机");
|
|
|
if(!batchModelList.isEmpty()){
|
|
|
batchModelList.forEach(item->{
|
|
|
- Map<String,String> param = new HashMap<>();
|
|
|
- param.put("name", item.getBatchCode());
|
|
|
- param.put("value", item.getBatchCode());
|
|
|
- params.add(param);
|
|
|
+ params1.add(item.getBatchCode());
|
|
|
});
|
|
|
}
|
|
|
View popup_list_view= LayoutInflater.from(context).inflate(R.layout.popupwindow_list_view,null);
|
|
|
ListView mListView = popup_list_view.findViewById(R.id.lv_data);
|
|
|
- mListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
|
|
|
Button itemCancel = popup_list_view.findViewById(R.id.bt_item_cancel);
|
|
|
+ Button itemOk = popup_list_view.findViewById(R.id.bt_item_ok);
|
|
|
+ itemOk.setVisibility(View.VISIBLE);
|
|
|
itemCancel.setOnClickListener(v -> {
|
|
|
if(popupWindow1!=null){
|
|
|
popupWindow1.dismiss();
|
|
|
setBackgroundAlpha(1.0f);
|
|
|
}
|
|
|
});
|
|
|
- mListView.setBackgroundResource(R.color.white);
|
|
|
- SimpleAdapter simplead = new SimpleAdapter(this, params,
|
|
|
- R.layout.popupwindow_list_item, new String[] { "name"},
|
|
|
- new int[] {R.id.tv_msg});
|
|
|
- mListView.setAdapter(simplead);
|
|
|
- mListView.setOnItemClickListener((parent, view1, position, id) -> {
|
|
|
+ itemOk.setOnClickListener(v->{
|
|
|
try {
|
|
|
- String value = params.get(position).get("value");
|
|
|
- String name = params.get(position).get("name");
|
|
|
- if(name!=null) {
|
|
|
- if (name.contains(".")) {
|
|
|
- name = name.split("\\.")[0];
|
|
|
+ batchCode = "";
|
|
|
+ SparseBooleanArray checked = mListView.getCheckedItemPositions();
|
|
|
+ for (int i = 0; i < checked.size(); i++) {
|
|
|
+ if (checked.valueAt(i)) {
|
|
|
+ int position = checked.keyAt(i);
|
|
|
+ String selectedItem = params1.get(position);
|
|
|
+ batchCode += "," + selectedItem;
|
|
|
}
|
|
|
- binding.tvBatchCode.setText(name);
|
|
|
}
|
|
|
- batchCode = value;
|
|
|
+ if(!StringUtils.isEmpty(batchCode)){
|
|
|
+ batchCode = batchCode.substring(1);
|
|
|
+ }
|
|
|
+ binding.tvBatchCode.setText(batchCode);
|
|
|
updateStockOutLine();
|
|
|
- popupWindow1.dismiss();
|
|
|
- setBackgroundAlpha(1.0f);
|
|
|
}catch (Throwable ex){
|
|
|
mylog.error("选择批号异常", ex);
|
|
|
}
|
|
|
+ popupWindow1.dismiss();
|
|
|
+ setBackgroundAlpha(1.0f);
|
|
|
+ });
|
|
|
+ mListView.setBackgroundResource(R.color.white);
|
|
|
+ mListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
|
|
|
+ ArrayAdapter<String> adapter = new ArrayAdapter<>(
|
|
|
+ this,
|
|
|
+ android.R.layout.simple_list_item_multiple_choice,
|
|
|
+ params1);
|
|
|
+ mListView.setAdapter(adapter);
|
|
|
+ mListView.setOnItemClickListener((parent, v, position, id) -> {
|
|
|
+ if(position == 0) {
|
|
|
+ for (int i = 0; i < mListView.getCount(); i++) {
|
|
|
+ mListView.setItemChecked(i, false);
|
|
|
+ }
|
|
|
+ mListView.setItemChecked(position, true);
|
|
|
+ }else{
|
|
|
+ mListView.setItemChecked(0, false);
|
|
|
+ }
|
|
|
});
|
|
|
WindowManager manager = this.getWindowManager();
|
|
|
DisplayMetrics outMetrics = new DisplayMetrics();
|