|
@@ -144,30 +144,36 @@ public class BaseInfoServiceImpl implements BaseInfoService {
|
|
|
if (headerRow != null) {
|
|
if (headerRow != null) {
|
|
|
for (int r = 3; r <= rowNum; r++) {
|
|
for (int r = 3; r <= rowNum; r++) {
|
|
|
Row row = sheet.getRow(r);
|
|
Row row = sheet.getRow(r);
|
|
|
- if (row != null && row.getCell(0) != null && row.getCell(0).getCellType() != Cell.CELL_TYPE_BLANK) {
|
|
|
|
|
|
|
+ if (row != null) {
|
|
|
total++;
|
|
total++;
|
|
|
Product product = new Product();
|
|
Product product = new Product();
|
|
|
|
|
|
|
|
// 物料编号
|
|
// 物料编号
|
|
|
- if (row.getCell(0) != null) {
|
|
|
|
|
|
|
+ if (row.getCell(0) != null && row.getCell(0).getCellType() != Cell.CELL_TYPE_BLANK) {
|
|
|
row.getCell(0).setCellType(Cell.CELL_TYPE_STRING);
|
|
row.getCell(0).setCellType(Cell.CELL_TYPE_STRING);
|
|
|
product.setCode(row.getCell(0).getStringCellValue().trim());
|
|
product.setCode(row.getCell(0).getStringCellValue().trim());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 物料名称
|
|
// 物料名称
|
|
|
- if (row.getCell(1) != null) {
|
|
|
|
|
|
|
+ if (row.getCell(1) != null && row.getCell(1).getCellType() != Cell.CELL_TYPE_BLANK) {
|
|
|
row.getCell(1).setCellType(Cell.CELL_TYPE_STRING);
|
|
row.getCell(1).setCellType(Cell.CELL_TYPE_STRING);
|
|
|
product.setTitle(row.getCell(1).getStringCellValue().trim());
|
|
product.setTitle(row.getCell(1).getStringCellValue().trim());
|
|
|
- }
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ modelMap.put("error", "第" + (r + 1) + "行物料名称未填写");
|
|
|
|
|
+ return modelMap;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// 物料规格
|
|
// 物料规格
|
|
|
- if (row.getCell(2) != null) {
|
|
|
|
|
|
|
+ if (row.getCell(2) != null && row.getCell(2).getCellType() != Cell.CELL_TYPE_BLANK) {
|
|
|
row.getCell(2).setCellType(Cell.CELL_TYPE_STRING);
|
|
row.getCell(2).setCellType(Cell.CELL_TYPE_STRING);
|
|
|
product.setSpec(row.getCell(2).getStringCellValue().trim());
|
|
product.setSpec(row.getCell(2).getStringCellValue().trim());
|
|
|
- }
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ modelMap.put("error", "第" + (r + 1) + "行物料规格未填写");
|
|
|
|
|
+ return modelMap;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// 原厂型号
|
|
// 原厂型号
|
|
|
- if (row.getCell(3) != null) {
|
|
|
|
|
|
|
+ if (row.getCell(3) != null && row.getCell(3).getCellType() != Cell.CELL_TYPE_BLANK) {
|
|
|
row.getCell(3).setCellType(Cell.CELL_TYPE_STRING);
|
|
row.getCell(3).setCellType(Cell.CELL_TYPE_STRING);
|
|
|
product.setCmpCode(row.getCell(3).getStringCellValue().trim());
|
|
product.setCmpCode(row.getCell(3).getStringCellValue().trim());
|
|
|
if (product.getCode() == null) {
|
|
if (product.getCode() == null) {
|
|
@@ -176,22 +182,31 @@ public class BaseInfoServiceImpl implements BaseInfoService {
|
|
|
String code = SystemSession.getUser().getEnterprise().getUu() + sdf.format(new Date());
|
|
String code = SystemSession.getUser().getEnterprise().getUu() + sdf.format(new Date());
|
|
|
product.setCode(code);
|
|
product.setCode(code);
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ modelMap.put("error", "第" + (r + 1) + "行物料型号未填写");
|
|
|
|
|
+ return modelMap;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// 品牌
|
|
// 品牌
|
|
|
- if (row.getCell(4) != null) {
|
|
|
|
|
|
|
+ if (row.getCell(4) != null && row.getCell(4).getCellType() != Cell.CELL_TYPE_BLANK) {
|
|
|
row.getCell(4).setCellType(Cell.CELL_TYPE_STRING);
|
|
row.getCell(4).setCellType(Cell.CELL_TYPE_STRING);
|
|
|
product.setBrand(row.getCell(4).getStringCellValue().trim());
|
|
product.setBrand(row.getCell(4).getStringCellValue().trim());
|
|
|
- }
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ modelMap.put("error", "第" + (r + 1) + "行品牌未填写");
|
|
|
|
|
+ return modelMap;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// 单位
|
|
// 单位
|
|
|
- if (row.getCell(5) != null) {
|
|
|
|
|
|
|
+ if (row.getCell(5) != null && row.getCell(5).getCellType() != Cell.CELL_TYPE_BLANK) {
|
|
|
row.getCell(5).setCellType(Cell.CELL_TYPE_STRING);
|
|
row.getCell(5).setCellType(Cell.CELL_TYPE_STRING);
|
|
|
if (null != row.getCell(5).getStringCellValue()
|
|
if (null != row.getCell(5).getStringCellValue()
|
|
|
&& !row.getCell(5).getStringCellValue().trim().equals("")) {
|
|
&& !row.getCell(5).getStringCellValue().trim().equals("")) {
|
|
|
product.setUnit(row.getCell(5).getStringCellValue());
|
|
product.setUnit(row.getCell(5).getStringCellValue());
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ modelMap.put("error", "第" + (r + 1) + "行单位未填写");
|
|
|
|
|
+ return modelMap;
|
|
|
|
|
+ }
|
|
|
// 最小包装量
|
|
// 最小包装量
|
|
|
if (row.getCell(6) != null) {
|
|
if (row.getCell(6) != null) {
|
|
|
row.getCell(6).setCellType(Cell.CELL_TYPE_STRING);
|
|
row.getCell(6).setCellType(Cell.CELL_TYPE_STRING);
|