大众订单重复导入问题修复

main
HUOJIN\92525 2024-12-06 21:19:44 +08:00
parent 691f53e64e
commit 861c5a3901
1 changed files with 55 additions and 12 deletions

View File

@ -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++) {
Date thrq = null;
String consignorName = sheet.getCell(0, i).getContents();// 货主名称
@ -7067,25 +7107,28 @@ public class DefaultOrderManager extends DefaultBaseManager implements
Organization org = new Organization();
if (organizations.size() > 0) {
org = organizations.get(0);
} else {
throw new BusinessException("第" + (i + 1) + "行,客户不存在!");
}
List<Order> os = commonDao
.findByQuery(
" from Order o where o.consignor.id=:consignorId and o.customerOrderNO =:customerOrderNO ",
new String[] { "consignorId", "customerOrderNO" },
new Object[] { org.getId(), xsqdh });
if (xsqdh != null && os.size() > 0 && !xsqdh.equals("")) {
throw new BusinessException("第" + (i + 1) + "行,客户订单号"
+ xsqdh + "已存在");
}
if(code_map_old.containsKey(xsqdh)){
continue;//如果已存在的单号,不需要读取了
}
Order order = null;
List<Order> os = commonDao
.findByQuery(
" from Order o where o.consignor.id=:consignorId and o.customerOrderNO =:customerOrderNO ",
new String[] { "consignorId", "customerOrderNO" },
new Object[] { org.getId(), xsqdh });
if(os.size()>0){
order=os.get(0);
}
System.out.println(i + 1 + "===" + description3 + "==" + shdws);
Order order = null;
// 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",
// new String[] {
// "consignorId","description3","toName","status"},new Object[]
// {org.getId(),description3,shdws,OrderStatus.AVAILABLE});
List<Order> os2 = commonDao
.findByQuery(
" from Order o where o.consignor.id=:consignorId and o.toCode=:toCode and o.relateBill2=:relateBill2 and o.status=:status",