feat(wms): 添加钢卷锁定机制并优化操作流程
- 在WmsCoilPendingActionBo中新增lockValue字段用于钢卷锁值控制 - 为insertByBo方法添加事务注解确保数据一致性 - 实现钢卷领料时的锁状态校验和上锁逻辑 - 添加unlockCoil方法在操作完成后自动解锁关联钢卷 - 在deleteBatch、completeAction和cancelAction方法中集成自动解锁功能 - 新增getLockStatusDesc方法提供详细的锁状态描述信息 - 优化合卷操作流程,使用completeAction替代手动更新状态 - 在MaterialCoilService中增强独占状态检查,支持多种锁定类型识别
This commit is contained in:
@@ -1659,7 +1659,7 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
||||
}
|
||||
|
||||
// 如果有关联的操作记录ID,调用完成接口
|
||||
if (bo.getActionId() != null && bo.getActionId() > 0) {
|
||||
if (bo.getActionId() != null && bo.getActionId() > 0 && bo.getHasMergeSplit() != 2) {
|
||||
coilPendingActionService.completeAction(bo.getActionId(), result);
|
||||
}
|
||||
|
||||
@@ -2003,7 +2003,16 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
||||
if (status == 2) {
|
||||
throw new RuntimeException("钢卷正在进行退火操作中,无法执行" + operation + "操作");
|
||||
}
|
||||
throw new RuntimeException("钢卷已被独占,无法执行" + operation + "操作");
|
||||
if (status == 3) {
|
||||
throw new RuntimeException("钢卷已被酸扎领料锁定,无法执行" + operation + "操作");
|
||||
}
|
||||
if (status == 4) {
|
||||
throw new RuntimeException("钢卷已被分卷领料锁定,无法执行" + operation + "操作");
|
||||
}
|
||||
if (status == 5) {
|
||||
throw new RuntimeException("钢卷已被合卷领料锁定,无法执行" + operation + "操作");
|
||||
}
|
||||
throw new RuntimeException("钢卷已被独占(状态码:" + status + "),无法执行" + operation + "操作");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3565,8 +3574,6 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
||||
throw new RuntimeException("合卷操作需要提供参与合卷的钢卷列表");
|
||||
}
|
||||
|
||||
Date now = new Date();
|
||||
|
||||
// 第一步:先为每个原始钢卷创建待操作记录(状态为处理中)
|
||||
// 收集创建成功的actionId,用于后续更新
|
||||
Map<Long, Long> coilToActionIdMap = new HashMap<>();
|
||||
@@ -3598,6 +3605,7 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
||||
pendingActionBo.setActionStatus(0); // 处理中
|
||||
pendingActionBo.setSourceType("manual");
|
||||
pendingActionBo.setPriority(0);
|
||||
pendingActionBo.setLockValue(5); // 合卷领料锁
|
||||
coilPendingActionService.insertByBo(pendingActionBo);
|
||||
|
||||
// insertByBo 会自动设置 actionId 到 bo 中
|
||||
@@ -3631,16 +3639,10 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
||||
throw new RuntimeException("未找到合卷后的新钢卷ID");
|
||||
}
|
||||
|
||||
// 第三步:更新所有待操作记录状态为已完成,并设置processedCoilIds
|
||||
// 第三步:调用完成接口更新所有待操作记录状态为已完成,并解锁钢卷
|
||||
for (Map.Entry<Long, Long> entry : coilToActionIdMap.entrySet()) {
|
||||
Long actionId = entry.getValue();
|
||||
|
||||
WmsCoilPendingActionBo pendingActionBo = new WmsCoilPendingActionBo();
|
||||
pendingActionBo.setActionId(actionId);
|
||||
pendingActionBo.setActionStatus(2); // 已完成
|
||||
pendingActionBo.setCompleteTime(now);
|
||||
pendingActionBo.setProcessedCoilIds(mergedCoilId.toString());
|
||||
coilPendingActionService.updateByBo(pendingActionBo);
|
||||
coilPendingActionService.completeAction(actionId, mergedCoilId.toString());
|
||||
}
|
||||
|
||||
return mergedCoilId;
|
||||
|
||||
Reference in New Issue
Block a user