加工完成添加任务明细历史记录

This commit is contained in:
李广豪 2022-08-01 21:58:21 +08:00
parent 2ee047474a
commit 9189d77953
6 changed files with 45 additions and 30 deletions

View File

@ -1,21 +1,25 @@
package com.mt.wms.core.dal.entity; package com.mt.wms.core.dal.entity;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.extension.activerecord.Model; import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
/** /**
* <p> * <p>
* 任务历史表 * 任务历史表
* </p> * </p>
* *
* @author mt * @author mt
* @since 2021-12-14 * @since 2022-08-01
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@ -91,13 +95,13 @@ public class TaskHis extends Model<TaskHis> {
private Long autoExeTaskId; private Long autoExeTaskId;
/** /**
* 工业炉id关联设备工业炉表t_kiln_info * 窑炉id关联设备窑炉表t_kiln_info
*/ */
@TableField("kiln_id") @TableField("kiln_id")
private Long kilnId; private Long kilnId;
/** /**
* 工业炉名称 * 炉名称
*/ */
@TableField("kiln_name") @TableField("kiln_name")
private String kilnName; private String kilnName;
@ -145,13 +149,13 @@ public class TaskHis extends Model<TaskHis> {
private String startPosition; private String startPosition;
/** /**
* 目标位置指的是工业炉的位置 * 目标位置指的是炉的位置
*/ */
@TableField("target_position") @TableField("target_position")
private String targetPosition; private String targetPosition;
/** /**
* 是否缓存如果当前指的工业炉正在加工系统自动分配货物到缓存位置 并且记录缓存库位这是当指定工业炉加工完成后系统先判断是否当前缓存有当前等待执行的任务然后按照先来先执行原则等待多个任务自动调用车辆来执行 * 是否缓存如果当前指的炉正在加工系统自动分配货物到缓存位置 并且记录缓存库位这是当指定炉加工完成后系统先判断是否当前缓存有当前等待执行的任务然后按照先来先执行原则等待多个任务自动调用车辆来执行
*/ */
@TableField("is_cache") @TableField("is_cache")
private Integer isCache; private Integer isCache;
@ -217,7 +221,7 @@ public class TaskHis extends Model<TaskHis> {
private Integer processType; private Integer processType;
/** /**
* 任务类型0:入库到工业1:入库到缓存区2出库到 工业炉到缓存区3缓存区出库 * 任务类型0:入库到1:入库到缓存区2出库到 炉到缓存区3缓存区出库
*/ */
@TableField("task_type") @TableField("task_type")
private Integer taskType; private Integer taskType;
@ -228,6 +232,11 @@ public class TaskHis extends Model<TaskHis> {
@TableField("sheet_no") @TableField("sheet_no")
private String sheetNo; private String sheetNo;
/**
* 生产单号 APMS生成生产单后返回
*/
@TableField("task_id")
private Long taskId;
public static final String ID = "id"; public static final String ID = "id";
@ -297,6 +306,8 @@ public class TaskHis extends Model<TaskHis> {
public static final String SHEET_NO = "sheet_no"; public static final String SHEET_NO = "sheet_no";
public static final String TASK_ID = "task_id";
@Override @Override
protected Serializable pkVal() { protected Serializable pkVal() {
return this.id; return this.id;

View File

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* </p> * </p>
* *
* @author mt * @author mt
* @since 2021-12-14 * @since 2022-08-01
*/ */
public interface TaskHisMapper extends BaseMapper<TaskHis> { public interface TaskHisMapper extends BaseMapper<TaskHis> {

View File

@ -25,27 +25,25 @@
<result column="run_task_id" property="runTaskId" /> <result column="run_task_id" property="runTaskId" />
<result column="start_position" property="startPosition" /> <result column="start_position" property="startPosition" />
<result column="target_position" property="targetPosition" /> <result column="target_position" property="targetPosition" />
<result column="is_cache" property="isCache"/> <result column="is_cache" property="isCache" />
<result column="cache_satatus" property="cacheSatatus"/> <result column="cache_satatus" property="cacheSatatus" />
<result column="cache_run_task_id" property="cacheRunTaskId"/> <result column="cache_run_task_id" property="cacheRunTaskId" />
<result column="location_id" property="locationId"/> <result column="location_id" property="locationId" />
<result column="location_name" property="locationName"/> <result column="location_name" property="locationName" />
<result column="is_out" property="isOut"/> <result column="is_out" property="isOut" />
<result column="out_run_task_id" property="outRunTaskId"/> <result column="out_run_task_id" property="outRunTaskId" />
<result column="out_start_position" property="outStartPosition"/> <result column="out_start_position" property="outStartPosition" />
<result column="out_target_position" property="outTargetPosition"/> <result column="out_target_position" property="outTargetPosition" />
<result column="task_code" property="taskCode"/> <result column="task_code" property="taskCode" />
<result column="process_type" property="processType"/> <result column="process_type" property="processType" />
<result column="task_type" property="taskType"/> <result column="task_type" property="taskType" />
<result column="sheet_no" property="sheetNo"/> <result column="sheet_no" property="sheetNo" />
<result column="task_id" property="taskId" />
</resultMap> </resultMap>
<!-- 通用查询结果列 --> <!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, valid, create_time, creator_id, updater_id, update_time, version, status, inter_code, is_auto, id, valid, create_time, creator_id, updater_id, update_time, version, status, inter_code, is_auto, auto_exe_task_id, kiln_id, kiln_name, craft_code_id, plc_value, begin_time, end_time, is_in, run_task_id, start_position, target_position, is_cache, cache_satatus, cache_run_task_id, location_id, location_name, is_out, out_run_task_id, out_start_position, out_target_position, task_code, process_type, task_type, sheet_no, task_id
auto_exe_task_id, kiln_id, kiln_name, craft_code_id, plc_value, begin_time, end_time, is_in, run_task_id,
start_position, target_position, is_cache, cache_satatus, cache_run_task_id, location_id, location_name, is_out,
out_run_task_id, out_start_position, out_target_position, task_code, process_type, task_type, sheet_no
</sql> </sql>
</mapper> </mapper>

View File

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
* </p> * </p>
* *
* @author mt * @author mt
* @since 2021-12-14 * @since 2022-08-01
*/ */
public interface TaskHisServiceBiz extends IService<TaskHis> { public interface TaskHisServiceBiz extends IService<TaskHis> {

View File

@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
* </p> * </p>
* *
* @author mt * @author mt
* @since 2021-12-14 * @since 2022-08-01
*/ */
@Service @Service
public class TaskHisServiceBizImpl extends ServiceImpl<TaskHisMapper, TaskHis> implements TaskHisServiceBiz { public class TaskHisServiceBizImpl extends ServiceImpl<TaskHisMapper, TaskHis> implements TaskHisServiceBiz {

View File

@ -78,6 +78,8 @@ public class ScheduledTask extends BaseService {
private AutoExeTaskServiceBiz autoExeTaskServiceBiz; private AutoExeTaskServiceBiz autoExeTaskServiceBiz;
@Resource @Resource
private TaskHisServiceBiz taskHisServiceBiz; private TaskHisServiceBiz taskHisServiceBiz;
@Resource
private TaskDetHisServiceBiz taskDetHisServiceBiz;
//@Scheduled(fixedDelay = 1000*20) //@Scheduled(fixedDelay = 1000*20)
@Test @Test
@ -236,7 +238,11 @@ public class ScheduledTask extends BaseService {
org.springframework.beans.BeanUtils.copyProperties(currTask,taskHis); org.springframework.beans.BeanUtils.copyProperties(currTask,taskHis);
taskHis.setStatus(2); taskHis.setStatus(2);
taskHis.setIsIn(2); taskHis.setIsIn(2);
taskHis.setTaskId(currTask.getId());
taskHisServiceBiz.save(taskHis); taskHisServiceBiz.save(taskHis);
List<CurrTaskDet> currTaskDets = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask.getId()));
List<TaskDetHis> taskDetHisList = BeanUtils.copyList(currTaskDets, TaskDetHis.class);
taskDetHisServiceBiz.saveBatch(taskDetHisList);
//加工结束而没有立马出炉加工结束记录能源消耗值只记录一次 //加工结束而没有立马出炉加工结束记录能源消耗值只记录一次
asynRunTaskService.asynEndRecordConsume(currTask.getId(),kilnId); asynRunTaskService.asynEndRecordConsume(currTask.getId(),kilnId);
logger.info(kilnInfo.getCode()+"炉子中的任务:"+currTask.getId()+"已加工结束,记录加工结束能源消耗值"); logger.info(kilnInfo.getCode()+"炉子中的任务:"+currTask.getId()+"已加工结束,记录加工结束能源消耗值");