修改 问题

master
wanghao 3 months ago
parent b876685f82
commit 63f04c9f65

@ -1,11 +1,13 @@
package com.example.as_trak;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ObservableBoolean;
import androidx.databinding.ObservableInt;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
@ -23,13 +25,13 @@ import com.example.as_trak.entity.CargoInfo;
import com.example.as_trak.entity.ContainerType;
import com.example.as_trak.entity.FlightInfo;
import com.example.as_trak.entity.LoadOperation;
import com.example.as_trak.toast.LoadToast;
import org.litepal.LitePal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
public class LoadMainActivity extends BaseActivity implements AddFlightDialog.AddFlightDialogCall, CargoInfoAdapter.CargoInfoCall, AdapterView.OnItemClickListener {
private ObservableBoolean visibState;
@ -40,8 +42,9 @@ public class LoadMainActivity extends BaseActivity implements AddFlightDialog.Ad
private CargoInfoAdapter cargoInfoAdapter;
private List<CargoInfo> cargoInfoList;
private FlightInfoAdapter adapter;
private ActivityLoadMainBinding binding;
private ObservableInt cargoQty;
private ObservableInt loadQty;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -53,7 +56,20 @@ public class LoadMainActivity extends BaseActivity implements AddFlightDialog.Ad
// 装载器适配
cargoInfoAdapter = new CargoInfoAdapter(this, this);
binding.setAdapter(cargoInfoAdapter);
// 航班添加框
initAddFlight(); // 航班添加框
intent = new Intent(this, LoadScanActivity.class);
initInputCargo();
cargoQty = new ObservableInt();
loadQty = new ObservableInt();
binding.setQty1(cargoQty);
binding.setQty2(loadQty);
builder = new AlertDialog.Builder(this);
builder.setTitle("删除确认").setMessage("是否确定删除装载单元").setNegativeButton("取消", null);
}
// 初始化航班添加
private void initAddFlight() {
addFlightDialog = new AddFlightDialog(this);
addFlightDialog.setCall(this);
// 航班选择框
@ -68,9 +84,10 @@ public class LoadMainActivity extends BaseActivity implements AddFlightDialog.Ad
binding.loadMainFlightCode.setOnClickListener(v -> {
lpw.show();
});
intent = new Intent(this, LoadScanActivity.class);
}
// 初始化添加货箱
private void initInputCargo() {
List<ContainerType> list = LitePal.findAll(ContainerType.class);
Log.e("TAG", "onCreate:" + list.toString());
if (list != null) {
@ -87,10 +104,8 @@ public class LoadMainActivity extends BaseActivity implements AddFlightDialog.Ad
binding.setList1(list1);
binding.setList2(list2);
}
}
// 显示航班添加框
public void loadAddFlight(View view) {
addFlightDialog.show();
@ -102,15 +117,15 @@ public class LoadMainActivity extends BaseActivity implements AddFlightDialog.Ad
}
// 添加货箱
@SuppressLint("NotifyDataSetChanged")
public void loadAddCargo(View view) {
if (flightInfoTag == null) {
return;
}
if (flightInfoTag == null) return;
String cargoCode = binding.loadMainCargoCode.getText().toString();
if (cargoCode.isEmpty()) {
return;
}
if (cargoCode.isEmpty()) return;
String cargoCode0 = binding.loadMainCargoCode0.getSelectedItem().toString();
String cargoCode2 = binding.loadMainCargoCode2.getSelectedItem().toString();
int id = flightInfoTag.getId();
cargoCode = cargoCode0 + cargoCode + cargoCode2;
int countTag = LitePal.where("cargoCode= ? and flightId=?", cargoCode, String.valueOf(id)).count(CargoInfo.class);
if (countTag > 0) {
Toast.makeText(this, "装载单元已经绑定", Toast.LENGTH_SHORT).show();
@ -121,13 +136,18 @@ public class LoadMainActivity extends BaseActivity implements AddFlightDialog.Ad
cargoInfo.setCargoCode(cargoCode);
cargoInfo.setFlightId(id);
cargoInfo.setState("未装载");
// cargoInfo.setLoadState("C0");
cargoInfo.save();
cargoInfoList.add(cargoInfo);
cargoInfoAdapter.notifyDataSetChanged();
cargoQty.set(cargoInfoList.size());
binding.loadMainCargoCode.setText(null);
Toast.makeText(this, "绑定成功", Toast.LENGTH_SHORT).show();
}
public void saveNumber(View view) {
flightInfoTag.setJieguiQty(binding.loadMainJieguiQty.getText().toString());
flightInfoTag.update(flightInfoTag.getId());
}
// 关闭货箱添加
public void loadCloseEdit(View view) {
visibState.set(true);
@ -156,50 +176,37 @@ public class LoadMainActivity extends BaseActivity implements AddFlightDialog.Ad
adapter.notifyDataSetChanged();
}
/*
@Override
public void sanCodeResult(String code) {
super.sanCodeResult(code);
Log.e("TAG", "sanCodeResult:" + code);
}*/
@Override
public void updateCargoInfo(int index) {
// CargoInfo cargoInfo = cargoInfoList.get(index);
// cargoInfoAdapter.notifyDataSetChanged();
}
// 长按删除
private AlertDialog.Builder builder;
@SuppressLint("NotifyDataSetChanged")
@Override
public void deleteCargoInfo(int index) {
public void longClickCargoInfo(int index) {
CargoInfo cargoInfo = cargoInfoList.get(index);
if (!cargoInfo.getState().equals("待装载")) {
Toast.makeText(this, "已经装载行李,不能删除", Toast.LENGTH_SHORT).show();
return;
}
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
cargoInfo.delete();
cargoInfoList.remove(index);
cargoInfoAdapter.notifyDataSetChanged();
Toast.makeText(LoadMainActivity.this, "删除完成", Toast.LENGTH_SHORT).show();
}
}).show();
private Intent intent;
public void clickCargoInfo(View view) {
if (flightInfoTag == null) {
Toast.makeText(this, "没有选择航班", Toast.LENGTH_SHORT).show();
return;
}
if (cargoInfoList == null || cargoInfoList.isEmpty()) {
Toast.makeText(this, "没有添加装载单元", Toast.LENGTH_SHORT).show();
return;
}
intent.putExtra("id", flightInfoTag.getId());
startActivityForResult(intent, 0);
}
// 选中航班
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
flightInfoTag = flightList.get(position);
binding.loadMainJieguiQty.setText(flightInfoTag.getJieguiQty());
// 添加输入框
binding.loadMainFlightCode.setText(flightInfoTag.getFlightCode());
// 查询货框
@ -219,15 +226,32 @@ public class LoadMainActivity extends BaseActivity implements AddFlightDialog.Ad
private void selectCargo() {
cargoInfoList = LitePal.where("flightId = ? ",
String.valueOf(flightInfoTag.getId())).find(CargoInfo.class);
AtomicInteger tag = new AtomicInteger();
if (!cargoInfoList.isEmpty()) {
cargoInfoList.forEach(cargoInfo -> {
int countNum = LitePal.where("cargoId = ? and type ='正常' and (state IS NULL or state = '修改')", String.valueOf(cargoInfo.getId())).count(LoadOperation.class);
cargoInfo.setCount(countNum);
tag.addAndGet(countNum);
});
}
cargoQty.set(cargoInfoList.size());
loadQty.set(tag.intValue());
cargoInfoAdapter.setList(cargoInfoList);
cargoInfoAdapter.notifyDataSetChanged();
}
private Intent intent; // 跳转扫描界面
public void clickCargoInfo(View view) {
if (flightInfoTag == null) {
Toast.makeText(this, "没有选择航班", Toast.LENGTH_SHORT).show();
return;
}
if (cargoInfoList == null || cargoInfoList.isEmpty()) {
Toast.makeText(this, "没有添加装载单元", Toast.LENGTH_SHORT).show();
return;
}
intent.putExtra("id", flightInfoTag.getId());
startActivityForResult(intent, 0);
}
}

@ -1,13 +1,17 @@
package com.example.as_trak;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import android.annotation.SuppressLint;
import android.content.DialogInterface;
import android.content.res.Resources;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.PixelCopy;
import android.view.View;
import android.widget.Toast;
@ -27,22 +31,21 @@ import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
public class LoadScanActivity extends BaseActivity implements CargoListAdapter.CargoInfoCall, LoadInfoAdapter.LoadInfoCall {
public class LoadScanActivity extends BaseActivity implements CargoListAdapter.CargoInfoCall, LoadInfoAdapter.LoadInfoCall, View.OnLongClickListener {
private List<CargoInfo> cargoInfoList;
private CargoListAdapter adapter;
private List<LoadOperation> loadOperations;
private CargoInfo cargoInfoTag;
private FlightInfo flightInfo;
private LoadToast loadToast;
private LoadInfoAdapter loadInfoAdapter;
// 定义时间格式
private DateTimeFormatter formatter;
private UpdataDialog updataDialog;
// 装载完成对话框
private AlertDialog.Builder alertDialog;
private String[] loadStateList;
@RequiresApi(api = Build.VERSION_CODES.O)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -60,6 +63,13 @@ public class LoadScanActivity extends BaseActivity implements CargoListAdapter.C
loadToast = new LoadToast(this);
loadInfoAdapter = new LoadInfoAdapter(this, this);
binding.setAdapter2(loadInfoAdapter);
binding.loadScanSubmit.setOnLongClickListener(this);
initDialog();
}
// 初始化弹窗
@SuppressLint("NotifyDataSetChanged")
private void initDialog() {
loadStateList = getResources().getStringArray(R.array.loadState);
updataDialog = new UpdataDialog(this);
updataDialog.setUpdataDialogCall((code, index) -> {
LoadOperation loadOperation = loadOperations.get(index);
@ -69,11 +79,27 @@ public class LoadScanActivity extends BaseActivity implements CargoListAdapter.C
loadOperation.update(loadOperation.getId());
loadInfoAdapter.notifyDataSetChanged();
});
alertDialog = new AlertDialog.Builder(this);
alertDialog.setTitle("装载完成,选择装载量")
// .setIcon(R.mipmap.ic_launcher)
.setItems(loadStateList, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(LoadScanActivity.this,"装载完成" , Toast.LENGTH_SHORT).show();
cargoInfoTag.setState("装载完成");
cargoInfoTag.update(cargoInfoTag.getId());
cargoInfoTag.setLoadState(loadStateList[which]);
adapter.notifyDataSetChanged();
cargoInfoTag = null;
}
}).setNegativeButton("取消", null).create();
}
// 扫码结果
@SuppressLint("NotifyDataSetChanged")
@RequiresApi(api = Build.VERSION_CODES.O)
@Override
public void sanCodeResult(String code) {
super.sanCodeResult(code);
@ -81,9 +107,7 @@ public class LoadScanActivity extends BaseActivity implements CargoListAdapter.C
Toast.makeText(this, "没有选择装载单元", Toast.LENGTH_SHORT).show();
return;
}
int count = LitePal.where("flightId= ? and luggageCode=? and (state IS NULL or state = '修改') ",
String.valueOf(flightInfo.getId()), code).count(LoadOperation.class);
int count = LitePal.where("flightId= ? and luggageCode=? and (state IS NULL or state = '修改') ", String.valueOf(flightInfo.getId()), code).count(LoadOperation.class);
if (count > 0) {
loadToast.show("行李条码重复");
return;
@ -99,11 +123,10 @@ public class LoadScanActivity extends BaseActivity implements CargoListAdapter.C
// loadOperation.setUser();
String formattedTime = LocalTime.now().format(formatter); // 格式化当前时间
loadOperation.setLoadTime(formattedTime);
loadOperation.setType("正常");
loadOperation.setType("装载");
loadOperation.save();
loadOperations.add(loadOperation);
loadInfoAdapter.notifyDataSetChanged();
int size = loadOperations.size();
Log.e("TAG", "更新的id:" + cargoInfoTag.getId() + "数量:" + size);
cargoInfoTag.setCount(size);
@ -115,12 +138,9 @@ public class LoadScanActivity extends BaseActivity implements CargoListAdapter.C
// 点击箱子
@Override
public void clickCargoInfo(int index) {
cargoInfoTag = cargoInfoList.get(index);
// Log.e("TAG", "clickCargoInfo:" + cargoInfoTag.toString());
loadOperations = LitePal.where("cargoId =? and type = ? and (state IS NULL or state = '修改') ",
String.valueOf(cargoInfoTag.getId()), "正常")
.find(LoadOperation.class);
loadOperations = LitePal.where("cargoId =? and type = ? and (state IS NULL or state = '修改') ", String.valueOf(cargoInfoTag.getId()), "正常").find(LoadOperation.class);
loadInfoAdapter.setList(loadOperations);
loadInfoAdapter.notifyDataSetChanged();
}
@ -143,7 +163,6 @@ public class LoadScanActivity extends BaseActivity implements CargoListAdapter.C
loadOperation.setState("删除");
loadOperation.update(loadOperation.getId());
loadOperations.remove(index);
cargoInfoTag.setCount(loadOperations.size());
cargoInfoTag.update(cargoInfoTag.getId());
loadInfoAdapter.notifyDataSetChanged();
@ -154,17 +173,18 @@ public class LoadScanActivity extends BaseActivity implements CargoListAdapter.C
CargoInfo cargoInfo = new CargoInfo();
cargoInfo.setState("装载中");
cargoInfo.updateAll();
}
// 装载完毕
@Override
@SuppressLint("NotifyDataSetChanged")
public void loadOver(View view) {
public boolean onLongClick(View v) {
if (cargoInfoTag == null) {
return;
return false;
}
cargoInfoTag.setState("装载完成");
cargoInfoTag.update(cargoInfoTag.getId());
adapter.notifyDataSetChanged();
cargoInfoTag = null;
alertDialog.show();
return true;
}
}

