1.优化合同识别excel报错精确提示

S
This commit is contained in:
weiyunlong 2025-03-19 15:18:04 +08:00
parent ada1632e4d
commit 1f79b84dc3
1 changed files with 10 additions and 8 deletions

View File

@ -34,6 +34,7 @@ import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.operation.DeleteServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper;
import kd.bos.util.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.usermodel.Cell;
@ -342,6 +343,7 @@ public class ContractFormPlugin extends AbstractFormPlugin implements UploadList
contractsummarylist.set("qeug_contractid", this.getModel().getDataEntity().getPkValue().toString());//合同id
contractsummarylist.set("qeug_sheetname", sheet.getSheetName());//sheet名字
for (Cell cell : row) {
int rowNum1 = row.getRowNum() +1;//excel行号
int columnIndex = cell.getColumnIndex();
switch (columnIndex) {
case 0:
@ -371,7 +373,7 @@ public class ContractFormPlugin extends AbstractFormPlugin implements UploadList
BigDecimal results = new BigDecimal(value6);
contractsummarylist.set("qeug_decimalqty", results);
} catch (NumberFormatException e) {
this.getView().showErrorNotification("清单汇总识别--生成明细失败: 数量列格式错误");
this.getView().showErrorNotification("清单汇总识别--生成明细失败: 工程量格式错误,行数:"+ rowNum1);
return;
}
}
@ -383,7 +385,7 @@ public class ContractFormPlugin extends AbstractFormPlugin implements UploadList
BigDecimal results = new BigDecimal(value7);
contractsummarylist.set("qeug_unitprice", results);// 综合单价
} catch (NumberFormatException e) {
this.getView().showErrorNotification("清单汇总识别--生成明细失败: 单价列格式错误");
this.getView().showErrorNotification("清单汇总识别--生成明细失败: 单价列格式错误,行数:"+ rowNum1);
return;
}
}
@ -398,7 +400,7 @@ public class ContractFormPlugin extends AbstractFormPlugin implements UploadList
contractsummarylist.set("qeug_amounttotal", results); // 合计金额
amounttotal = amounttotal.add(results);
} catch (NumberFormatException e) {
this.getView().showErrorNotification("清单汇总识别--生成明细失败: 合计金额列格式错误");
this.getView().showErrorNotification("清单汇总识别--生成明细失败: 合计金额列格式错误,行数:"+ rowNum1);
return;
}
}
@ -409,7 +411,7 @@ public class ContractFormPlugin extends AbstractFormPlugin implements UploadList
try {
contractsummarylist.set("qeug_artificial", new BigDecimal(value9));// 人工单价
} catch (NumberFormatException e) {
this.getView().showErrorNotification("清单汇总识别--生成明细失败: 人工单价列格式错误");
this.getView().showErrorNotification("清单汇总识别--生成明细失败: 人工单价列格式错误,行数:"+ rowNum1);
return;
}
}
@ -420,7 +422,7 @@ public class ContractFormPlugin extends AbstractFormPlugin implements UploadList
try {
contractsummarylist.set("qeug_provisional", new BigDecimal(value10));// 辅材单价
} catch (NumberFormatException e) {
this.getView().showErrorNotification("清单汇总识别--生成明细失败: 辅材单价列格式错误");
this.getView().showErrorNotification("清单汇总识别--生成明细失败: 辅材单价列格式错误,行数:"+ rowNum1);
return;
}
}
@ -431,7 +433,7 @@ public class ContractFormPlugin extends AbstractFormPlugin implements UploadList
try {
contractsummarylist.set("qeug_unitpriceofmainmater", new BigDecimal(value11));// 主材单价
} catch (NumberFormatException e) {
this.getView().showErrorNotification("清单汇总识别--生成明细失败: 主材单价列格式错误");
this.getView().showErrorNotification("清单汇总识别--生成明细失败: 主材单价列格式错误,行数:"+ rowNum1);
return;
}
}
@ -442,7 +444,7 @@ public class ContractFormPlugin extends AbstractFormPlugin implements UploadList
try {
contractsummarylist.set("qeug_mechanicalunitprice", new BigDecimal(value12));// 机械,设备单价
} catch (NumberFormatException e) {
this.getView().showErrorNotification("清单汇总识别--生成明细失败: 机械设备单价列格式错误");
this.getView().showErrorNotification("清单汇总识别--生成明细失败: 机械设备单价列格式错误,行数:"+ rowNum1);
return;
}
}
@ -507,7 +509,7 @@ public class ContractFormPlugin extends AbstractFormPlugin implements UploadList
this.getView().download(url);
}
} else {
this.getView().showErrorNotification("请先联系管理员维护模板附件管理中的清单模板模板");
this.getView().showErrorNotification("请先联系管理员维护模板附件管理中的清单模板");
}
break;
default: