no message
parent
46c185eaa6
commit
6236694a13
|
|
@ -4,6 +4,7 @@
|
||||||
<select id="queryPoints" resultType="org.cpte.modules.base.entity.Point">
|
<select id="queryPoints" resultType="org.cpte.modules.base.entity.Point">
|
||||||
SELECT point.* FROM base_point point
|
SELECT point.* FROM base_point point
|
||||||
JOIN base_area area ON point.area_id = area.id
|
JOIN base_area area ON point.area_id = area.id
|
||||||
|
LEFT JOIN data_inventory di ON di.point_id=point.id
|
||||||
WHERE point.iz_active = 1
|
WHERE point.iz_active = 1
|
||||||
<if test="pointCode != null and pointCode != ''">
|
<if test="pointCode != null and pointCode != ''">
|
||||||
AND point.point_code = #{pointCode}
|
AND point.point_code = #{pointCode}
|
||||||
|
|
@ -14,6 +15,7 @@
|
||||||
<if test="areaCode != null and areaCode != ''">
|
<if test="areaCode != null and areaCode != ''">
|
||||||
AND area.area_code = #{areaCode}
|
AND area.area_code = #{areaCode}
|
||||||
</if>
|
</if>
|
||||||
|
AND di.point_id IS NULL
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findPointsWithSkuBatchPo" resultType="org.cpte.modules.base.entity.Point">
|
<select id="findPointsWithSkuBatchPo" resultType="org.cpte.modules.base.entity.Point">
|
||||||
|
|
@ -22,9 +24,11 @@
|
||||||
JOIN base_point bp2 ON bp1.col_num = bp2.col_num
|
JOIN base_point bp2 ON bp1.col_num = bp2.col_num
|
||||||
JOIN data_inventory inv ON bp2.id = inv.point_id
|
JOIN data_inventory inv ON bp2.id = inv.point_id
|
||||||
JOIN base_item_key bik ON inv.item_key_id = bik.id
|
JOIN base_item_key bik ON inv.item_key_id = bik.id
|
||||||
|
LEFT JOIN data_inventory di ON di.point_id=bp1.id
|
||||||
WHERE bp1.status = 0
|
WHERE bp1.status = 0
|
||||||
AND bp1.iz_active=1
|
AND bp1.iz_active=1
|
||||||
AND ba.area_code = #{areaCode}
|
AND ba.area_code = #{areaCode}
|
||||||
|
AND di.point_id IS NULL
|
||||||
AND bik.id IN
|
AND bik.id IN
|
||||||
<foreach collection="itemKeyIds" item="itemKeyId" open="(" separator="," close=")">
|
<foreach collection="itemKeyIds" item="itemKeyId" open="(" separator="," close=")">
|
||||||
#{itemKeyId}
|
#{itemKeyId}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package org.cpte.modules.quartz.job;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.cpte.modules.agvTask.mapper.AgvTaskMapper;
|
import org.cpte.modules.agvTask.mapper.AgvTaskMapper;
|
||||||
import org.cpte.modules.agvTask.vo.ConNoAgv;
|
import org.cpte.modules.agvTask.vo.ConNoAgv;
|
||||||
import org.cpte.modules.constant.enums.PickStatusEnum;
|
import org.cpte.modules.constant.enums.PickStatusEnum;
|
||||||
|
|
@ -12,6 +13,7 @@ import org.cpte.modules.shipping.mapper.PickDetailMapper;
|
||||||
import org.cpte.modules.shipping.service.IPickDetailService;
|
import org.cpte.modules.shipping.service.IPickDetailService;
|
||||||
import org.cpte.modules.shipping.service.IPickService;
|
import org.cpte.modules.shipping.service.IPickService;
|
||||||
import org.cpte.modules.shipping.vo.AllocationPickDetailData;
|
import org.cpte.modules.shipping.vo.AllocationPickDetailData;
|
||||||
|
import org.cpte.modules.utils.RedisDistributedLockUtil;
|
||||||
import org.jeecg.common.constant.CommonConstant;
|
import org.jeecg.common.constant.CommonConstant;
|
||||||
import org.jeecg.modules.base.service.BaseCommonService;
|
import org.jeecg.modules.base.service.BaseCommonService;
|
||||||
import org.quartz.Job;
|
import org.quartz.Job;
|
||||||
|
|
@ -40,8 +42,18 @@ public class AllocatePickDetailJob implements Job {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IPickDetailService pickDetailService;
|
private IPickDetailService pickDetailService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisDistributedLockUtil redissonLock;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(JobExecutionContext jobExecutionContext) {
|
public void execute(JobExecutionContext jobExecutionContext) {
|
||||||
|
String lockKey = "lock:allocation";
|
||||||
|
String lockValue = null;
|
||||||
|
try {
|
||||||
|
lockValue = redissonLock.tryLock(lockKey, 10);
|
||||||
|
if (StringUtils.isEmpty(lockValue)) {
|
||||||
|
throw new RuntimeException("分配明细中,请稍后重试");
|
||||||
|
}
|
||||||
//1.获取未拣货完成的出库明细
|
//1.获取未拣货完成的出库明细
|
||||||
List<PickDetail> pickDetails = pickDetailMapper.queryUnFinishedPickDetail();
|
List<PickDetail> pickDetails = pickDetailMapper.queryUnFinishedPickDetail();
|
||||||
if (CollectionUtils.isEmpty(pickDetails)) {
|
if (CollectionUtils.isEmpty(pickDetails)) {
|
||||||
|
|
@ -56,6 +68,15 @@ public class AllocatePickDetailJob implements Job {
|
||||||
|
|
||||||
// 处理其他类型的出库单
|
// 处理其他类型的出库单
|
||||||
processOtherTypePicks(data.getOtherPickIds(), data.getPickDetailMap(), data.getPickMap());
|
processOtherTypePicks(data.getOtherPickIds(), data.getPickDetailMap(), data.getPickMap());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("分配明细异常", e);
|
||||||
|
throw e;
|
||||||
|
} finally {
|
||||||
|
if (StringUtils.isNotEmpty(lockValue)) {
|
||||||
|
redissonLock.unlock(lockKey, lockValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue