调整模版格式及解析

This commit is contained in:
jing's 2023-12-18 15:33:43 +08:00
parent 0df472a26b
commit 2d08411025
2 changed files with 9 additions and 10 deletions

View File

@ -77,16 +77,15 @@ public class OptionalExcelService {
String materialDesc = item.getCellSecond().trim(); String materialDesc = item.getCellSecond().trim();
//替换统一格式 //替换统一格式
materialDesc = materialDesc.replace(":", ""); // materialDesc = materialDesc.replace(":", "");
int optionChildPos=materialDesc.indexOf(" ");
if(optionChildPos<0){
if (!materialDesc.contains("")) { throw new NflgBusinessException(STATE.Error,StrUtil.format("第{}行,格式错误,选项使用空格分隔图号和名称 {}",item.getLineNo(), item.getCellSecond()));
throw new NflgBusinessException(STATE.Error, StrUtil.format("第{}行,格式错误,物料数据未使用:或:分隔,{}", item.getLineNo(), item.getCellSecond()));
} }
levelDto3.setDrawingNo(StrUtil.sub(materialDesc, 0, optionChildPos));
levelDto3.setDrawingNo(StrUtil.sub(materialDesc, 0, materialDesc.indexOf(""))); String materialName = StrUtil.subSuf(materialDesc, optionChildPos + 1);
String materialName = StrUtil.subSuf(materialDesc, materialDesc.indexOf("") + 1);
// if (StrUtil.isEmpty(levelDto3.getDrawingNo())) { // if (StrUtil.isEmpty(levelDto3.getDrawingNo())) {
// throw new NflgBusinessException(STATE.Error, StrUtil.format("第{}行,格式错误,解析后不包含物料图号", item.getLineNo(), item.getCellSecond())); // throw new NflgBusinessException(STATE.Error, StrUtil.format("第{}行,格式错误,解析后不包含物料图号", item.getLineNo(), item.getCellSecond()));
@ -146,7 +145,7 @@ public class OptionalExcelService {
int optionChildPos=k.indexOf(" "); int optionChildPos=k.indexOf(" ");
if(optionChildPos<0){ if(optionChildPos<0){
throw new NflgBusinessException(STATE.Error,StrUtil.format("第{}行,格式错误,选项使用空格分隔名称和图号",v.get(0).getLineNo())); throw new NflgBusinessException(STATE.Error,StrUtil.format("第{}行,格式错误,选项使用空格分隔图号和名称",v.get(0).getLineNo()));
} }
OptionalEbomImportDTO optionalEbomImportL2 = new OptionalEbomImportDTO(); OptionalEbomImportDTO optionalEbomImportL2 = new OptionalEbomImportDTO();
@ -319,9 +318,9 @@ public class OptionalExcelService {
throw new NflgBusinessException(STATE.Error, hintMsg); throw new NflgBusinessException(STATE.Error, hintMsg);
} }
// return true; // return true;
//保存db //保存db
return batchExcelToRepertory(optionalEbomInportExcelDTO); return batchExcelToRepertory(optionalEbomInportExcelDTO);
} }