|  |  |  | 
|---|
|  |  |  | Order order = orderService.selectByNo(param.getOrderNo(), param.getHostId()); | 
|---|
|  |  |  | // 如果单据不存在则添加;如果单据存在,作业中无法修改,反之则修改单据 | 
|---|
|  |  |  | boolean boo = false; | 
|---|
|  |  |  | boolean b = false; | 
|---|
|  |  |  | if (!Cools.isEmpty(order)) { | 
|---|
|  |  |  | List<OrderDetl> orderDetls = orderDetlService.list(new LambdaQueryWrapper<OrderDetl>() | 
|---|
|  |  |  | .eq(OrderDetl::getOrderId, order.getId()).eq(OrderDetl::getHostId, param.getHostId())); | 
|---|
|  |  |  | 
|---|
|  |  |  | if (orderDetls.size() == param.getMats().size()) { | 
|---|
|  |  |  | for (OrderDetl o : orderDetls | 
|---|
|  |  |  | ) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for (GenerateOrderMatParam matParam : param.getMats() | 
|---|
|  |  |  | ) { | 
|---|
|  |  |  | if (o.getMatnr().equals(matParam.getMatnr()) && !o.getAnfme().equals(matParam.getAnfme())) { | 
|---|
|  |  |  | boo = true; | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (o.getMatnr().equals(matParam.getMatnr())) { | 
|---|
|  |  |  | b = true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (boo) { | 
|---|
|  |  |  | if (boo || !b) { | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | boo = true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (boo) { | 
|---|
|  |  |  | if (boo || (!b && !Cools.isEmpty(order))) { | 
|---|
|  |  |  | if (order.getSettle() > 1L) { | 
|---|
|  |  |  | throw new CoolException(param.getOrderNo() + "正在出库,无法修改单据"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(!boo&&Cools.isEmpty(order)){ | 
|---|
|  |  |  | if (!boo && Cools.isEmpty(order)) { | 
|---|
|  |  |  | DocType docType = docTypeService.getOne(new LambdaQueryWrapper<DocType>().eq(DocType::getDocId, param.getOrderType())); | 
|---|
|  |  |  | if (docType == null) { | 
|---|
|  |  |  | throw new CoolException("订单类型不存在"); | 
|---|