|
|
|
@ -66,8 +66,6 @@ public class FlightInfoFragment extends Fragment implements AdapterView.OnItemCl
|
|
|
|
|
public void onCreate(Bundle savedInstanceState) {
|
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
context = getContext();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
progressDialog = new ProgressDialog(context);
|
|
|
|
|
progressDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
|
|
|
|
progressDialog.setCanceledOnTouchOutside(false);
|
|
|
|
@ -100,13 +98,14 @@ public class FlightInfoFragment extends Fragment implements AdapterView.OnItemCl
|
|
|
|
|
return binding.getRoot();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@SuppressLint("NotifyDataSetChanged")
|
|
|
|
|
@SuppressLint({"NotifyDataSetChanged", "SetTextI18n"})
|
|
|
|
|
@Override
|
|
|
|
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
|
|
|
|
|
|
|
|
FlightInfo flightInfo = flightList.get(position);
|
|
|
|
|
binding.loadMainFlightCode.setText(flightInfo.getFlightCode());
|
|
|
|
|
|
|
|
|
|
binding.loadMainFlightDate.setText(flightInfo.getTakeoffDate());
|
|
|
|
|
binding.loadMainFlightNumber.setText("" + flightInfo.getJieguiQty());
|
|
|
|
|
tagId = String.valueOf(flightInfo.getId());
|
|
|
|
|
int countCargo = LitePal.where("flightId= ?", tagId).count(CargoInfo.class);
|
|
|
|
|
binding.loadCountCargo.setText(String.valueOf(countCargo));
|
|
|
|
@ -127,7 +126,7 @@ public class FlightInfoFragment extends Fragment implements AdapterView.OnItemCl
|
|
|
|
|
progressDialog.show();
|
|
|
|
|
new Thread(() -> {
|
|
|
|
|
// 根据 flightId 查询 LoadOperation 数据
|
|
|
|
|
List<LoadOperation> loadOperations = LitePal.where("flightId = ?", flightId).find(LoadOperation.class);
|
|
|
|
|
List<LoadOperation> loadOperations = LitePal.where("flightId = ? and type='装载' and (state IS NULL or state = '修改') ", flightId).find(LoadOperation.class);
|
|
|
|
|
// 创建新的工作簿
|
|
|
|
|
Workbook workbook = new XSSFWorkbook();
|
|
|
|
|
Sheet sheet = workbook.createSheet("Load Operations");
|
|
|
|
@ -135,10 +134,11 @@ public class FlightInfoFragment extends Fragment implements AdapterView.OnItemCl
|
|
|
|
|
CellStyle headerCellStyle = workbook.createCellStyle();
|
|
|
|
|
headerCellStyle.setAlignment(HorizontalAlignment.CENTER); // 设置水平居中
|
|
|
|
|
headerCellStyle.setVerticalAlignment(VerticalAlignment.CENTER); // 设置垂直居中
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 创建表头
|
|
|
|
|
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]);
|
|
|
|
@ -150,8 +150,6 @@ public class FlightInfoFragment extends Fragment implements AdapterView.OnItemCl
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 填充数据
|
|
|
|
|
int rowNum = 1;
|
|
|
|
|
int index = 0;
|
|
|
|
@ -163,20 +161,15 @@ public class FlightInfoFragment extends Fragment implements AdapterView.OnItemCl
|
|
|
|
|
row.createCell(2).setCellValue(loadOperation.getDestination());
|
|
|
|
|
row.createCell(3).setCellValue(loadOperation.getTakeoffTime());
|
|
|
|
|
row.createCell(4).setCellValue(loadOperation.getCargoCode());
|
|
|
|
|
// row.createCell(5).setCellValue(loadOperation.getOrderNum());
|
|
|
|
|
row.createCell(5).setCellValue(loadOperation.getLuggageCode());
|
|
|
|
|
row.createCell(6).setCellValue(loadOperation.getOldLuggageCode());
|
|
|
|
|
row.createCell(7).setCellValue(loadOperation.getUser());
|
|
|
|
|
row.createCell(8).setCellValue(loadOperation.getLoadTime());
|
|
|
|
|
row.createCell(9).setCellValue(loadOperation.getType());
|
|
|
|
|
row.createCell(10).setCellValue(loadOperation.getUnLoadTime());
|
|
|
|
|
row.createCell(11).setCellValue(loadOperation.getState());
|
|
|
|
|
row.createCell(6).setCellValue(loadOperation.getLoadTime());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 使用 MediaStore 存储文件
|
|
|
|
|
ContentResolver contentResolver = context.getContentResolver();
|
|
|
|
|
ContentValues contentValues = new ContentValues();
|
|
|
|
|
contentValues.put(MediaStore.MediaColumns.DISPLAY_NAME, "行李装载操作信息" + LocalDateTime.now().format(formatter) + ".xlsx");
|
|
|
|
|
contentValues.put(MediaStore.MediaColumns.DISPLAY_NAME, "行李装载信息" + binding.loadMainFlightCode.getText().toString() +" "+
|
|
|
|
|
binding.loadMainFlightDate.getText().toString() + ".xlsx");
|
|
|
|
|
contentValues.put(MediaStore.MediaColumns.MIME_TYPE, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
|
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
|
|
|
|
contentValues.put(MediaStore.MediaColumns.RELATIVE_PATH, Environment.DIRECTORY_DOCUMENTS);
|
|
|
|
|