feat(wms): 入炉钢卷不能被操作
- 在退火计划取消时将钢卷独占状态设置为2(退火中) - 在实际库位占用时将钢卷独占状态设置为0(未独占) - 扩展独占状态枚举值:0=未独占,1=单步分卷中,2=退火中 - 修改钢卷独占状态检查方法为获取完整状态值 - 增强钢卷操作权限验证,支持多种独占状态判断
This commit is contained in:
@@ -153,7 +153,7 @@ public class WmsMaterialCoil extends BaseEntity {
|
|||||||
private String coatingType;
|
private String coatingType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 独占状态(0=未独占,1=特殊分卷中)
|
* 独占状态(0=未独占,1=单步分卷中,2=退火中)
|
||||||
*/
|
*/
|
||||||
private Integer exclusiveStatus;
|
private Integer exclusiveStatus;
|
||||||
|
|
||||||
|
|||||||
@@ -341,7 +341,8 @@ public class WmsFurnacePlanServiceImpl implements IWmsFurnacePlanService {
|
|||||||
}
|
}
|
||||||
materialCoilMapper.update(null, Wrappers.<WmsMaterialCoil>lambdaUpdate()
|
materialCoilMapper.update(null, Wrappers.<WmsMaterialCoil>lambdaUpdate()
|
||||||
.eq(WmsMaterialCoil::getCoilId, coilId)
|
.eq(WmsMaterialCoil::getCoilId, coilId)
|
||||||
.set(WmsMaterialCoil::getActualWarehouseId, null));
|
.set(WmsMaterialCoil::getActualWarehouseId, null)
|
||||||
|
.set(WmsMaterialCoil::getExclusiveStatus, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void occupyActualWarehouse(Long coilId, Long actualWarehouseId) {
|
private void occupyActualWarehouse(Long coilId, Long actualWarehouseId) {
|
||||||
@@ -363,6 +364,7 @@ public class WmsFurnacePlanServiceImpl implements IWmsFurnacePlanService {
|
|||||||
WmsMaterialCoil updateCoil = new WmsMaterialCoil();
|
WmsMaterialCoil updateCoil = new WmsMaterialCoil();
|
||||||
updateCoil.setCoilId(coilId);
|
updateCoil.setCoilId(coilId);
|
||||||
updateCoil.setActualWarehouseId(actualWarehouseId);
|
updateCoil.setActualWarehouseId(actualWarehouseId);
|
||||||
|
updateCoil.setExclusiveStatus(0);
|
||||||
materialCoilMapper.updateById(updateCoil);
|
materialCoilMapper.updateById(updateCoil);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1369,16 +1369,16 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查钢卷是否被独占(用于单步分卷操作)
|
* 获取钢卷的独占状态
|
||||||
* @param coilId 钢卷ID
|
* @param coilId 钢卷ID
|
||||||
* @return true表示未被独占,false表示被独占
|
* @return exclusiveStatus值,null或0表示未独占
|
||||||
*/
|
*/
|
||||||
private boolean checkExclusiveStatus(Long coilId) {
|
private Integer getExclusiveStatus(Long coilId) {
|
||||||
if (coilId == null) {
|
if (coilId == null) {
|
||||||
return true;
|
return null;
|
||||||
}
|
}
|
||||||
WmsMaterialCoil coil = baseMapper.selectById(coilId);
|
WmsMaterialCoil coil = baseMapper.selectById(coilId);
|
||||||
return coil == null || coil.getExclusiveStatus() == null || coil.getExclusiveStatus() == 0;
|
return coil == null ? null : coil.getExclusiveStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1387,9 +1387,17 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
* @param operation 操作名称(用于错误信息)
|
* @param operation 操作名称(用于错误信息)
|
||||||
*/
|
*/
|
||||||
private void validateCoilOperationPermission(Long coilId, String operation) {
|
private void validateCoilOperationPermission(Long coilId, String operation) {
|
||||||
if (!checkExclusiveStatus(coilId)) {
|
Integer status = getExclusiveStatus(coilId);
|
||||||
|
if (status == null || status == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (status == 1) {
|
||||||
throw new RuntimeException("钢卷正在进行单步分卷操作中,无法执行" + operation + "操作");
|
throw new RuntimeException("钢卷正在进行单步分卷操作中,无法执行" + operation + "操作");
|
||||||
}
|
}
|
||||||
|
if (status == 2) {
|
||||||
|
throw new RuntimeException("钢卷正在进行退火操作中,无法执行" + operation + "操作");
|
||||||
|
}
|
||||||
|
throw new RuntimeException("钢卷已被独占,无法执行" + operation + "操作");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user