Commit 0301639b authored by 332784038@qq.com's avatar 332784038@qq.com

查询未使用的记录编号时要区分公共渠道编号和非公共渠道编号参数

parent 14a5f2ba
......@@ -647,17 +647,9 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
if (StringUtils.equals(TransportTypeEnum.AIR.getType(), transportType)) {
if (!Objects.equals(channelId, oldChannelId) || !Objects.equals(oldDestId, newDestId)) {
// 当箱子的渠道或者目的变更时,都需要重新生成自编号
// 先将原有的自编号记录做使用状态变更处理
// String selfNo = "";
// if (!Objects.equals(oldDestId, newDestId) || !Objects.equals(oldDestId, newDestId) ) {
// 目的国变更,需要切换自编号
boxAirNumberRecordService.updateBoxAirNumberRecordUsedStatus(boxDO.getSelfNo());
// 再重新获取自编号
String selfNo = getAirOrderNo(channelId, newDestId, transportType);
// } else {
// // 不是目的国变更,那么只是渠道变更,渠道变更只需要更新自编号规则,将原有记录更新
// selfNo = chargeChannelAirOrderNo(boxDO.getSelfNo(), channelId, newDestId, transportType);
// }
updateObj.setSelfNo(selfNo);
}
} else {
......@@ -1966,7 +1958,7 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
orderSeaTimeEnum = OrderSeaTimeEnum.SEA_CLEARED;
break;
case UNLOADED:
if (Objects.isNull(businessTime)){
if (Objects.isNull(businessTime)) {
// 到仓业务时间为空时,不更新订单到仓动态
return;
}
......@@ -2006,7 +1998,7 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
orderAirTimeEnum = OrderAirTimeEnum.AIR_ARRIVED;
break;
case TO_WAREHOUSED:
if (Objects.isNull(businessTime)){
if (Objects.isNull(businessTime)) {
// 到仓业务时间为空时,不在做订单到仓动态更新
return;
}
......@@ -4966,7 +4958,7 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
BoxOrderMarkUpVO boxOrderMarkUpVO =
JSON.parseObject(details, BoxOrderMarkUpVO.class);
zTest z=new zTest();
zTest z = new zTest();
z.setTestname("开始调用 handleAirOrderBatchMarkup");
z.setCreatedate(new Date());
zTestMapper2.insert(z);
......
......@@ -12,7 +12,7 @@ import cn.iocoder.yudao.module.shipment.dal.dataobject.boxAirNumberRecord.BoxAir
*/
public interface BoxAirNumberRecordService extends IService<BoxAirNumberRecordDO> {
public static List<String> PUBLIC_CHANNEL_CODE_LIST = Arrays.asList("AF","AS","AN");
/**
* 获得空运出货单编号记录
*
......
......@@ -42,8 +42,6 @@ public class BoxAirNumberRecordServiceImpl extends AbstractService<BoxAirNumberR
@Resource
private ApplicationContext applicationContext;
static List<String> PUBLIC_CHANNEL_CODE_LIST = Arrays.asList("AF","AS","AN");
@Override
public BoxAirNumberRecordDO getBoxAirNumberRecord(Long id) {
return boxAirNumberRecordMapper.selectById(id);
......@@ -90,10 +88,12 @@ public class BoxAirNumberRecordServiceImpl extends AbstractService<BoxAirNumberR
throw exception(CHANNEL_CODE_NOT_SET, I18nMessage.getLang() == 0 ? event.getNameZh() : event.getNameEn());
}
String channelCode = event.getCode();
// 注意:这里查询未使用的记录编号时要区分公共渠道编号和非公共渠道编号参数
BoxAirNumberRecordDO boxAirNumberRecordDO = boxAirNumberRecordMapper.selectOne(new LambdaQueryWrapper<BoxAirNumberRecordDO>()
.eq(BoxAirNumberRecordDO::getTransportType, transportType)
.eq(BoxAirNumberRecordDO::getDestCountryCode, destCountryCode)
.eq(!PUBLIC_CHANNEL_CODE_LIST.contains(channelCode), BoxAirNumberRecordDO::getChannelCode, channelCode)
.in(PUBLIC_CHANNEL_CODE_LIST.contains(channelCode), BoxAirNumberRecordDO::getChannelCode, PUBLIC_CHANNEL_CODE_LIST)
.eq(BoxAirNumberRecordDO::getUsed, 0)
.orderByAsc(BoxAirNumberRecordDO::getId).last("limit 1"));
if (Objects.nonNull(boxAirNumberRecordDO)) {
......@@ -152,6 +152,7 @@ public class BoxAirNumberRecordServiceImpl extends AbstractService<BoxAirNumberR
.eq(BoxAirNumberRecordDO::getTransportType, transportType)
.eq(BoxAirNumberRecordDO::getDestCountryCode, destCountryCode)
.eq(!PUBLIC_CHANNEL_CODE_LIST.contains(channelCode), BoxAirNumberRecordDO::getChannelCode, channelCode)
.in(PUBLIC_CHANNEL_CODE_LIST.contains(channelCode), BoxAirNumberRecordDO::getChannelCode, PUBLIC_CHANNEL_CODE_LIST)
.orderByAsc(BoxAirNumberRecordDO::getId).last("limit 1"));
if (Objects.nonNull(boxAirNumberRecordDO)) {
// 修改自编号逻辑
......@@ -177,10 +178,12 @@ public class BoxAirNumberRecordServiceImpl extends AbstractService<BoxAirNumberR
private BoxAirNumberRecordDO generateNewBoxAirNumberRecordDO(Integer transportType, Long destId, Long channelId, String destCountryCode, String channelCode, Long userId) {
BoxAirNumberRecordDO boxAirNumberRecordDO;
// 先获取最大的自编号
// 注意:这里查询未使用的记录编号时要区分公共渠道编号和非公共渠道编号参数
BoxAirNumberRecordDO maxBoxAirNumberRecordDO = boxAirNumberRecordMapper.selectOne(new LambdaQueryWrapper<BoxAirNumberRecordDO>()
.eq(BoxAirNumberRecordDO::getTransportType, transportType)
.eq(BoxAirNumberRecordDO::getDestCountryCode, destCountryCode)
.eq(!PUBLIC_CHANNEL_CODE_LIST.contains(channelCode), BoxAirNumberRecordDO::getChannelCode, channelCode)
.in(PUBLIC_CHANNEL_CODE_LIST.contains(channelCode), BoxAirNumberRecordDO::getChannelCode, PUBLIC_CHANNEL_CODE_LIST)
.orderByDesc(BoxAirNumberRecordDO::getId).last("limit 1"));
// 根据最大的自编号生成最新的自编号
String preChannelCode = "";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment