修改完成

master
wanghao 5 days ago
parent a45040d9df
commit 6c60c1c85b

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<litepal>
<dbname value="AS_TRAK" />
<version value="5" />
<version value="6" />
<list>
<mapping class="com.example.as_trak.entity.LoadOperation"/>
<mapping class="com.example.as_trak.entity.CargoInfo"/>

@ -47,6 +47,7 @@ public class LoadMainActivity extends BaseActivity implements AddFlightDialog.Ad
private ObservableInt loadQty;
private androidx.appcompat.app.AlertDialog.Builder alertDialog;
private String[] loadStateList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -64,25 +65,17 @@ public class LoadMainActivity extends BaseActivity implements AddFlightDialog.Ad
loadQty = new ObservableInt();
binding.setQty1(cargoQty);
binding.setQty2(loadQty);
builder = new AlertDialog.Builder(this);
builder.setTitle("删除确认").setMessage("是否确定删除装载单元").setNegativeButton("取消", null);
initAlertDialog();
}
private void initAlertDialog() {
builder = new AlertDialog.Builder(this);
builder.setTitle("删除确认").setMessage("是否确定删除装载单元").setNegativeButton("取消", null);
loadStateList = getResources().getStringArray(R.array.loadState);
alertDialog = new androidx.appcompat.app.AlertDialog.Builder(this);
alertDialog.setTitle("选择装载量")
.setItems(loadStateList, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(LoadMainActivity.this, "装载完成", Toast.LENGTH_SHORT).show();
}
}).setNegativeButton("取消", null).create();
.setNegativeButton("取消", null).create();
}
// 初始化航班添加
@ -161,11 +154,13 @@ public class LoadMainActivity extends BaseActivity implements AddFlightDialog.Ad
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());
Toast.makeText(this, "保存成功", Toast.LENGTH_SHORT).show();
}
// 关闭货箱添加
public void loadCloseEdit(View view) {
visibState.set(true);
@ -217,9 +212,23 @@ public class LoadMainActivity extends BaseActivity implements AddFlightDialog.Ad
}
}).show();
}
// 修改装载量
@Override
public void updateState(int index) {
CargoInfo cargoInfo = cargoInfoList.get(index);
alertDialog.setItems(loadStateList, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
cargoInfo.setLoadState(loadStateList[which]);
cargoInfo.update(cargoInfo.getId());
cargoInfoAdapter.notifyItemChanged(index);
}
}).show();
}
// 选中航班
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
@ -247,7 +256,7 @@ public class LoadMainActivity extends BaseActivity implements AddFlightDialog.Ad
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);
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);
});

