|
|
|
@ -544,50 +544,49 @@ public class ErfExpApplyServiceImpl extends ServiceImpl<ErfExpApplyMapper, ErfEx |
|
|
|
|
|
|
|
// 记录操作日志 |
|
|
|
saveApprovalLog(data.getApplyNo(), "已排产", "计划员排产", |
|
|
|
"排产:工单号=" + data.getWorkOrderNo() + ", 排产日期=" + DateUtils.format(data.getScheduledDate(), "yyyy-MM-dd"), |
|
|
|
"排产:工单号=" + data.getWorkOrderNo() + ", 排产日期=" + |
|
|
|
(data.getScheduledDate()!=null?DateUtils.format(data.getScheduledDate(), "yyyy-MM-dd"):""), |
|
|
|
data.getPlannerUserId(), data.getPlannerName()); |
|
|
|
|
|
|
|
// ===== 关键修复:排产完成后自动流转到下一节点 ===== |
|
|
|
// 更新当前节点状态为已完成 |
|
|
|
|
|
|
|
if (nodeInstance != null) { |
|
|
|
nodeInstance.setStatus("已完成"); |
|
|
|
nodeInstance.setAssigneeUserId(data.getPlannerUserId()); |
|
|
|
nodeInstance.setAssigneeName(data.getPlannerName()); |
|
|
|
nodeInstance.setComment("排产完成"); |
|
|
|
nodeInstance.setCompleteTime(new Date()); |
|
|
|
|
|
|
|
// 使用联合主键更新 |
|
|
|
erfFlowNodeInstanceMapper.update(nodeInstance, new QueryWrapper<ErfFlowNodeInstance>() |
|
|
|
.eq("apply_no", nodeInstance.getApplyNo()) |
|
|
|
.eq("node_code", nodeInstance.getNodeCode()) |
|
|
|
.eq("attempt_no", nodeInstance.getAttemptNo())); |
|
|
|
|
|
|
|
// 将同一申请单"计划员排产"节点中其他仍处于待审核的节点标记为已跳过 |
|
|
|
// (多计划员场景:任意一人排产后,其余人不可再排产) |
|
|
|
List<ErfFlowNodeInstance> otherPendingNodes = erfFlowNodeInstanceMapper.selectList( |
|
|
|
new QueryWrapper<ErfFlowNodeInstance>() |
|
|
|
.eq("apply_no", data.getApplyNo()) |
|
|
|
.eq("node_code", "计划员排产") |
|
|
|
.eq("status", "待审核") |
|
|
|
); |
|
|
|
for (ErfFlowNodeInstance other : otherPendingNodes) { |
|
|
|
other.setStatus("已跳过"); |
|
|
|
other.setComment("其他计划员已完成排产,本任务自动跳过"); |
|
|
|
other.setCompleteTime(new Date()); |
|
|
|
erfFlowNodeInstanceMapper.update(other, new QueryWrapper<ErfFlowNodeInstance>() |
|
|
|
.eq("apply_no", other.getApplyNo()) |
|
|
|
.eq("node_code", other.getNodeCode()) |
|
|
|
.eq("attempt_no", other.getAttemptNo())); |
|
|
|
} |
|
|
|
if (!otherPendingNodes.isEmpty()) { |
|
|
|
log.info("已将 {} 个其他计划员排产节点标记为已跳过", otherPendingNodes.size()); |
|
|
|
} |
|
|
|
nodeInstance.setStatus("已完成"); |
|
|
|
nodeInstance.setAssigneeUserId(data.getPlannerUserId()); |
|
|
|
nodeInstance.setAssigneeName(data.getPlannerName()); |
|
|
|
nodeInstance.setComment("排产完成"); |
|
|
|
nodeInstance.setCompleteTime(new Date()); |
|
|
|
|
|
|
|
// 调用流程引擎自动流转到下一节点 |
|
|
|
erfFlowEngineService.moveToNextNode(data.getApplyNo(), "计划员排产", null); |
|
|
|
log.info("排产完成,已自动流转到下一节点"); |
|
|
|
} |
|
|
|
// 使用联合主键更新 |
|
|
|
erfFlowNodeInstanceMapper.update(nodeInstance, new QueryWrapper<ErfFlowNodeInstance>() |
|
|
|
.eq("apply_no", nodeInstance.getApplyNo()) |
|
|
|
.eq("node_code", nodeInstance.getNodeCode()) |
|
|
|
.eq("attempt_no", nodeInstance.getAttemptNo())); |
|
|
|
|
|
|
|
// 将同一申请单"计划员排产"节点中其他仍处于待审核的节点标记为已跳过 |
|
|
|
// (多计划员场景:任意一人排产后,其余人不可再排产) |
|
|
|
List<ErfFlowNodeInstance> otherPendingNodes = erfFlowNodeInstanceMapper.selectList( |
|
|
|
new QueryWrapper<ErfFlowNodeInstance>() |
|
|
|
.eq("apply_no", data.getApplyNo()) |
|
|
|
.eq("node_code", "计划员排产") |
|
|
|
.eq("status", "待审核") |
|
|
|
); |
|
|
|
for (ErfFlowNodeInstance other : otherPendingNodes) { |
|
|
|
other.setStatus("已跳过"); |
|
|
|
other.setComment("其他计划员已完成排产,本任务自动跳过"); |
|
|
|
other.setCompleteTime(new Date()); |
|
|
|
erfFlowNodeInstanceMapper.update(other, new QueryWrapper<ErfFlowNodeInstance>() |
|
|
|
.eq("apply_no", other.getApplyNo()) |
|
|
|
.eq("node_code", other.getNodeCode()) |
|
|
|
.eq("attempt_no", other.getAttemptNo())); |
|
|
|
} |
|
|
|
if (!otherPendingNodes.isEmpty()) { |
|
|
|
log.info("已将 {} 个其他计划员排产节点标记为已跳过", otherPendingNodes.size()); |
|
|
|
} |
|
|
|
|
|
|
|
// 调用流程引擎自动流转到下一节点 |
|
|
|
erfFlowEngineService.moveToNextNode(data.getApplyNo(), "计划员排产", null); |
|
|
|
log.info("排产完成,已自动流转到下一节点"); |
|
|
|
|
|
|
|
log.info("计划员排产完成"); |
|
|
|
} |
|
|
|
|