fix(plan): 修复生产计划新增无效的全部根因

1. MillProductionPlan Domain:将 sgSign/inMatLen/inMatWt/inMatDia/inMatInDia
   重命名为前端一致的 alloyNo/inMatLength/inMatWeight/inMatOd/inMatId,新增 passCount

2. MillProductionPlanMapper.xml:
   - resultMap 用老 DB 列名(sg_sign/in_mat_wt 等)映射新 Java 属性名
   - INSERT/UPDATE/SELECT 全部对齐,keyProperty 改为 planId
   - ORDER BY 改为 plan_id(原为不存在的 id 列)
   - 新增 pass_count 映射(ALTER TABLE 已在服务器执行)

3. MillProductionPlanServiceImpl:insert 自动生成 planNo(P+时间戳)
   防止 plan_no NOT NULL 约束导致插入失败

4. MillProcessRecipeMapper.xml:keyProperty="id" 改为 keyProperty="recipeId"
   修复 addRecipe 后 recipe.getRecipeId() 返回 null 导致无法绑定计划

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-29 13:38:01 +08:00
parent 0443b8e320
commit c4dc5ded57
4 changed files with 60 additions and 73 deletions

View File

@@ -15,15 +15,11 @@ public class MillProductionPlan extends BaseEntity {
@Excel(name = "计划号")
private String planNo;
private String matSeqNo;
private String unitCode;
private String planType;
/** 0-待生产 1-生产中 2-完成 3-撤销 */
@Excel(name = "计划状态")
private String planStatus;
/** Rolling / NextCoil / Idle */
/** Idle / Rolling / NextCoil */
@Excel(name = "生产状态")
private String prodStatus;
@@ -33,36 +29,33 @@ public class MillProductionPlan extends BaseEntity {
@Excel(name = "钢卷编号")
private String inMatNo;
@Excel(name = "合金牌号")
private String alloyNo;
@Excel(name = "采料厚度(mm)")
private BigDecimal inMatThick;
@Excel(name = "采料宽度(mm)")
private BigDecimal inMatWidth;
@Excel(name = "采料重量(kg)")
private BigDecimal inMatWt;
@Excel(name = "采料重量(t)")
private BigDecimal inMatWeight;
@Excel(name = "采料长度(m)")
private BigDecimal inMatLen;
private BigDecimal inMatLength;
@Excel(name = "采料内径(mm)")
private BigDecimal inMatInDia;
private BigDecimal inMatId;
@Excel(name = "采料外径(mm)")
private BigDecimal inMatDia;
@Excel(name = "炉号")
private String pono;
@Excel(name = "合金牌号")
private String sgSign;
@Excel(name = "出口材料号")
private String outMatNo;
private BigDecimal inMatOd;
@Excel(name = "成品厚度(mm)")
private BigDecimal outThick;
@Excel(name = "道次数")
private Integer passCount;
@Excel(name = "工艺方案ID")
private Long recipeId;

View File

@@ -32,6 +32,10 @@ public class MillProductionPlanServiceImpl implements IMillProductionPlanService
// 新计划追加到队列末尾
List<MillProductionPlan> all = planMapper.selectList(new MillProductionPlan());
plan.setSortNo(all.size() + 1);
// plan_no NOT NULL若前端未传则自动生成
if (plan.getPlanNo() == null || plan.getPlanNo().isEmpty()) {
plan.setPlanNo("P" + System.currentTimeMillis());
}
return planMapper.insert(plan);
}