1完成酸轧轧辊调整

2完成双机架工艺规格串联
3完成双机架计划串联
4完成双机架wip快捷录入检索
5完成双机架实绩串联
This commit is contained in:
2026-05-19 17:13:37 +08:00
parent 417783e64a
commit 53a180787b
46 changed files with 5592 additions and 231 deletions

View File

@@ -19,8 +19,12 @@ import com.klp.domain.vo.TheoryCycleRegressionResultVo;
import com.klp.domain.vo.TheoryCycleRegressionVo;
import com.klp.domain.vo.WmsCoilPendingActionVo;
import com.klp.domain.vo.WmsCoilPendingActionIdCoilVo;
import com.klp.domain.DrMillProductionPlan;
import com.klp.domain.WmsRawMaterial;
import com.klp.mapper.DrMillProductionPlanMapper;
import com.klp.mapper.WmsCoilPendingActionMapper;
import com.klp.mapper.WmsMaterialCoilMapper;
import com.klp.mapper.WmsRawMaterialMapper;
import com.klp.service.IWmsCoilPendingActionService;
import com.klp.system.service.ISysUserService;
import lombok.RequiredArgsConstructor;
@@ -52,8 +56,14 @@ public class WmsCoilPendingActionServiceImpl implements IWmsCoilPendingActionSer
private final ISysUserService userService;
private final WmsMaterialCoilMapper materialCoilMapper;
private final WmsRawMaterialMapper rawMaterialMapper;
private final DrMillProductionPlanMapper drPlanMapper;
private final StringRedisTemplate stringRedisTemplate;
/** 双机架工序 / 修复的 actionType */
private static final int ACTION_TYPE_DR_NORMAL = 504;
private static final int ACTION_TYPE_DR_REPAIR = 524;
private static final String REDIS_KEY_IDEAL_CYCLE = "oee:ideal-cycle-time";
/**
@@ -256,10 +266,99 @@ public class WmsCoilPendingActionServiceImpl implements IWmsCoilPendingActionSer
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setActionId(add.getActionId());
// 双机架工序/修复:同步在 double-rack 数据库创建生产计划
if (ACTION_TYPE_DR_NORMAL == add.getActionType() || ACTION_TYPE_DR_REPAIR == add.getActionType()) {
autoCreateDrPlan(add);
}
}
return flag;
}
/**
* 自动创建双机架生产计划(写入 double-rack 数据源)。
* 同时查询钢卷库wms_material_coil和原材料库wms_raw_material
* 将完整的钢卷/原料规格信息写入计划。
* planNo = "DR" + actionId保证唯一且可追溯。
*/
@com.baomidou.dynamic.datasource.annotation.DS("double-rack")
private void autoCreateDrPlan(WmsCoilPendingAction action) {
try {
DrMillProductionPlan plan = new DrMillProductionPlan();
plan.setPlanNo("DR" + action.getActionId());
if (action.getCoilId() != null) {
// ① 查钢卷库
WmsMaterialCoil coil = materialCoilMapper.selectById(action.getCoilId());
if (coil != null) {
plan.setInMatNo(coil.getEnterCoilNo() != null ? coil.getEnterCoilNo() : coil.getCurrentCoilNo());
plan.setEnterCoilNo(coil.getEnterCoilNo());
plan.setCurrentCoilNo(coil.getCurrentCoilNo());
// 实测厚度(优先)
if (coil.getActualThickness() != null) {
try { plan.setInMatThick(new java.math.BigDecimal(coil.getActualThickness())); } catch (Exception ignored) {}
}
// 实测宽度(优先)
plan.setInMatWidth(coil.getActualWidth());
// 净重 > 毛重
plan.setInMatWeight(coil.getNetWeight() != null ? coil.getNetWeight() : coil.getGrossWeight());
// 长度
plan.setInMatLength(coil.getLength());
// ② 查原材料库itemType='raw_material' 时通过 itemId 关联)
if ("raw_material".equals(coil.getItemType()) && coil.getItemId() != null) {
WmsRawMaterial rm = rawMaterialMapper.selectById(coil.getItemId());
if (rm != null) {
// 钢种/合金号
plan.setAlloyNo(rm.getSteelGrade());
// 标称厚度(实测没有时用标称补齐)
if (plan.getInMatThick() == null && rm.getThickness() != null) {
plan.setInMatThick(rm.getThickness());
}
// 标称宽度(实测没有时用标称补齐)
if (plan.getInMatWidth() == null && rm.getWidth() != null) {
plan.setInMatWidth(rm.getWidth());
}
// 卷重WMS 净重没有时用原材料卷重补齐)
if (plan.getInMatWeight() == null && rm.getCoilWeight() != null) {
plan.setInMatWeight(rm.getCoilWeight());
}
// 目标冷轧厚度 / 宽度写入出口目标厚度
if (rm.getTargetColdThickness() != null) {
plan.setOutThick(rm.getTargetColdThickness());
}
}
}
}
} else if (action.getCurrentCoilNo() != null) {
plan.setInMatNo(action.getCurrentCoilNo());
plan.setCurrentCoilNo(action.getCurrentCoilNo());
}
// 修复工序在备注中标记
if (ACTION_TYPE_DR_REPAIR == action.getActionType()) {
plan.setRemark("[修复] " + (action.getRemark() != null ? action.getRemark() : ""));
} else {
plan.setRemark(action.getRemark());
}
String user = LoginHelper.getUsername();
plan.setCreateBy(user);
plan.setUpdateBy(user);
plan.setPlanStatus("0");
plan.setProdStatus("Idle");
// 排到队列末尾
List<DrMillProductionPlan> all = drPlanMapper.selectList(new DrMillProductionPlan());
plan.setSortNo(all.size() + 1);
drPlanMapper.insert(plan);
} catch (Exception e) {
org.slf4j.LoggerFactory.getLogger(getClass())
.error("[双机架] 自动创建生产计划失败, actionId={}", action.getActionId(), e);
}
}
/**
* 修改钢卷待操作
*/