加工完成添加任务明细历史记录
This commit is contained in:
		@@ -1,21 +1,25 @@
 | 
			
		||||
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.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.EqualsAndHashCode;
 | 
			
		||||
import lombok.experimental.Accessors;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * <p>
 | 
			
		||||
 * 任务历史表
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-12-14
 | 
			
		||||
 * @since 2022-08-01
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = false)
 | 
			
		||||
@@ -91,13 +95,13 @@ public class TaskHis extends Model<TaskHis> {
 | 
			
		||||
    private Long autoExeTaskId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 工业炉id,关联设备工业炉表:t_kiln_info
 | 
			
		||||
     * 窑炉id,关联设备窑炉表:t_kiln_info
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("kiln_id")
 | 
			
		||||
    private Long kilnId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 工业炉名称
 | 
			
		||||
     * 窑炉名称
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("kiln_name")
 | 
			
		||||
    private String kilnName;
 | 
			
		||||
@@ -145,13 +149,13 @@ public class TaskHis extends Model<TaskHis> {
 | 
			
		||||
    private String startPosition;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 目标位置指的是工业炉的位置
 | 
			
		||||
     * 目标位置指的是窑炉的位置
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("target_position")
 | 
			
		||||
    private String targetPosition;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 是否缓存,如果当前指的工业炉正在加工,系统自动分配货物到缓存位置,		      并且记录缓存库位,这是当指定工业炉加工完成后系统先判断是否当前缓存有当前等待执行的任务,然后按照先来先执行原则(等待多个任务)自动调用车辆来执行
 | 
			
		||||
     * 是否缓存,如果当前指的窑炉正在加工,系统自动分配货物到缓存位置,		      并且记录缓存库位,这是当指定窑炉加工完成后系统先判断是否当前缓存有当前等待执行的任务,然后按照先来先执行原则(等待多个任务)自动调用车辆来执行
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("is_cache")
 | 
			
		||||
    private Integer isCache;
 | 
			
		||||
@@ -217,7 +221,7 @@ public class TaskHis extends Model<TaskHis> {
 | 
			
		||||
    private Integer processType;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 任务类型:0:入库到工业炉,1:入库到缓存区,2出库到	工业炉到缓存区,3缓存区出库
 | 
			
		||||
     * 任务类型:0:入库到窑炉,1:入库到缓存区,2出库到	窑炉到缓存区,3缓存区出库
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("task_type")
 | 
			
		||||
    private Integer taskType;
 | 
			
		||||
@@ -228,6 +232,11 @@ public class TaskHis extends Model<TaskHis> {
 | 
			
		||||
    @TableField("sheet_no")
 | 
			
		||||
    private String sheetNo;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 生产单号 APMS生成生产单后返回
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("task_id")
 | 
			
		||||
    private Long taskId;
 | 
			
		||||
 | 
			
		||||
    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 TASK_ID = "task_id";
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected Serializable pkVal() {
 | 
			
		||||
        return this.id;
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-12-14
 | 
			
		||||
 * @since 2022-08-01
 | 
			
		||||
 */
 | 
			
		||||
public interface TaskHisMapper extends BaseMapper<TaskHis> {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -25,27 +25,25 @@
 | 
			
		||||
        <result column="run_task_id" property="runTaskId" />
 | 
			
		||||
        <result column="start_position" property="startPosition" />
 | 
			
		||||
        <result column="target_position" property="targetPosition" />
 | 
			
		||||
        <result column="is_cache" property="isCache"/>
 | 
			
		||||
        <result column="cache_satatus" property="cacheSatatus"/>
 | 
			
		||||
        <result column="cache_run_task_id" property="cacheRunTaskId"/>
 | 
			
		||||
        <result column="location_id" property="locationId"/>
 | 
			
		||||
        <result column="location_name" property="locationName"/>
 | 
			
		||||
        <result column="is_out" property="isOut"/>
 | 
			
		||||
        <result column="out_run_task_id" property="outRunTaskId"/>
 | 
			
		||||
        <result column="out_start_position" property="outStartPosition"/>
 | 
			
		||||
        <result column="out_target_position" property="outTargetPosition"/>
 | 
			
		||||
        <result column="task_code" property="taskCode"/>
 | 
			
		||||
        <result column="process_type" property="processType"/>
 | 
			
		||||
        <result column="task_type" property="taskType"/>
 | 
			
		||||
        <result column="sheet_no" property="sheetNo"/>
 | 
			
		||||
        <result column="is_cache" property="isCache" />
 | 
			
		||||
        <result column="cache_satatus" property="cacheSatatus" />
 | 
			
		||||
        <result column="cache_run_task_id" property="cacheRunTaskId" />
 | 
			
		||||
        <result column="location_id" property="locationId" />
 | 
			
		||||
        <result column="location_name" property="locationName" />
 | 
			
		||||
        <result column="is_out" property="isOut" />
 | 
			
		||||
        <result column="out_run_task_id" property="outRunTaskId" />
 | 
			
		||||
        <result column="out_start_position" property="outStartPosition" />
 | 
			
		||||
        <result column="out_target_position" property="outTargetPosition" />
 | 
			
		||||
        <result column="task_code" property="taskCode" />
 | 
			
		||||
        <result column="process_type" property="processType" />
 | 
			
		||||
        <result column="task_type" property="taskType" />
 | 
			
		||||
        <result column="sheet_no" property="sheetNo" />
 | 
			
		||||
        <result column="task_id" property="taskId" />
 | 
			
		||||
    </resultMap>
 | 
			
		||||
 | 
			
		||||
    <!-- 通用查询结果列 -->
 | 
			
		||||
    <sql id="Base_Column_List">
 | 
			
		||||
        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
 | 
			
		||||
        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
 | 
			
		||||
    </sql>
 | 
			
		||||
 | 
			
		||||
</mapper>
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-12-14
 | 
			
		||||
 * @since 2022-08-01
 | 
			
		||||
 */
 | 
			
		||||
public interface TaskHisServiceBiz extends IService<TaskHis> {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@ import org.springframework.stereotype.Service;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author mt
 | 
			
		||||
 * @since 2021-12-14
 | 
			
		||||
 * @since 2022-08-01
 | 
			
		||||
 */
 | 
			
		||||
@Service
 | 
			
		||||
public class TaskHisServiceBizImpl extends ServiceImpl<TaskHisMapper, TaskHis> implements TaskHisServiceBiz {
 | 
			
		||||
 
 | 
			
		||||
@@ -78,6 +78,8 @@ public class ScheduledTask extends BaseService {
 | 
			
		||||
    private AutoExeTaskServiceBiz autoExeTaskServiceBiz;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private TaskHisServiceBiz taskHisServiceBiz;
 | 
			
		||||
    @Resource
 | 
			
		||||
    private TaskDetHisServiceBiz taskDetHisServiceBiz;
 | 
			
		||||
 | 
			
		||||
    //@Scheduled(fixedDelay = 1000*20)
 | 
			
		||||
    @Test
 | 
			
		||||
@@ -236,7 +238,11 @@ public class ScheduledTask extends BaseService {
 | 
			
		||||
                        org.springframework.beans.BeanUtils.copyProperties(currTask,taskHis);
 | 
			
		||||
                        taskHis.setStatus(2);
 | 
			
		||||
                        taskHis.setIsIn(2);
 | 
			
		||||
                        taskHis.setTaskId(currTask.getId());
 | 
			
		||||
                        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);
 | 
			
		||||
                        logger.info(kilnInfo.getCode()+"炉子中的任务:"+currTask.getId()+"已加工结束,记录加工结束能源消耗值");
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user