Browse Source

【商务平台】 有重复对账时,给出单号提示

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@6420 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
hejq 9 years ago
parent
commit
7909f279a7

+ 11 - 5
src/main/java/com/uas/platform/b2b/controller/SaleApCheckController.java

@@ -116,6 +116,7 @@ public class SaleApCheckController {
 	@ResponseBody
 	public ModelMap saveApCheck(@RequestBody String json) {
 		ModelMap map = new ModelMap();
+		List<String> alters = new ArrayList<String>();
 		PurchaseApCheck apCheck = FlexJsonUtils.fromJson(json, PurchaseApCheck.class);
 		if (apCheck != null) {
 			for (PurchaseApCheckItem item : apCheck.getItems()) {
@@ -123,14 +124,19 @@ public class SaleApCheckController {
 						.findBySourceTableAndSourceId(item.getSourceTable(), item.getSourceId());
 				for (PurchaseApCheckItem newitem : items) {
 					if (newitem.getApCheck().getCheckStatus().equals("未对账")) {
-						throw new IllegalOperatorException("订单" + item.getInoutno() + "存在未对账的单据,请先对账!");
+						alters.add(item.getInoutno());
 					}
 				}
 			}
-			apCheck = purchaseApCheckService.save(apCheck);
-			logger.log("应收对账单", "多个单据生成同一张应收对账单", apCheck.getRemark(), null, apCheck.getId());
-			map.put("id", apCheck.getId());
-			return map;
+			if (alters.size() > 0) {
+				map.put("alters", alters);
+				throw new IllegalOperatorException("订单" + alters + "存在未对账的单据,请先进行对账!");
+			} else {
+				apCheck = purchaseApCheckService.save(apCheck);
+				logger.log("应收对账单", "多个单据生成同一张应收对账单", apCheck.getRemark(), null, apCheck.getId());
+				map.put("id", apCheck.getId());
+				return map;
+			}
 		} else {
 			throw new IllegalOperatorException("保存失败!");
 		}