@ -81,6 +81,7 @@ public class LoadScanActivity extends BaseActivity implements CargoListAdapter.C
loadOperation.setState("修改");
loadOperation.update(loadOperation.getId());
loadInfoAdapter.notifyDataSetChanged();
updataDialog.dismiss();
});
tipDialog = new TipDialog(this);
alertDialog=new AlertDialog.Builder(this);
@ -158,6 +159,10 @@ public class LoadScanActivity extends BaseActivity implements CargoListAdapter.C
@SuppressLint("NotifyDataSetChanged")
@Override
public void updateCargoInfo(int index) {
if (cargoInfoTag.getState().equals("装载完成")) {
Toast.makeText(this, "装载单元已经装载完成", Toast.LENGTH_SHORT).show();
return;
}
LoadOperation loadOperation = loadOperations.get(index);
updataDialog.setIndex(index);
updataDialog.setCode(loadOperation.getLuggageCode());
@ -168,6 +173,10 @@ public class LoadScanActivity extends BaseActivity implements CargoListAdapter.C
@SuppressLint("NotifyDataSetChanged")
@Override
public void deleteCargoInfo(int index) {
if (cargoInfoTag.getState().equals("装载完成")) {
Toast.makeText(this, "装载单元已经装载完成", Toast.LENGTH_SHORT).show();
return;
}
LoadOperation loadOperation = loadOperations.get(index);
loadOperation.setState("删除");
loadOperation.update(loadOperation.getId());

@ -33,7 +33,7 @@ public class SettingActivity extends BaseActivity implements EditDialog.EditDial
adapter = new ContainerTypesAdapter(this, this);
adapterSetList("1");
binding.setAdapter(adapter);
type="1";
binding.infoTabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@SuppressLint("NotifyDataSetChanged")
@Override

@ -43,7 +43,7 @@ public class CargoInfoAdapter extends RecyclerView.Adapter<CargoInfoAdapter.MyVi
ItemCargoBinding binding = holder.binding;
binding.setData(list.get(position));
// binding.itemCargoD.setOnClickListener(v -> call.deleteCargoInfo(position));
// binding.itemCargoU.setOnClickListener(v -> call.updateCargoInfo(position));
binding.itemCargoState.setOnClickListener(v -> call.updateState(position));
binding.itemCargoC.setOnLongClickListener(v -> {
call.longClickCargoInfo(position);
return true;
@ -69,6 +69,7 @@ public class CargoInfoAdapter extends RecyclerView.Adapter<CargoInfoAdapter.MyVi
public interface CargoInfoCall {
void longClickCargoInfo(int index);
void updateState(int index);
}
}

@ -40,11 +40,11 @@ public class LoadListAdapter extends RecyclerView.Adapter<LoadListAdapter.MyView
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
ItemOpinListBinding binding = holder.binding;
LoadOperation data = list.get(position);
if (data.getType().equals("拉下")){
/* if (data.getType().equals("拉下")){
binding.itemOpinLinear.setBackgroundResource(R.drawable.button_delete);
}else {
binding.itemOpinLinear.setBackgroundResource(R.drawable.main_menu_bg);
}
}*/
// data.setOrderNum(position+1);
binding.setData(data);

@ -42,6 +42,7 @@ public class LoadOperation extends LitePalSupport {
*
*/
private String loadTime;
private String unLoadTime;
/**
*
*/
@ -52,6 +53,13 @@ public class LoadOperation extends LitePalSupport {
private String state;
public String getUnLoadTime() {
return unLoadTime;
}
public void setUnLoadTime(String unLoadTime) {
this.unLoadTime = unLoadTime;
}
public int getCargoId() {
return cargoId;

@ -81,7 +81,6 @@ public class FlightInfoFragment extends Fragment implements AdapterView.OnItemCl
binding = DataBindingUtil.inflate(inflater, R.layout.fragment_flight_info, container, false);
adapter = new LoadListAdapter(getContext());
binding.setAdapter(adapter);
lpw = new ListPopupWindow(context);
lpw.setAnchorView(binding.loadMainFlightCode);
// 航班查询
@ -111,7 +110,7 @@ public class FlightInfoFragment extends Fragment implements AdapterView.OnItemCl
tagId = String.valueOf(flightInfo.getId());
int countCargo = LitePal.where("flightId= ?", tagId).count(CargoInfo.class);
binding.loadCountCargo.setText(String.valueOf(countCargo));
int countOperation = LitePal.where("flightId= ? and type='正常' and (state IS NULL or state = '修改') "
int countOperation = LitePal.where("flightId= ? and type='装载' and (state IS NULL or state = '修改') "
, tagId).count(LoadOperation.class);
binding.loadCountLuggage.setText(String.valueOf(countOperation));
List<LoadOperation> list = LitePal.where("flightId= ? and (state IS NULL or state = '修改')"
@ -139,7 +138,7 @@ public class FlightInfoFragment extends Fragment implements AdapterView.OnItemCl
// 创建表头
Row headerRow = sheet.createRow(0);
String[] headers = {"序号", "航班号", "目的地代码", "起飞时间", "货箱号", "行李编码", "旧的行李编码", "操作人", "装载时间", "操作类型", "状态"};
String[] headers = {"序号", "航班号", "目的地代码", "起飞时间", "货箱号", "行李编码", "旧的行李编码", "操作人", "装载时间", "操作","拉下时间", "状态"};
for (int i = 0; i < headers.length; i++) {
Cell cell = headerRow.createCell(i);
cell.setCellValue(headers[i]);
@ -170,7 +169,8 @@ public class FlightInfoFragment extends Fragment implements AdapterView.OnItemCl
row.createCell(7).setCellValue(loadOperation.getUser());
row.createCell(8).setCellValue(loadOperation.getLoadTime());
row.createCell(9).setCellValue(loadOperation.getType());
row.createCell(10).setCellValue(loadOperation.getState());
row.createCell(10).setCellValue(loadOperation.getUnLoadTime());
row.createCell(11).setCellValue(loadOperation.getState());
}
// 使用 MediaStore 存储文件

@ -27,6 +27,10 @@ import com.example.as_trak.fragment.been.LuggageBeen;
import org.litepal.LitePal;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List;
import java.util.stream.IntStream;
@ -91,30 +95,26 @@ public class LuggageFragment extends Fragment implements View.OnLongClickListene
luggageBeen.setCargoCode(loadOperationFrist.getCargoCode());
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);
FlightInfo flightInfo =
LitePal.where("id=?", String.valueOf(loadOperationFrist.getFlightId())).findFirst(FlightInfo.class);
String luggageCode = loadOperationFrist.getLuggageCode();
luggageBeen.setLuggageCode(luggageCode);
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(luggageCode)).findFirst().ifPresent(i -> luggageBeen.setOrderNum(String.valueOf(i + 1)));
}
// 长按按钮弹窗
@Override
public boolean onLongClick(View v) {
if (loadOperationFrist == null) {
if (loadOperationFrist == null || loadOperationFrist.getType().equals("拉下")) {
return false;
}
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
loadOperationFrist.setType("拉下");
loadOperationFrist.setUnLoadTime(LocalTime.now().format(DateTimeFormatter.ofPattern("HH:mm")));
loadOperationFrist.update(loadOperationFrist.getId());
Toast.makeText(getContext(), "拉下成功", Toast.LENGTH_SHORT).show();
luggageBeen.setState("拉下");

@ -114,7 +114,7 @@
<Spinner
android:id="@+id/load_main_cargo_code2"
android:layout_width="wrap_content"
android:layout_width="90dp"
android:layout_height="match_parent"
android:entries="@{list2}"
android:textAlignment="center"

@ -28,7 +28,7 @@
android:gravity="center"
android:layout_gravity="center"
android:lines="1"
android:inputType="text"
android:inputType="textCapWords"
android:maxLines="1" />
<LinearLayout

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="adapter"
type="com.example.as_trak.adapter.LoadListAdapter" />
@ -34,12 +35,13 @@
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginEnd="10dp"
android:layout_weight="1"
android:background="@drawable/select_bg"
android:drawableRight="@mipmap/ic_select"
android:layout_weight="1"
android:gravity="center"
android:paddingEnd="10dp"
android:textSize="18sp" />
<TextView
android:id="@+id/import_load_info"
android:layout_width="50dp"
@ -138,11 +140,11 @@
<TextView
android:layout_width="60dp"
android:layout_width="80dp"
android:layout_height="match_parent"
android:gravity="center"
android:text="装载时间"
android:textSize="15sp" />
android:text=""
android:textSize="18sp" />
<View
android:layout_width="1dp"
@ -150,28 +152,12 @@
android:background="#e1e1e1" />
<TextView
android:layout_width="50dp"
android:layout_width="60dp"
android:layout_height="match_parent"
android:gravity="center"
android:text="状态"
android:text="时间"
android:textSize="18sp" />
<!-- <View-->
<!-- android:layout_width="1dp"-->
<!-- android:layout_height="match_parent"-->
<!-- android:background="#e1e1e1" />-->
<!-- <TextView-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_weight="1"-->
<!-- android:gravity="center"-->
<!-- android:text="操作"-->
<!-- android:textSize="18sp" />-->
</LinearLayout>

@ -58,6 +58,7 @@
android:layout_gravity="center"
android:background="#e1e1e1" />
<TextView
android:id="@+id/item_cargo_state"
android:layout_width="90dp"
android:layout_height="match_parent"
android:gravity="center"

@ -1,82 +1,134 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<data
android:layout_width="5dp"
android:layout_height="4dp">
<variable
name="data"
type="com.example.as_trak.entity.LoadOperation" />
<import type="android.view.View" />
</data>
<LinearLayout
android:id="@+id/item_opin_linear"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_height="wrap_content"
android:layout_marginTop="1dp"
android:background="@drawable/main_menu_bg">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="@{data.cargoCode}"
android:textSize="18sp" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#e1e1e1" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="@{data.luggageCode}"
android:textSize="18sp" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#e1e1e1" />
<TextView
android:layout_width="60dp"
android:layout_height="match_parent"
android:gravity="center"
android:text="@{data.loadTime}"
android:textSize="18sp" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#e1e1e1" />
<TextView
android:layout_width="50dp"
android:layout_height="match_parent"
android:gravity="center"
android:text="@{data.type}"
android:textSize="18sp" />
<!-- <View-->
<!-- android:layout_width="1dp"-->
<!-- android:layout_height="match_parent"-->
<!-- android:background="#e1e1e1" />-->
<!-- <TextView-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_weight="1"-->
<!-- android:gravity="center"-->
<!-- android:text="@{data.state}"-->
<!-- android:textSize="18sp" />-->
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginTop="1dp"
android:background="@drawable/button_update">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="@{data.cargoCode}"
android:textSize="18sp" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#e1e1e1" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="@{data.luggageCode}"
android:textSize="18sp" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#e1e1e1" />
<TextView
android:layout_width="80dp"
android:layout_height="match_parent"
android:gravity="center"
android:text="装载时间:"
android:textSize="18sp" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#e1e1e1" />
<TextView
android:layout_width="60dp"
android:layout_height="match_parent"
android:gravity="center"
android:text="@{data.loadTime}"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginTop="1dp"
android:visibility='@{data.type.equals("拉下")?View.VISIBLE:View.GONE}'
android:background="@drawable/button_delete">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="@{data.cargoCode}"
android:textSize="18sp" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#e1e1e1" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="@{data.luggageCode}"
android:textSize="18sp" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#e1e1e1" />
<TextView
android:layout_width="80dp"
android:layout_height="match_parent"
android:gravity="center"
android:text="拉下时间:"
android:textSize="18sp" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#e1e1e1" />
<TextView
android:layout_width="60dp"
android:layout_height="match_parent"
android:gravity="center"
android:text="@{data.unLoadTime}"
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>
</layout>
Loading…
Cancel
Save