|
|
|
@ -364,6 +364,7 @@ public class OrderController {
|
|
|
|
|
List<String> orderList = orderMergeRequest.getOrderList();
|
|
|
|
|
|
|
|
|
|
List<ErpOrderEntity> mergeList = new ArrayList<>();
|
|
|
|
|
String tempCode = null;
|
|
|
|
|
if (orderList != null && orderList.size() > 1) {
|
|
|
|
|
for (String orderId : orderList) {
|
|
|
|
|
OrderEntity orderEntity = orderService.findById(orderId);
|
|
|
|
@ -376,7 +377,21 @@ public class OrderController {
|
|
|
|
|
if (erpOrderEntities != null && erpOrderEntities.size() > 0) {
|
|
|
|
|
mergeList.addAll(erpOrderEntities);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<WarehouseEntity> warehouseEntities;
|
|
|
|
|
if (orderMergeRequest.getType() == 1) {
|
|
|
|
|
warehouseEntities = codesService.findByReceiptId(orderId);
|
|
|
|
|
} else {
|
|
|
|
|
warehouseEntities = codesTempService.findByOrderId(orderId);
|
|
|
|
|
}
|
|
|
|
|
if (!warehouseEntities.isEmpty()) {
|
|
|
|
|
for (WarehouseEntity warehouseEntity : warehouseEntities) {
|
|
|
|
|
if (tempCode == null) {
|
|
|
|
|
tempCode = warehouseEntity.getCode();
|
|
|
|
|
}else if(tempCode .equals(warehouseEntity.getCode())){
|
|
|
|
|
return ResultVOUtils.error(500, "存在重复条码无法合并!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (String orderId : orderList) {
|
|
|
|
|
orderDetailService.deleteByOrderId(orderId);
|
|
|
|
@ -430,10 +445,18 @@ public class OrderController {
|
|
|
|
|
|
|
|
|
|
public List<String> getDocids(List<ErpOrderEntity> mergeList) {
|
|
|
|
|
List<String> docids = new ArrayList<>();
|
|
|
|
|
Map<String, List<ErpOrderEntity>> mapErps = mergeList.stream().collect(Collectors.groupingBy(ErpOrderEntity::getErpOrderId));
|
|
|
|
|
for (String key : mapErps.keySet()) {
|
|
|
|
|
docids.add(key);
|
|
|
|
|
if (mergeList != null && mergeList.size() > 0) {
|
|
|
|
|
try {
|
|
|
|
|
Map<String, List<ErpOrderEntity>> mapErps = mergeList.stream().collect(Collectors.groupingBy(ErpOrderEntity::getErpOrderId));
|
|
|
|
|
for (String key : mapErps.keySet()) {
|
|
|
|
|
docids.add(key);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return docids;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return docids;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|