大众订单重复导入问题修复
							parent
							
								
									691f53e64e
								
							
						
					
					
						commit
						861c5a3901
					
				| 
						 | 
					@ -6991,6 +6991,46 @@ public class DefaultOrderManager extends DefaultBaseManager implements
 | 
				
			||||||
			// 货主名称 物流单号 发货地址 销售清单号 货物价值 接单时间
 | 
								// 货主名称 物流单号 发货地址 销售清单号 货物价值 接单时间
 | 
				
			||||||
			// 打包件 打包体 打包重 运输方式 客户代码 装货区域 收货区域
 | 
								// 打包件 打包体 打包重 运输方式 客户代码 装货区域 收货区域
 | 
				
			||||||
			// 收货地址 收货联系 收货电话 物料名称 波次 波次代码
 | 
								// 收货地址 收货联系 收货电话 物料名称 波次 波次代码
 | 
				
			||||||
 | 
								HashMap<String,String> code_map_old=new HashMap<String, String>();
 | 
				
			||||||
 | 
								HashMap<String,String> code_map=new HashMap<String, String>();
 | 
				
			||||||
 | 
								for (int i = 1; i < sheet.getRows(); i++) {
 | 
				
			||||||
 | 
									String consignorName = sheet.getCell(0, i).getContents();// 货主名称
 | 
				
			||||||
 | 
									String relateBill2 = sheet.getCell(1, i).getContents();// 物流单号
 | 
				
			||||||
 | 
									List<Organization> organizations = this.commonDao
 | 
				
			||||||
 | 
											.findByQuery(
 | 
				
			||||||
 | 
													"from Organization o  where o.shortName=:name or o.code=:code",
 | 
				
			||||||
 | 
													new String[] { "name", "code" }, new Object[] {
 | 
				
			||||||
 | 
															consignorName, consignorName });
 | 
				
			||||||
 | 
									Organization org = new Organization();
 | 
				
			||||||
 | 
									if (organizations.size() > 0) {
 | 
				
			||||||
 | 
										org = organizations.get(0);
 | 
				
			||||||
 | 
									} else {
 | 
				
			||||||
 | 
										throw new BusinessException("第" + (i + 1) + "行,客户不存在!");
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									
 | 
				
			||||||
 | 
									if(!code_map_old.containsKey(relateBill2)){
 | 
				
			||||||
 | 
										 
 | 
				
			||||||
 | 
										 List<Order> os = commonDao
 | 
				
			||||||
 | 
													.findByQuery(
 | 
				
			||||||
 | 
															" from Order o  where o.consignor.id=:consignorId and o.relateBill2 =:relateBill2 ",
 | 
				
			||||||
 | 
															new String[] { "consignorId", "relateBill2" },
 | 
				
			||||||
 | 
															new Object[] { org.getId(), relateBill2 });
 | 
				
			||||||
 | 
										 if(os.size()>0){
 | 
				
			||||||
 | 
											 code_map_old.put(relateBill2, relateBill2);
 | 
				
			||||||
 | 
											 throw new BusinessException(relateBill2+"物流单号单号已导入");
 | 
				
			||||||
 | 
										 }else{
 | 
				
			||||||
 | 
											 code_map.put(relateBill2, relateBill2);
 | 
				
			||||||
 | 
										 }
 | 
				
			||||||
 | 
										
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									
 | 
				
			||||||
 | 
									
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								
 | 
				
			||||||
 | 
								 if(code_map.size()<=0){
 | 
				
			||||||
 | 
									 return;
 | 
				
			||||||
 | 
								 }
 | 
				
			||||||
 | 
								
 | 
				
			||||||
			for (int i = 1; i < sheet.getRows(); i++) {
 | 
								for (int i = 1; i < sheet.getRows(); i++) {
 | 
				
			||||||
				Date thrq = null;
 | 
									Date thrq = null;
 | 
				
			||||||
				String consignorName = sheet.getCell(0, i).getContents();// 货主名称
 | 
									String consignorName = sheet.getCell(0, i).getContents();// 货主名称
 | 
				
			||||||
| 
						 | 
					@ -7067,25 +7107,28 @@ public class DefaultOrderManager extends DefaultBaseManager implements
 | 
				
			||||||
				Organization org = new Organization();
 | 
									Organization org = new Organization();
 | 
				
			||||||
				if (organizations.size() > 0) {
 | 
									if (organizations.size() > 0) {
 | 
				
			||||||
					org = organizations.get(0);
 | 
										org = organizations.get(0);
 | 
				
			||||||
				} else {
 | 
					 | 
				
			||||||
					throw new BusinessException("第" + (i + 1) + "行,客户不存在!");
 | 
					 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
									 if(code_map_old.containsKey(xsqdh)){
 | 
				
			||||||
 | 
									 		continue;//如果已存在的单号,不需要读取了
 | 
				
			||||||
 | 
									 }
 | 
				
			||||||
 | 
									 Order order = null;
 | 
				
			||||||
				 List<Order> os = commonDao
 | 
									 List<Order> os = commonDao
 | 
				
			||||||
							.findByQuery(
 | 
												.findByQuery(
 | 
				
			||||||
									" from Order o  where o.consignor.id=:consignorId and o.customerOrderNO =:customerOrderNO ",
 | 
														" from Order o  where o.consignor.id=:consignorId and o.customerOrderNO =:customerOrderNO ",
 | 
				
			||||||
									new String[] { "consignorId", "customerOrderNO" },
 | 
														new String[] { "consignorId", "customerOrderNO" },
 | 
				
			||||||
									new Object[] { org.getId(), xsqdh });
 | 
														new Object[] { org.getId(), xsqdh });
 | 
				
			||||||
				if (xsqdh != null && os.size() > 0 && !xsqdh.equals("")) {
 | 
									 if(os.size()>0){
 | 
				
			||||||
					throw new BusinessException("第" + (i + 1) + "行,客户订单号"
 | 
										 order=os.get(0);
 | 
				
			||||||
							+ xsqdh + "已存在");
 | 
					 | 
				
			||||||
				 }
 | 
									 }
 | 
				
			||||||
				System.out.println(i + 1 + "===" + description3 + "==" + shdws);
 | 
									System.out.println(i + 1 + "===" + description3 + "==" + shdws);
 | 
				
			||||||
				Order order = null;
 | 
									
 | 
				
			||||||
 | 
									
 | 
				
			||||||
				// List<Order> os2 =
 | 
									// List<Order> os2 =
 | 
				
			||||||
				// commonDao.findByQuery(" from Order o  where o.consignor.id=:consignorId and o.description3=:description3 and  o.toName=:toName and o.status=:status",
 | 
									// commonDao.findByQuery(" from Order o  where o.consignor.id=:consignorId and o.description3=:description3 and  o.toName=:toName and o.status=:status",
 | 
				
			||||||
				// new String[] {
 | 
									// new String[] {
 | 
				
			||||||
				// "consignorId","description3","toName","status"},new Object[]
 | 
									// "consignorId","description3","toName","status"},new Object[]
 | 
				
			||||||
				// {org.getId(),description3,shdws,OrderStatus.AVAILABLE});
 | 
									// {org.getId(),description3,shdws,OrderStatus.AVAILABLE});
 | 
				
			||||||
 | 
									
 | 
				
			||||||
				List<Order> os2 = commonDao
 | 
									List<Order> os2 = commonDao
 | 
				
			||||||
						.findByQuery(
 | 
											.findByQuery(
 | 
				
			||||||
								" from Order o  where o.consignor.id=:consignorId and o.toCode=:toCode and o.relateBill2=:relateBill2 and o.status=:status",
 | 
													" from Order o  where o.consignor.id=:consignorId and o.toCode=:toCode and o.relateBill2=:relateBill2 and o.status=:status",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue