|
|
@@ -173,7 +173,7 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
if (headerRow != null) {
|
|
|
for (int r = 3; r <= rowNum; 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++;
|
|
|
Product product = new Product();
|
|
|
// 物料编号
|
|
|
@@ -183,36 +183,51 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
}
|
|
|
|
|
|
// 物料名称
|
|
|
- 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);
|
|
|
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);
|
|
|
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);
|
|
|
product.setCmpCode(row.getCell(3).getStringCellValue().trim());
|
|
|
+ } 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);
|
|
|
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);
|
|
|
if (null != row.getCell(5).getStringCellValue()
|
|
|
&& !row.getCell(5).getStringCellValue().trim().equals("")) {
|
|
|
product.setUnit(row.getCell(5).getStringCellValue());
|
|
|
}
|
|
|
+ } else {
|
|
|
+ modelMap.put("error", "第" + (r + 1) + "行单位未填写");
|
|
|
+ return modelMap;
|
|
|
}
|
|
|
// 最小包装量
|
|
|
if (row.getCell(6) != null) {
|
|
|
@@ -405,9 +420,9 @@ public class ProductUsersServiceImpl implements ProductUsersService {
|
|
|
prod.setEnuu(enuu);
|
|
|
prod.setPrid(id);
|
|
|
prod.setDate(new Date());
|
|
|
- Long prId = ProductUtils.updateProductUsersOne(prod);
|
|
|
+ ProductUtils.updateProductUsersOne(prod);
|
|
|
// prod = productUsersDao.save(prod);
|
|
|
- logger.log("我的产品库", "新增了我产品信息", "id:" + prId);
|
|
|
+ logger.log("我的产品库", "新增了我产品信息", "物料id:" + id);
|
|
|
}
|
|
|
}
|
|
|
|