工艺管理

修复“重置导致选中丢失”
修复“新增保存后不会停留在新方案”
修复“搜索后左右不同步”
生产计划
定位生产计划页 plan.vue 的查询参数、日期范围、完成按钮与方案下拉逻辑
修复日期范围筛选:前端按后端约定写入 queryParams.params.beginTime/endTime
修复“不显示生产完成”筛选:前后端新增 excludeDone 过滤并落到 SQL 条件
修复完成计划幂等:后端避免重复插入实绩;前端对已完成禁用按钮
生产绩效
修复“明细信息显示旧数据”
修复“点击表格行只看明细但不能直接修改/删除
修复“时间字段时分秒丢失”
 修复“补录/修改表单无校验”
This commit is contained in:
朱昊天
2026-06-16 13:56:58 +08:00
parent 21a1d339d5
commit 8ea6894552
11 changed files with 459 additions and 382 deletions

View File

@@ -126,18 +126,18 @@ public class MillProductionActual extends BaseEntity
private String customer;
/** 上线时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "上线时间", width = 30, dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "上线时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date onlineTime;
/** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
/** 结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
/** 机组号 */

View File

@@ -27,6 +27,14 @@ public interface MillProductionActualMapper
*/
public List<MillProductionActual> selectMillProductionActualList(MillProductionActual millProductionActual);
/**
* 查询某计划是否已生成实绩
*
* @param planId 计划ID
* @return 数量
*/
public int countByPlanId(Long planId);
/**
* 新增轧线生产实绩
*

View File

@@ -96,28 +96,32 @@ public class MillProductionPlanServiceImpl implements IMillProductionPlanService
throw new RuntimeException("计划不存在: " + planId);
}
// 2. 更新计划状态为完成(2)
plan.setProdStatus("Done");
plan.setUpdateBy(SecurityUtils.getUsername());
int updateResult = planMapper.update(plan);
if (updateResult <= 0) {
throw new RuntimeException("更新计划状态失败");
// 2. 更新计划状态为完成(幂等)
if (!"Done".equals(plan.getProdStatus())) {
plan.setProdStatus("Done");
plan.setUpdateBy(SecurityUtils.getUsername());
int updateResult = planMapper.update(plan);
if (updateResult <= 0) {
throw new RuntimeException("更新计划状态失败");
}
}
// 3. 创建生产实绩记录
MillProductionActual actual = new MillProductionActual();
actual.setPlanId(plan.getPlanId());
actual.setPlanNo(plan.getPlanNo());
actual.setEntryMatId(plan.getInMatNo()); // 来料卷号 = 生产计划钢卷号
actual.setSteelGrade(plan.getAlloyNo()); // 钢种
actual.setStatus("已完成"); // 实绩状态:已完成
actual.setEndTime(new Date()); // 结束时间
actual.setCreateBy(SecurityUtils.getUsername());
actual.setDelFlag("0"); // 正常状态
// 3. 创建生产实绩记录(幂等)
if (actualMapper.countByPlanId(planId) <= 0) {
MillProductionActual actual = new MillProductionActual();
actual.setPlanId(plan.getPlanId());
actual.setPlanNo(plan.getPlanNo());
actual.setEntryMatId(plan.getInMatNo());
actual.setSteelGrade(plan.getAlloyNo());
actual.setStatus("已完成");
actual.setEndTime(new Date());
actual.setCreateBy(SecurityUtils.getUsername());
actual.setDelFlag("0");
int actualResult = actualMapper.insertMillProductionActual(actual);
if (actualResult <= 0) {
throw new RuntimeException("创建生产实绩记录失败");
int actualResult = actualMapper.insertMillProductionActual(actual);
if (actualResult <= 0) {
throw new RuntimeException("创建生产实绩记录失败");
}
}
return 1;

View File

@@ -101,6 +101,10 @@
where actual_id = #{actualId}
</select>
<select id="countByPlanId" parameterType="Long" resultType="int">
select count(1) from mill_production_actual where plan_id = #{planId} and del_flag = '0'
</select>
<insert id="insertMillProductionActual" parameterType="MillProductionActual" useGeneratedKeys="true" keyProperty="actualId">
insert into mill_production_actual
<trim prefix="(" suffix=")" suffixOverrides=",">

View File

@@ -48,6 +48,9 @@
<if test="planStatus != null and planStatus != ''">
AND plan_status = #{planStatus}
</if>
<if test="params != null and (params.excludeDone == true or params.excludeDone == 'true')">
AND prod_status != 'Done'
</if>
<if test="params != null and params.beginTime != null and params.beginTime != ''">
AND DATE(create_time) >= #{params.beginTime}
</if>