zwl
9 天以前 bedc112e8ee3b8b52a5ba7f610fdc69a9b23e394
新增堆垛机报警日志
3个文件已修改
1个文件已添加
124 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/entity/BasCrnp.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/BasErrLog.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/task/BasErrLogScheduler.java 93 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/wms/js/basErrLog/basErrLog.js 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/BasCrnp.java
@@ -124,6 +124,11 @@
    @TableField("hp_mk")
    private String hpMk;
    /**
     * 异常记录标记
     * N可以对异常进行记录
     * Y异常已经记录
     */
    @ApiModelProperty(value= "")
    @TableField("retrieve_mk")
    private String retrieveMk;
src/main/java/com/zy/asrs/entity/BasErrLog.java
@@ -6,6 +6,8 @@
import com.baomidou.mybatisplus.enums.IdType;
import com.core.common.Cools;
import com.core.common.SpringUtils;
import com.zy.asrs.service.BasWrkIotypeService;
import com.zy.asrs.service.BasWrkStatusService;
import com.zy.system.entity.User;
import com.zy.system.service.UserService;
import io.swagger.annotations.ApiModelProperty;
@@ -170,6 +172,24 @@
    public BasErrLog() {}
    public String getIoType$(){
        BasWrkIotypeService service = SpringUtils.getBean(BasWrkIotypeService.class);
        BasWrkIotype basWrkIotype = service.selectById(this.ioType);
        if (!Cools.isEmpty(basWrkIotype)){
            return String.valueOf(basWrkIotype.getIoDesc());
        }
        return null;
    }
    public String getWrkSts$(){
        BasWrkStatusService service = SpringUtils.getBean(BasWrkStatusService.class);
        BasWrkStatus basWrkStatus = service.selectById(this.wrkSts);
        if (!Cools.isEmpty(basWrkStatus)){
            return String.valueOf(basWrkStatus.getWrkDesc());
        }
        return null;
    }
    public BasErrLog(String uuid,Integer wrkNo,Date startTime,Date endTime,Long wrkSts,Integer ioType,Integer crnNo,Integer plcNo,String locNo,Integer staNo,Integer sourceStaNo,String sourceLocNo,String barcode,Integer errCode,String error,Integer status,Date createTime,Long createBy,Date updateTime,Long updateBy,String memo) {
        this.uuid = uuid;
        this.wrkNo = wrkNo;
src/main/java/com/zy/asrs/task/BasErrLogScheduler.java
New file
@@ -0,0 +1,93 @@
package com.zy.asrs.task;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;
import com.core.exception.CoolException;
import com.zy.asrs.entity.BasCrnError;
import com.zy.asrs.entity.BasCrnp;
import com.zy.asrs.entity.BasErrLog;
import com.zy.asrs.entity.TaskWrk;
import com.zy.asrs.service.BasCrnErrorService;
import com.zy.asrs.service.BasCrnpService;
import com.zy.asrs.service.BasErrLogService;
import com.zy.asrs.service.TaskWrkService;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.Date;
import java.util.List;
/**
 * 定时获取堆垛机报警,进行记录
 */
@Slf4j
@Component
public class BasErrLogScheduler {
    @Autowired
    private BasErrLogService basErrLogService;
    @Autowired
    private BasCrnpService basCrnpService;
    @Autowired
    private TaskWrkService taskWrkService;
    @Autowired
    private BasCrnErrorService  basCrnErrorService;
    @Scheduled(cron = "0/3 * * * * ? ")
    public void execute() throws IOException {
        //对有异常的堆垛机进行异常记录
        List<BasCrnp> basCrnps=basCrnpService.selectList(new EntityWrapper<BasCrnp>().ge("crn_err",1));
        if(!Cools.isEmpty(basCrnps)){
            for(BasCrnp basCrnp:basCrnps){
                Integer wrkNo=basCrnp.getWrkNo();
                Integer ioType = 0;
                Long wrkSts= 0L;
                String error="";
                if(Cools.isEmpty(basCrnp.getRetrieveMk())||basCrnp.getRetrieveMk().equals("N")){
                    BasCrnError basCrnError=basCrnErrorService.selectOne(new EntityWrapper<BasCrnError>().eq("error_code",Math.toIntExact(basCrnp.getCrnErr())));
                    if(!Cools.isEmpty(basCrnError)){
                        error = basCrnError.getErrName();
                    }
                    BasErrLog basErrLog=new BasErrLog();
                    if(basCrnp.getWrkNo()>0){
                        TaskWrk taskWrk=taskWrkService.selectOne(new EntityWrapper<TaskWrk>()
                                .eq("crn_no",basCrnp.getCrnNo())
                                .eq("wrk_no",basCrnp.getWrkNo()));
                        if(taskWrk!=null){
                            wrkNo=taskWrk.getWrkNo();
                            ioType=taskWrk.getIoType();
                            wrkSts=taskWrk.getWrkSts().longValue();
                        }
                    }
                    basErrLog.setWrkNo(wrkNo);
                    basErrLog.setWrkSts(wrkSts);
                    basErrLog.setIoType(ioType);
                    basErrLog.setStartTime(new Date());
                    basErrLog.setCrnNo(basCrnp.getCrnNo());
                    basErrLog.setErrCode(Math.toIntExact(basCrnp.getCrnErr()));
                    basErrLog.setError(error);
                    if(basErrLogService.insert(basErrLog)){
                        basCrnp.setRetrieveMk("Y");
                        basCrnpService.updateById(basCrnp);
                    }
                }
            }
        }
        //对没异常的堆垛机进行异常记号复位
        List<BasCrnp> basCrnps1 = basCrnpService.selectList(new EntityWrapper<BasCrnp>().eq("crn_err", 0).eq("retrieve_mk", "Y"));
        for(BasCrnp basCrnp:basCrnps1){
            basCrnp.setRetrieveMk("N");
            basCrnpService.updateById(basCrnp);
        }
    }
}
src/main/webapp/static/wms/js/basErrLog/basErrLog.js
@@ -22,8 +22,8 @@
//            ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80}
            ,{field: 'uuid', align: 'center',title: '编号', hide: true}
            ,{field: 'wrkNo', align: 'center',title: '任务号'}
            ,{field: 'startTime$', align: 'center',title: '发生时间'}
            ,{field: 'endTime$', align: 'center',title: '结束时间'}
            ,{field: 'startTime$', align: 'center',title: '创建时间'}
            ,{field: 'endTime$', align: 'center',title: '结束时间', hide: true}
            ,{field: 'wrkSts$', align: 'center',title: '任务状态'}
            ,{field: 'ioType$', align: 'center',title: '入出库类型'}
            ,{field: 'crnNo', align: 'center',title: '堆垛机'}
@@ -35,7 +35,7 @@
            ,{field: 'barcode', align: 'center',title: '条码', hide: true}
            ,{field: 'errCode', align: 'center',title: '异常码'}
            ,{field: 'error', align: 'center',title: '异常描述'}
            ,{field: 'status$', align: 'center',title: '异常情况'}
            ,{field: 'status$', align: 'center',title: '异常情况', hide: true}
            // ,{field: 'createTime$', align: 'center',title: '添加时间'}
            // ,{field: 'createBy$', align: 'center',title: '添加人员'}
            ,{field: 'updateTime$', align: 'center',title: '修改时间', hide: true}