Browse Source

代采订单物料批量上传给出具体提示信息

hejq 7 years ago
parent
commit
34d6f30ebe

+ 35 - 18
src/main/java/com/uas/platform/b2b/service/impl/DeputyOrderServiceImpl.java

@@ -82,74 +82,91 @@ public class DeputyOrderServiceImpl implements DeputyOrderService {
 		int rowNum = sheet.getLastRowNum();
 		Row headerRow = sheet.getRow(0);
 		int total = 0;
+		int success = 0;
 		if (headerRow != null) {
 			for (int r = 3; r <= rowNum; r++) {
 				Row row = sheet.getRow(r);
-				if (row != null && row.getCell(0) != null && row.getCell(1).getCellType() != Cell.CELL_TYPE_BLANK) {
+				if (row != null && row.getCell(0) != null && row.getCell(0).getCellType() != Cell.CELL_TYPE_BLANK) {
 					total++;
 					DeputyOrderInfo info = new DeputyOrderInfo();
 					// 商品名称
-					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);
 						info.setProdname(row.getCell(0).getStringCellValue().trim());
+					} else {
+                       alters.add("第" + (r + 1) + "行商品名称未填写");
 					}
 
 					// 编号
-					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);
 						info.setProdcode(row.getCell(1).getStringCellValue().trim());
-					}
+					} else {
+                        alters.add("第" + (r + 1) + "行商品型号未填写");
+                    }
 
 					// 规格
-					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);
 						info.setProdspec(row.getCell(2).getStringCellValue().trim());
-					}
+					} else {
+                        alters.add("第" + (r + 1) + "行商品规格未填写");
+                    }
 
 					// 品牌
-					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);
 						info.setProdbrand(row.getCell(3).getStringCellValue());
-					}
+					} else {
+                        alters.add("第" + (r + 1) + "行商品品牌未填写");
+                    }
 
 					// 数量
-					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);
 						info.setAmount(Integer.valueOf(row.getCell(4).getStringCellValue()));
-					}
+					} else {
+                        alters.add("第" + (r + 1) + "行数量未填写");
+                    }
 
 					// 单价
-					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);
 						info.setUnitprice(Double.valueOf(row.getCell(5).getStringCellValue()));
-					}
+					} else {
+                        alters.add("第" + (r + 1) + "行单价未填写");
+                    }
 
 					// 订单单价
-					if (row.getCell(6) != null) {
+					if (row.getCell(6) != null && row.getCell(6).getCellType() != Cell.CELL_TYPE_BLANK) {
 						row.getCell(6).setCellType(Cell.CELL_TYPE_STRING);
 						if (null != row.getCell(6).getStringCellValue().trim()
 								&& !row.getCell(6).getStringCellValue().trim().equals("")) {
 							info.setPurcprice(Double.valueOf(row.getCell(6).getStringCellValue()));
 						}
-					}
+					} else {
+                        alters.add("第" + (r + 1) + "行订单单价未填写");
+                    }
 
 					// 总价
-					if (row.getCell(7) != null) {
+					if (row.getCell(7) != null && row.getCell(7).getCellType() != Cell.CELL_TYPE_BLANK) {
 						row.getCell(7).setCellType(Cell.CELL_TYPE_STRING);
 						info.setTotalprice(Double.valueOf(row.getCell(7).getStringCellValue()));
 					}
 
 					// 备注
-					if (row.getCell(8) != null) {
+					if (row.getCell(8) != null && row.getCell(8).getCellType() != Cell.CELL_TYPE_BLANK) {
 						row.getCell(8).setCellType(Cell.CELL_TYPE_STRING);
 						info.setRemark(row.getCell(8).getStringCellValue().trim());
 					}
 					if (alters.size() > 0) {
 						modelMap.put("alters", alters);
-					}
+					} else {
+					    success++;
+                    }
 					if (info.getProdcode() != null) {
 						modelMap.put("total", total);
-						modelMap.put("success", total - alters.size());
+						modelMap.put("success", success);
 						infos.add(info);
 						modelMap.put("items", infos);
 					}

+ 3 - 9
src/main/webapp/resources/tpl/index/purc/modal/uplodaByBatch.html

@@ -58,16 +58,10 @@
 		<p ng-if="result.total">
 			<span>总共上传{{result.total}}个,成功{{result.success}}个</span>
 		</p>
+		<p ng-if="result.alters" ng-repeat="al in alters">
+			<span ng-bind="al"></span>
+		</p>
 	</div>
-<!-- 	<div id="image-box" style="display: none">
-		<div class="x-close-wrap" title="关闭">
-			<a href="javascript:void(0);">&times;</a>
-		</div>
-		<div class="x-floating-wrap"></div>
-		<div class="x-floating">
-			<img />
-		</div>
-	</div> -->
 </div>
 <div class="modal-footer Deputy">
 	<div class="text-center">