@ -20,6 +20,7 @@ public class CargoInfoAdapter extends RecyclerView.Adapter<CargoInfoAdapter.MyVi
private LayoutInflater inflater;
private List<CargoInfo> list;
private CargoInfoCall call;
public CargoInfoAdapter(Context context, CargoInfoCall call) {
this.context = context;
inflater = LayoutInflater.from(context);
@ -41,9 +42,12 @@ public class CargoInfoAdapter extends RecyclerView.Adapter<CargoInfoAdapter.MyVi
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
ItemCargoBinding binding = holder.binding;
binding.setData(list.get(position));
binding.itemCargoD.setOnClickListener(v -> call.deleteCargoInfo(position));
binding.itemCargoU.setOnClickListener(v -> call.updateCargoInfo(position));
// binding.itemCargoC.setOnClickListener(v -> call.clickCargoInfo(position));
// binding.itemCargoD.setOnClickListener(v -> call.deleteCargoInfo(position));
// binding.itemCargoU.setOnClickListener(v -> call.updateCargoInfo(position));
binding.itemCargoC.setOnLongClickListener(v -> {
call.longClickCargoInfo(position);
return true;
});
}
@Override
@ -64,8 +68,7 @@ public class CargoInfoAdapter extends RecyclerView.Adapter<CargoInfoAdapter.MyVi
}
public interface CargoInfoCall {
void updateCargoInfo(int index);
void deleteCargoInfo(int index);
void longClickCargoInfo(int index);
}
}

