逻辑修改

This commit is contained in:
2024-07-08 16:39:36 +08:00
parent c66195054a
commit f1908d1fc4
13 changed files with 198 additions and 38 deletions

View File

@@ -11,6 +11,9 @@ pub(crate) struct ExcelService {
}
impl ExcelService {
pub fn get_current_line(&self) -> usize {
return self.current_line;
}
pub fn new(file_path: &str) -> Result<Self, String> {
let mut work_book: Xlsx<_> = match open_workbook(file_path) {
Ok(work_book) => work_book,
@@ -57,10 +60,10 @@ impl ExcelService {
}
work_model.imei = imei.to_string();
}
if let Some(sn) = self.sheet.get((self.current_line, 1)){
if let Some(sn) = self.sheet.get((self.current_line, 1)) {
work_model.sn = sn.to_string();
}
if let Some(line_number) = self.sheet.get((self.current_line, 2)){
if let Some(line_number) = self.sheet.get((self.current_line, 2)) {
work_model.line_number = line_number.to_string();
}
self.current_line += 1;