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:
@@ -15,15 +15,11 @@ public class MillProductionPlan extends BaseEntity {
|
|||||||
@Excel(name = "计划号")
|
@Excel(name = "计划号")
|
||||||
private String planNo;
|
private String planNo;
|
||||||
|
|
||||||
private String matSeqNo;
|
|
||||||
private String unitCode;
|
|
||||||
private String planType;
|
|
||||||
|
|
||||||
/** 0-待生产 1-生产中 2-完成 3-撤销 */
|
/** 0-待生产 1-生产中 2-完成 3-撤销 */
|
||||||
@Excel(name = "计划状态")
|
@Excel(name = "计划状态")
|
||||||
private String planStatus;
|
private String planStatus;
|
||||||
|
|
||||||
/** Rolling / NextCoil / Idle */
|
/** Idle / Rolling / NextCoil */
|
||||||
@Excel(name = "生产状态")
|
@Excel(name = "生产状态")
|
||||||
private String prodStatus;
|
private String prodStatus;
|
||||||
|
|
||||||
@@ -33,36 +29,33 @@ public class MillProductionPlan extends BaseEntity {
|
|||||||
@Excel(name = "钢卷编号")
|
@Excel(name = "钢卷编号")
|
||||||
private String inMatNo;
|
private String inMatNo;
|
||||||
|
|
||||||
|
@Excel(name = "合金牌号")
|
||||||
|
private String alloyNo;
|
||||||
|
|
||||||
@Excel(name = "采料厚度(mm)")
|
@Excel(name = "采料厚度(mm)")
|
||||||
private BigDecimal inMatThick;
|
private BigDecimal inMatThick;
|
||||||
|
|
||||||
@Excel(name = "采料宽度(mm)")
|
@Excel(name = "采料宽度(mm)")
|
||||||
private BigDecimal inMatWidth;
|
private BigDecimal inMatWidth;
|
||||||
|
|
||||||
@Excel(name = "采料重量(kg)")
|
@Excel(name = "采料重量(t)")
|
||||||
private BigDecimal inMatWt;
|
private BigDecimal inMatWeight;
|
||||||
|
|
||||||
@Excel(name = "采料长度(m)")
|
@Excel(name = "采料长度(m)")
|
||||||
private BigDecimal inMatLen;
|
private BigDecimal inMatLength;
|
||||||
|
|
||||||
@Excel(name = "采料内径(mm)")
|
@Excel(name = "采料内径(mm)")
|
||||||
private BigDecimal inMatInDia;
|
private BigDecimal inMatId;
|
||||||
|
|
||||||
@Excel(name = "采料外径(mm)")
|
@Excel(name = "采料外径(mm)")
|
||||||
private BigDecimal inMatDia;
|
private BigDecimal inMatOd;
|
||||||
|
|
||||||
@Excel(name = "炉号")
|
|
||||||
private String pono;
|
|
||||||
|
|
||||||
@Excel(name = "合金牌号")
|
|
||||||
private String sgSign;
|
|
||||||
|
|
||||||
@Excel(name = "出口材料号")
|
|
||||||
private String outMatNo;
|
|
||||||
|
|
||||||
@Excel(name = "成品厚度(mm)")
|
@Excel(name = "成品厚度(mm)")
|
||||||
private BigDecimal outThick;
|
private BigDecimal outThick;
|
||||||
|
|
||||||
|
@Excel(name = "道次数")
|
||||||
|
private Integer passCount;
|
||||||
|
|
||||||
@Excel(name = "工艺方案ID")
|
@Excel(name = "工艺方案ID")
|
||||||
private Long recipeId;
|
private Long recipeId;
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,10 @@ public class MillProductionPlanServiceImpl implements IMillProductionPlanService
|
|||||||
// 新计划追加到队列末尾
|
// 新计划追加到队列末尾
|
||||||
List<MillProductionPlan> all = planMapper.selectList(new MillProductionPlan());
|
List<MillProductionPlan> all = planMapper.selectList(new MillProductionPlan());
|
||||||
plan.setSortNo(all.size() + 1);
|
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);
|
return planMapper.insert(plan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
WHERE recipe_no = #{recipeNo} AND del_flag = '0' LIMIT 1
|
WHERE recipe_no = #{recipeNo} AND del_flag = '0' LIMIT 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insert" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insert" useGeneratedKeys="true" keyProperty="recipeId">
|
||||||
INSERT INTO mill_process_recipe (
|
INSERT INTO mill_process_recipe (
|
||||||
recipe_no, alloy_no, pass_count, in_thick, out_thick, out_width,
|
recipe_no, alloy_no, pass_count, in_thick, out_thick, out_width,
|
||||||
status, create_by, create_time, update_by, update_time, remark, del_flag
|
status, create_by, create_time, update_by, update_time, remark, del_flag
|
||||||
|
|||||||
@@ -4,25 +4,21 @@
|
|||||||
<mapper namespace="com.ruoyi.mill.mapper.MillProductionPlanMapper">
|
<mapper namespace="com.ruoyi.mill.mapper.MillProductionPlanMapper">
|
||||||
|
|
||||||
<resultMap id="BaseRM" type="com.ruoyi.mill.domain.MillProductionPlan">
|
<resultMap id="BaseRM" type="com.ruoyi.mill.domain.MillProductionPlan">
|
||||||
<id property="planId" column="plan_id"/>
|
<id property="planId" column="plan_id"/>
|
||||||
<result property="planNo" column="plan_no"/>
|
<result property="planNo" column="plan_no"/>
|
||||||
<result property="matSeqNo" column="mat_seq_no"/>
|
|
||||||
<result property="unitCode" column="unit_code"/>
|
|
||||||
<result property="planType" column="plan_type"/>
|
|
||||||
<result property="planStatus" column="plan_status"/>
|
<result property="planStatus" column="plan_status"/>
|
||||||
<result property="prodStatus" column="prod_status"/>
|
<result property="prodStatus" column="prod_status"/>
|
||||||
<result property="sortNo" column="sort_no"/>
|
<result property="sortNo" column="sort_no"/>
|
||||||
<result property="inMatNo" column="in_mat_no"/>
|
<result property="inMatNo" column="in_mat_no"/>
|
||||||
|
<result property="alloyNo" column="sg_sign"/>
|
||||||
<result property="inMatThick" column="in_mat_thick"/>
|
<result property="inMatThick" column="in_mat_thick"/>
|
||||||
<result property="inMatWidth" column="in_mat_width"/>
|
<result property="inMatWidth" column="in_mat_width"/>
|
||||||
<result property="inMatWt" column="in_mat_wt"/>
|
<result property="inMatWeight" column="in_mat_wt"/>
|
||||||
<result property="inMatLen" column="in_mat_len"/>
|
<result property="inMatLength" column="in_mat_len"/>
|
||||||
<result property="inMatInDia" column="in_mat_in_dia"/>
|
<result property="inMatId" column="in_mat_in_dia"/>
|
||||||
<result property="inMatDia" column="in_mat_dia"/>
|
<result property="inMatOd" column="in_mat_dia"/>
|
||||||
<result property="pono" column="pono"/>
|
|
||||||
<result property="sgSign" column="sg_sign"/>
|
|
||||||
<result property="outMatNo" column="out_mat_no"/>
|
|
||||||
<result property="outThick" column="out_thick"/>
|
<result property="outThick" column="out_thick"/>
|
||||||
|
<result property="passCount" column="pass_count"/>
|
||||||
<result property="recipeId" column="recipe_id"/>
|
<result property="recipeId" column="recipe_id"/>
|
||||||
<result property="recipeNo" column="recipe_no"/>
|
<result property="recipeNo" column="recipe_no"/>
|
||||||
<result property="delFlag" column="del_flag"/>
|
<result property="delFlag" column="del_flag"/>
|
||||||
@@ -34,9 +30,9 @@
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="cols">
|
<sql id="cols">
|
||||||
plan_id, plan_no, mat_seq_no, unit_code, plan_type, plan_status, prod_status, sort_no,
|
plan_id, plan_no, plan_status, prod_status, sort_no,
|
||||||
in_mat_no, in_mat_thick, in_mat_width, in_mat_wt, in_mat_len, in_mat_in_dia, in_mat_dia,
|
in_mat_no, sg_sign, in_mat_thick, in_mat_width, in_mat_wt, in_mat_len,
|
||||||
pono, sg_sign, out_mat_no, out_thick, recipe_id, recipe_no,
|
in_mat_in_dia, in_mat_dia, out_thick, pass_count, recipe_id, recipe_no,
|
||||||
del_flag, create_by, create_time, update_by, update_time, remark
|
del_flag, create_by, create_time, update_by, update_time, remark
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
@@ -46,8 +42,8 @@
|
|||||||
<if test="inMatNo != null and inMatNo != ''">
|
<if test="inMatNo != null and inMatNo != ''">
|
||||||
AND in_mat_no LIKE CONCAT('%', #{inMatNo}, '%')
|
AND in_mat_no LIKE CONCAT('%', #{inMatNo}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="sgSign != null and sgSign != ''">
|
<if test="alloyNo != null and alloyNo != ''">
|
||||||
AND sg_sign LIKE CONCAT('%', #{sgSign}, '%')
|
AND sg_sign LIKE CONCAT('%', #{alloyNo}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="planStatus != null and planStatus != ''">
|
<if test="planStatus != null and planStatus != ''">
|
||||||
AND plan_status = #{planStatus}
|
AND plan_status = #{planStatus}
|
||||||
@@ -58,7 +54,7 @@
|
|||||||
<if test="params != null and params.endTime != null and params.endTime != ''">
|
<if test="params != null and params.endTime != null and params.endTime != ''">
|
||||||
AND DATE(create_time) <= #{params.endTime}
|
AND DATE(create_time) <= #{params.endTime}
|
||||||
</if>
|
</if>
|
||||||
ORDER BY sort_no ASC, id ASC
|
ORDER BY sort_no ASC, plan_id ASC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectById" resultMap="BaseRM">
|
<select id="selectById" resultMap="BaseRM">
|
||||||
@@ -66,51 +62,49 @@
|
|||||||
WHERE plan_id = #{planId} AND del_flag = '0'
|
WHERE plan_id = #{planId} AND del_flag = '0'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectByPlanNo" resultMap="BaseRM">
|
<insert id="insert" useGeneratedKeys="true" keyProperty="planId">
|
||||||
SELECT <include refid="cols"/> FROM mill_production_plan
|
|
||||||
WHERE plan_no = #{planNo} AND del_flag = '0' LIMIT 1
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<insert id="insert" useGeneratedKeys="true" keyProperty="id">
|
|
||||||
INSERT INTO mill_production_plan (
|
INSERT INTO mill_production_plan (
|
||||||
plan_no, mat_seq_no, unit_code, plan_type, plan_status, prod_status, sort_no,
|
plan_no, plan_status, prod_status, sort_no,
|
||||||
in_mat_no, in_mat_thick, in_mat_width, in_mat_wt, in_mat_len, in_mat_in_dia, in_mat_dia,
|
in_mat_no, sg_sign, in_mat_thick, in_mat_width, in_mat_wt, in_mat_len,
|
||||||
pono, sg_sign, out_mat_no, out_thick, recipe_id, recipe_no,
|
in_mat_in_dia, in_mat_dia, out_thick, pass_count, recipe_id, recipe_no,
|
||||||
create_by, create_time, update_by, update_time, remark, del_flag
|
create_by, create_time, update_by, update_time, remark, del_flag
|
||||||
) VALUES (
|
) VALUES (
|
||||||
#{planNo}, #{matSeqNo}, #{unitCode}, #{planType},
|
#{planNo}, IFNULL(#{planStatus},'0'), IFNULL(#{prodStatus},'Idle'), IFNULL(#{sortNo},0),
|
||||||
IFNULL(#{planStatus},'0'), IFNULL(#{prodStatus},'Idle'), IFNULL(#{sortNo},0),
|
#{inMatNo}, #{alloyNo}, #{inMatThick}, #{inMatWidth}, #{inMatWeight}, #{inMatLength},
|
||||||
#{inMatNo}, #{inMatThick}, #{inMatWidth}, #{inMatWt}, #{inMatLen}, #{inMatInDia}, #{inMatDia},
|
#{inMatId}, #{inMatOd}, #{outThick}, IFNULL(#{passCount},0), #{recipeId}, #{recipeNo},
|
||||||
#{pono}, #{sgSign}, #{outMatNo}, #{outThick}, #{recipeId}, #{recipeNo},
|
|
||||||
#{createBy}, NOW(), #{updateBy}, NOW(), #{remark}, '0'
|
#{createBy}, NOW(), #{updateBy}, NOW(), #{remark}, '0'
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="update">
|
<update id="update">
|
||||||
UPDATE mill_production_plan
|
UPDATE mill_production_plan
|
||||||
SET plan_status = #{planStatus},
|
SET plan_status = #{planStatus},
|
||||||
prod_status = #{prodStatus},
|
prod_status = #{prodStatus},
|
||||||
in_mat_no = #{inMatNo},
|
in_mat_no = #{inMatNo},
|
||||||
in_mat_thick = #{inMatThick},
|
sg_sign = #{alloyNo},
|
||||||
in_mat_width = #{inMatWidth},
|
in_mat_thick = #{inMatThick},
|
||||||
in_mat_wt = #{inMatWt},
|
in_mat_width = #{inMatWidth},
|
||||||
in_mat_len = #{inMatLen},
|
in_mat_wt = #{inMatWeight},
|
||||||
in_mat_in_dia= #{inMatInDia},
|
in_mat_len = #{inMatLength},
|
||||||
in_mat_dia = #{inMatDia},
|
in_mat_in_dia = #{inMatId},
|
||||||
pono = #{pono},
|
in_mat_dia = #{inMatOd},
|
||||||
sg_sign = #{sgSign},
|
out_thick = #{outThick},
|
||||||
out_mat_no = #{outMatNo},
|
pass_count = #{passCount},
|
||||||
out_thick = #{outThick},
|
recipe_id = #{recipeId},
|
||||||
recipe_id = #{recipeId},
|
recipe_no = #{recipeNo},
|
||||||
recipe_no = #{recipeNo},
|
update_by = #{updateBy},
|
||||||
update_by = #{updateBy},
|
update_time = NOW(),
|
||||||
update_time = NOW(),
|
remark = #{remark}
|
||||||
remark = #{remark}
|
|
||||||
WHERE plan_id = #{planId}
|
WHERE plan_id = #{planId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="deleteById">
|
<update id="deleteById">
|
||||||
UPDATE mill_production_plan SET del_flag = '2', update_time = NOW() WHERE plan_id = #{planId}
|
UPDATE mill_production_plan SET del_flag = '2', update_time = NOW()
|
||||||
|
WHERE plan_id = #{planId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updateSortNo">
|
||||||
|
UPDATE mill_production_plan SET sort_no = #{sortNo} WHERE plan_id = #{planId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="incrementSortFrom">
|
<update id="incrementSortFrom">
|
||||||
@@ -118,8 +112,4 @@
|
|||||||
WHERE sort_no >= #{targetSort} AND del_flag = '0'
|
WHERE sort_no >= #{targetSort} AND del_flag = '0'
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="updateSortNo">
|
|
||||||
UPDATE mill_production_plan SET sort_no = #{sortNo} WHERE plan_id = #{planId}
|
|
||||||
</update>
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user