|
|
|
@ -376,26 +376,50 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
|
|
|
|
|
@Override |
|
|
|
|
public Long saveData(PanFactoryOrderDTO factoryOrderDTO) { |
|
|
|
|
|
|
|
|
|
QueryWrapper<PanFactoryOrder> qw = new QueryWrapper<>(); |
|
|
|
|
qw.eq("order_no",factoryOrderDTO.getOrderNo()); |
|
|
|
|
//先查询订单是否存在
|
|
|
|
|
PanFactoryOrder factoryOrder = factoryOrderService.getOne(qw); |
|
|
|
|
boolean flag = false; |
|
|
|
|
if(Objects.isNull(factoryOrder)){ |
|
|
|
|
factoryOrder = new PanFactoryOrder(); |
|
|
|
|
BeanUtil.copyProperties(factoryOrderDTO,factoryOrder); |
|
|
|
|
//保存订单数据
|
|
|
|
|
factoryOrderService.save(factoryOrder); |
|
|
|
|
}else{ |
|
|
|
|
factoryOrder.setStatus(1); |
|
|
|
|
factoryOrderService.saveOrUpdate(factoryOrder); |
|
|
|
|
flag = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// PanFactoryOrder factoryOrder = new PanFactoryOrder();
|
|
|
|
|
// QueryWrapper<PanFactoryOrder> qw = new QueryWrapper<>();
|
|
|
|
|
// qw.eq("order_no",factoryOrderDTO.getOrderNo());
|
|
|
|
|
// //先查询订单是否存在
|
|
|
|
|
// PanFactoryOrder factoryOrder = factoryOrderService.getOne(qw);
|
|
|
|
|
// boolean flag = false;
|
|
|
|
|
// if(Objects.isNull(factoryOrder)){
|
|
|
|
|
// factoryOrder = new PanFactoryOrder();
|
|
|
|
|
// BeanUtil.copyProperties(factoryOrderDTO,factoryOrder);
|
|
|
|
|
// //保存订单数据
|
|
|
|
|
// factoryOrderService.save(factoryOrder);
|
|
|
|
|
// }else{
|
|
|
|
|
// factoryOrder.setStatus(1);
|
|
|
|
|
// factoryOrderService.saveOrUpdate(factoryOrder);
|
|
|
|
|
// flag = true;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
String orderNo = factoryOrderDTO.getOrderNo(); |
|
|
|
|
|
|
|
|
|
QueryWrapper<PanFactoryOrder> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("order_no",orderNo); |
|
|
|
|
PanFactoryOrder one = factoryOrderService.getOne(queryWrapper); |
|
|
|
|
if(!Objects.isNull(one)){ |
|
|
|
|
//如果订单已存在就去验证订单下面的包件信息
|
|
|
|
|
List<PanPackageInfoDTO> order_attributes = factoryOrderDTO.getORDER_ATTRIBUTES(); |
|
|
|
|
QueryWrapper<PanPackageInfo> qw = new QueryWrapper<>(); |
|
|
|
|
qw.eq("order_no",orderNo); |
|
|
|
|
List<PanPackageInfo> list = packageInfoService.list(qw); |
|
|
|
|
for(PanPackageInfo panPackageInfo:list){ |
|
|
|
|
String unitNo = panPackageInfo.getUnitNo(); |
|
|
|
|
for(int i = 0; i<order_attributes.size(); i++){ |
|
|
|
|
String newUnitNo = order_attributes.get(i).getUnitNo(); |
|
|
|
|
if(unitNo.equals(newUnitNo)){ |
|
|
|
|
order_attributes.remove(i); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
factoryOrderDTO.setORDER_ATTRIBUTES(order_attributes); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
PanFactoryOrder factoryOrder = new PanFactoryOrder(); |
|
|
|
|
BeanUtil.copyProperties(factoryOrderDTO,factoryOrder); |
|
|
|
|
//保存订单数据
|
|
|
|
|
factoryOrderService.save(factoryOrder); |
|
|
|
|
|
|
|
|
|
List<PanPackageInfoDTO> packageInfos = factoryOrderDTO.getORDER_ATTRIBUTES(); |
|
|
|
|
List<PanPackageInfo> panPackageInfos = new ArrayList<>(); |
|
|
|
@ -405,11 +429,6 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
|
|
|
|
|
PanPackageInfo packageInfo = new PanPackageInfo(); |
|
|
|
|
BeanUtil.copyProperties(dto,packageInfo); |
|
|
|
|
packageInfo.setOrderId(factoryOrder.getId()); |
|
|
|
|
if(flag){ |
|
|
|
|
packageInfo.setReissueStatus(1); |
|
|
|
|
}else{ |
|
|
|
|
packageInfo.setReissueStatus(0); |
|
|
|
|
} |
|
|
|
|
panPackageInfos.add(packageInfo); |
|
|
|
|
|
|
|
|
|
//保存包件信息数据
|
|
|
|
|