@ -27,6 +27,7 @@ public class CargoListAdapter extends RecyclerView.Adapter<CargoListAdapter.MyVi
private CargoInfoCall call;
private List<Boolean> bgList;
private int tag = -1;
public CargoListAdapter(Context context, CargoInfoCall call) {
this.context = context;
inflater = LayoutInflater.from(context);
@ -58,19 +59,15 @@ public class CargoListAdapter extends RecyclerView.Adapter<CargoListAdapter.MyVi
TextView itemCargoCode = binding.itemCargoCode;
CargoInfo cargoInfo = list.get(position);
itemCargoCode.setText(cargoInfo.getCargoCode());
if (bgList.get(position)) {
itemCargoCode.setBackgroundResource(R.drawable.item_click_bg);
} else {
if (cargoInfo.getState().equals("装载完成")) {
itemCargoCode.setBackgroundResource(R.drawable.item_over);
return;
}
if (bgList.get(position)){
itemCargoCode.setBackgroundResource(R.drawable.item_click_bg);
}else {
itemCargoCode.setBackgroundResource(R.drawable.select_bg);
}
itemCargoCode.setOnClickListener(v -> {
if (tag != -1) {
bgList.set(tag, false);

@ -17,9 +17,20 @@ public class CargoInfo extends LitePalSupport {
*
*/
private String state;
// 装载量
private String loadState;
private int count;
public String getLoadState() {
return loadState;
}
public void setLoadState(String loadState) {
this.loadState = loadState;
}
public int getCount() {
return count;
}

@ -31,6 +31,17 @@ public class FlightInfo extends LitePalSupport {
*/
private Date createTime;
private String jieguiQty;
public String getJieguiQty() {
return jieguiQty;
}
public void setJieguiQty(String jieguiQty) {
this.jieguiQty = jieguiQty;
}
public int getId() {
return id;
}

@ -2,6 +2,7 @@ package com.example.as_trak.fragment;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
@ -15,6 +16,7 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ListPopupWindow;
import android.widget.Toast;
import com.example.as_trak.R;
@ -30,18 +32,17 @@ import java.util.stream.IntStream;
public class LuggageFragment extends Fragment implements View.OnLongClickListener {
private FragmentLuggageBinding binding;
private LuggageBeen luggageBeen;
private LoadOperation loadOperationFrist;
private AlertDialog.Builder builder;
@SuppressLint("ClickableViewAccessibility")
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
binding = DataBindingUtil.inflate(inflater, R.layout.fragment_luggage, container, false);
FragmentLuggageBinding binding = DataBindingUtil.inflate(inflater, R.layout.fragment_luggage, container, false);
Bundle bundle = this.getArguments(); // 得到从Activity传来的数据
String mess = null;
luggageBeen = new LuggageBeen();
if (bundle != null) {
mess = bundle.getString("data");
@ -49,11 +50,10 @@ public class LuggageFragment extends Fragment implements View.OnLongClickListene
luggageBeen.setVisbleState(true);
}
}
builder = new AlertDialog.Builder(getContext());
Context context = getContext();
builder = new AlertDialog.Builder(context);
builder.setTitle("拉下确认").setMessage("是否确定拉下行李").setNegativeButton("取消", null);
binding.setData(luggageBeen);
EditText loadMainFlightCode = binding.loadMainFlightCode;
loadMainFlightCode.setOnTouchListener((v, event) -> {
final int DRAWABLE_RIGHT = 2;
@ -73,17 +73,15 @@ public class LuggageFragment extends Fragment implements View.OnLongClickListene
}
return false;
});
binding.luggageUnLoad.setOnLongClickListener(this);
return binding.getRoot();
}
// 点击查询
private void selectInfo(String code) {
loadOperationFrist = LitePal
.where("luggageCode like ? and (state IS NULL or state = '修改')", code+"%")
.order("loadTime desc").findFirst(LoadOperation.class);
loadOperationFrist = LitePal.where("luggageCode like ? and (state IS NULL or state = '修改')", code + "%").order("loadTime desc").findFirst(LoadOperation.class);
if (loadOperationFrist == null) {
Toast.makeText(getContext(), "查询失败,条码错误", Toast.LENGTH_SHORT).show();
luggageBeen.clear();
@ -94,17 +92,22 @@ public class LuggageFragment extends Fragment implements View.OnLongClickListene
luggageBeen.setState(loadOperationFrist.getType());
luggageBeen.setLoadTime(loadOperationFrist.getLoadTime());
luggageBeen.setLuggageCode(loadOperationFrist.getLuggageCode());
List<LoadOperation> loadOperationList = LitePal.where("flightId = ? and cargoId = ? and (state IS NULL or state = '修改') ", String.valueOf(loadOperationFrist.getFlightId()), String.valueOf(loadOperationFrist.getCargoId())).order("id asc").find(LoadOperation.class);
Log.e("TAG", "全部数据:" + loadOperationList.toString());
FlightInfo flightInfo = LitePal.where("id=?", String.valueOf(loadOperationFrist.getFlightId())).findFirst(FlightInfo.class);
List<LoadOperation> loadOperationList =
LitePal.where("flightId = ? and cargoId = ? and (state IS NULL or state = '修改') ",
String.valueOf(loadOperationFrist.getFlightId()), String.valueOf(loadOperationFrist.getCargoId()))
.order("id asc").find(LoadOperation.class);
FlightInfo flightInfo =
LitePal.where("id=?", String.valueOf(loadOperationFrist.getFlightId())).findFirst(FlightInfo.class);
luggageBeen.setTakeoffDate(flightInfo.getTakeoffDate());
IntStream.range(0, loadOperationList.size()).filter(i -> loadOperationList.get(i).getLuggageCode().equals(code)).findFirst().ifPresent(i -> luggageBeen.setOrderNum(String.valueOf(i + 1)));
IntStream.range(0, loadOperationList.size())
.filter(i -> loadOperationList.get(i).getLuggageCode().equals(code))
.findFirst()
.ifPresent(i -> luggageBeen.setOrderNum(String.valueOf(i + 1)));
}
// 长按按钮弹窗
@Override
public boolean onLongClick(View v) {
if (loadOperationFrist == null) {
return false;
}

@ -114,11 +114,13 @@ public class LuggageBeen extends BaseObservable {
public void clear() {
flightCode = null;
luggageCode = null;
takeoffTime = null;
takeoffDate = null;
cargoCode = null;
orderNum = null;
loadTime = null;
State = null;
notifyChange();
}

@ -8,19 +8,34 @@
<variable
name="title"
type="String" />
<variable
name="visibState"
type="androidx.databinding.ObservableBoolean" />
<import type="android.view.View" />
<variable
name="adapter"
type="com.example.as_trak.adapter.CargoInfoAdapter" />
<variable
name="list1"
type="java.util.List" /> <variable
type="java.util.List" />
<variable
name="list2"
type="java.util.List" />
<variable
name="qty1"
type="androidx.databinding.ObservableInt" />
<variable
name="qty2"
type="androidx.databinding.ObservableInt" />
</data>
<LinearLayout
@ -49,15 +64,16 @@
<TextView
android:id="@+id/load_main_flight_code"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="38dp"
android:layout_gravity="center"
android:gravity="center"
android:textSize="18sp"
android:layout_weight="1"
android:paddingRight="10dp"
android:drawableRight="@mipmap/ic_select"
android:background="@drawable/select_bg" />
android:background="@drawable/select_bg"
android:gravity="center"
android:paddingEnd="10dp"
android:textSize="18sp"
app:drawableRightCompat="@mipmap/ic_select"
tools:ignore="RtlSymmetry" />
<ImageButton
android:layout_width="50dp"
@ -68,43 +84,42 @@
android:src="@mipmap/icon_add" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="12dp"
android:layout_weight="1"
android:background="@drawable/main_menu_bg"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="51dp">
android:layout_height="51dp"
android:layout_marginTop="8dp"
android:background="@drawable/main_menu_bg">
<Spinner
android:id="@+id/load_main_cargo_code0"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textAlignment="center"
android:visibility="@{visibState?View.GONE:View.VISIBLE}"
android:entries="@{list1}"
/>
android:textAlignment="center"
android:visibility="@{visibState?View.GONE:View.VISIBLE}" />
<EditText
android:id="@+id/load_main_cargo_code"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="45dp"
android:layout_gravity="center"
android:layout_marginStart="10dp"
android:background="@drawable/select_bg"
android:maxLines="1"
android:inputType="text"
android:layout_weight="1"
android:visibility="@{visibState?View.GONE:View.VISIBLE}"
android:gravity="center" />
android:background="@drawable/select_bg"
android:gravity="center"
android:inputType="text"
android:maxLines="1"
android:visibility="@{visibState?View.GONE:View.VISIBLE}" />
<Spinner
android:id="@+id/load_main_cargo_code2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textAlignment="center"
android:visibility="@{visibState?View.GONE:View.VISIBLE}"
android:entries="@{list2}"
/>
android:textAlignment="center"
android:visibility="@{visibState?View.GONE:View.VISIBLE}" />
<TextView
android:layout_width="55dp"
android:layout_height="30dp"
@ -112,11 +127,11 @@
android:layout_marginStart="5dp"
android:background="@drawable/button_add"
android:gravity="center"
android:onClick="loadAddCargo"
android:text="添加"
android:visibility="@{visibState?View.GONE:View.VISIBLE}"
android:textColor="@color/white"
android:textSize="15sp"
android:onClick="loadAddCargo"/>
android:visibility="@{visibState?View.GONE:View.VISIBLE}" />
<ImageButton
android:layout_width="40dp"
@ -125,46 +140,124 @@
android:layout_marginStart="10dp"
android:layout_marginEnd="5dp"
android:background="@color/white"
android:visibility="@{visibState?View.GONE:View.VISIBLE}"
android:onClick="loadCloseEdit"
android:src="@mipmap/icon_left"
android:onClick="loadCloseEdit"/>
android:visibility="@{visibState?View.GONE:View.VISIBLE}" />
<TextView
android:layout_width="wrap_content"
android:layout_height="51dp"
android:layout_marginStart="10dp"
android:drawableRight="@mipmap/icon_right"
android:gravity="center"
android:onClick="loadAddEdit"
android:text="装载单元信息"
android:visibility="@{visibState?View.VISIBLE:View.GONE}"
android:textSize="18sp"
android:onClick="loadAddEdit"/>
android:visibility="@{visibState?View.VISIBLE:View.GONE}"
app:drawableEndCompat="@mipmap/icon_right" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/empty_color" />
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="0dp"
android:layout_marginTop="1dp"
android:layout_weight="1"
android:adapter="@{adapter}"
android:background="@drawable/main_menu_bg"
android:padding="10dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginTop="1dp"
android:background="@drawable/main_menu_bg">
<TextView
android:layout_width="82dp"
android:layout_height="match_parent"
android:gravity="center"
android:text="结柜数量:"
android:textSize="16sp" />
<EditText
android:id="@+id/load_main_jieguiQty"
android:layout_width="80dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@drawable/select_bg"
android:gravity="center"
android:inputType="number"
android:maxLines="1" />
<TextView
android:layout_width="55dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:layout_marginStart="5dp"
android:background="@drawable/button_add"
android:gravity="center"
android:onClick="saveNumber"
android:text="保存"
android:textColor="@color/white"
android:textSize="15sp" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:text="总装载单元数量:"
android:textSize="16sp" />
<TextView
android:layout_width="50dp"
android:layout_height="match_parent"
android:gravity="center"
android:text="@{String.valueOf(qty1)}" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginTop="1dp"
android:background="@drawable/main_menu_bg">
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:text="已装载行李数量:"
android:textSize="16sp" />
<TextView
android:layout_width="50dp"
android:layout_height="match_parent"
android:gravity="center"
android:text="@{String.valueOf(qty2)}" />
</LinearLayout>
<Button
android:layout_width="match_parent"
android:layout_height="48dp"
android:text="装载行李"
android:textStyle="bold"
android:textSize="18sp"
android:layout_margin="12dp"
android:letterSpacing="0.5"
android:onClick="clickCargoInfo"
android:layout_margin="12dp"/>
android:text="装载行李"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
</layout>

@ -4,15 +4,19 @@
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="title"
type="String" />
<variable
name="data"
type="com.example.as_trak.entity.FlightInfo" />
<variable
name="adapter1"
type="com.example.as_trak.adapter.CargoListAdapter" />
<variable
name="adapter2"
type="com.example.as_trak.adapter.LoadInfoAdapter" />
@ -21,8 +25,8 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:animateLayoutChanges="true"
android:orientation="vertical"
tools:context=".LoadScanActivity">
<include
@ -42,7 +46,13 @@
android:gravity="center"
android:text="@{data.flightCode}"
android:textSize="20sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="@{data.takeoffDate + data.takeoffTime}"
android:textSize="20sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -51,13 +61,7 @@
android:text="@{data.destination}"
android:textSize="20sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="@{data.takeoffTime}"
android:textSize="20sp" />
</LinearLayout>
<RelativeLayout
@ -99,6 +103,7 @@
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="#e1e1e1" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -153,8 +158,8 @@
android:layout_below="@+id/sanLin"
android:layout_alignParentBottom="true"
android:layout_marginTop="0dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:adapter="@{adapter1}"/>
android:adapter="@{adapter1}"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<View
android:layout_width="1dp"
@ -167,39 +172,45 @@
<androidx.recyclerview.widget.RecyclerView
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_above="@+id/load_scan_submit"
android:layout_alignTop="@+id/scan_r1"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_toEndOf="@+id/scan_r1"
android:layout_marginStart="1dp"
android:layout_marginBottom="10dp"
android:layout_toEndOf="@+id/scan_r1"
android:adapter="@{adapter2}"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<Button
android:id="@+id/load_scan_submit"
android:layout_width="150dp"
android:layout_height="48dp"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:layout_marginEnd="62dp"
android:layout_marginBottom="13dp"
android:letterSpacing="0.1"
android:text="装载完毕"
android:textSize="19sp"
android:textStyle="bold" />
</RelativeLayout>
<Button
android:layout_width="300dp"
android:layout_height="48dp"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:text="装载完毕"
android:textSize="19sp"
android:textStyle="bold"
android:onClick="loadOver"
android:letterSpacing="0.5" />
<Button
android:layout_width="300dp"
android:layout_height="48dp"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:letterSpacing="0.5"
android:onClick="loadOverupdate"
android:text="update"
android:textSize="19sp"
android:textStyle="bold"
android:onClick="loadOverupdate"
android:visibility="gone"
android:letterSpacing="0.5" />
android:visibility="gone" />
</LinearLayout>
</layout>

@ -27,9 +27,8 @@
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_height="25dp"
android:layout_gravity="center"
android:background="#e1e1e1" />
<TextView
@ -42,9 +41,8 @@
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_height="25dp"
android:layout_gravity="center"
android:background="#e1e1e1" />
<TextView
@ -54,28 +52,16 @@
android:text="@{data.state}"
android:textSize="15sp" />
<View
android:layout_width="1dp"
android:layout_height="25dp"
android:layout_gravity="center"
android:background="#e1e1e1" />
<TextView
android:id="@+id/item_cargo_u"
android:layout_width="50dp"
android:layout_height="30dp"
android:background="@drawable/button_update"
android:layout_width="90dp"
android:layout_height="match_parent"
android:gravity="center"
android:text="修改"
android:textColor="@color/white"
android:visibility="gone"
android:textSize="15sp" />
<TextView
android:id="@+id/item_cargo_d"
android:layout_width="50dp"
android:layout_height="30dp"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:background="@drawable/button_delete"
android:gravity="center"
android:text="删除"
android:textColor="@color/white"
android:text="@{data.loadState}"
android:textSize="15sp" />
</LinearLayout>

@ -14,9 +14,9 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/select_bg"
android:textStyle="bold"
android:gravity="center"
android:textSize="15sp"
android:textSize="16sp"
android:textColor="@color/black"/>
</LinearLayout>
</layout>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="loadState">
<item>C0</item>
<item>C1</item>
<item>C2</item>
<item>C3</item>
<item>C4</item>
</string-array>
</resources>
Loading…
Cancel
Save