|
|
|
@ -518,28 +518,14 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
|
|
|
|
|
public R openWaybill(OpenOrderDTO openOrderDTO) { |
|
|
|
|
log.info("############openWaybill: 开单开始 openOrderDTO={}", openOrderDTO); |
|
|
|
|
|
|
|
|
|
String openAdvanceIds = AuthUtil.getTenantId()+":advanceIds"; |
|
|
|
|
|
|
|
|
|
List<Long> advanceIdList = new ArrayList<>(); |
|
|
|
|
String openAdvanceIds = AuthUtil.getTenantId()+":openWaybill:advanceId:"; |
|
|
|
|
String waybillNo = openOrderDTO.getWaybillNo();//运单号
|
|
|
|
|
Long warehouseId = openOrderDTO.getWarehouseId(); |
|
|
|
|
List<Long> advanceIds = openOrderDTO.getAdvanceIds(); |
|
|
|
|
|
|
|
|
|
//查询开单订单缓存是否存在
|
|
|
|
|
Boolean exists = bladeRedis.exists(openAdvanceIds); |
|
|
|
|
if(exists){ |
|
|
|
|
String jsonList = bladeRedis.get(openAdvanceIds); |
|
|
|
|
advanceIdList = JSON.parseArray(jsonList, Long.class); |
|
|
|
|
}else{ |
|
|
|
|
bladeRedis.set(openAdvanceIds, JSON.toJSONString(advanceIdList)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<TrunklineAdvanceEntity> advanceEntities = advanceService.findListByIds(advanceIds); |
|
|
|
|
//判断advanceEntities中是否有已经开单的暂存单
|
|
|
|
|
List<Long> finalAdvanceIdList = advanceIdList; |
|
|
|
|
advanceEntities.forEach(advanceEntity -> { |
|
|
|
|
String waybillStatus = advanceEntity.getWaybillStatus(); |
|
|
|
|
String orderCode = advanceEntity.getOrderCode(); |
|
|
|
@ -549,12 +535,15 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
|
|
|
|
|
throw new CustomerException(405,"暂存单["+orderCode+"]已开单"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(finalAdvanceIdList.contains(advanceId)){ |
|
|
|
|
String key = openAdvanceIds+advanceId; |
|
|
|
|
Boolean exists = bladeRedis.exists(key); |
|
|
|
|
if(exists){ |
|
|
|
|
log.warn("#############openWaybill: 暂存单正在开单 orderCode={}", orderCode); |
|
|
|
|
throw new CustomerException(405,"暂存单["+orderCode+"]正在开单"); |
|
|
|
|
}else{ |
|
|
|
|
bladeRedis.rPush(openAdvanceIds, advanceId); |
|
|
|
|
bladeRedis.setEx(key, 1,30L); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(warehouseId); |
|
|
|
@ -906,7 +895,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
|
|
|
|
|
advanceDetailService.sendReportAdvanceOpenData(AuthUtil.getNickName(), AuthUtil.getUserId(), warehouseId, warehouseName, updateAdvanceDetailList, waybillEntity); |
|
|
|
|
|
|
|
|
|
advanceIds.forEach(advanceId ->{ |
|
|
|
|
bladeRedis.lRem(openAdvanceIds,0,advanceId); |
|
|
|
|
bladeRedis.del(openAdvanceIds+advanceId); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
return R.data(waybillId); |
|
|
|
|