增加 定时任务创建巡检

master
wanghao 2 months ago
parent 2692d5f280
commit e512f702d3

@ -262,6 +262,9 @@ public class ApiController {
return success("创建成功", insertNumber);
}
/**
*
* @param epc

@ -74,4 +74,6 @@ public interface ApiMapper {
@Param("epc") String epc,
@Param("user") String user,
@Param("pathName") String pathName);
List<CheckTaskInfo> selectLocationFromLedger();
}

@ -128,4 +128,8 @@ public class ApiService {
public void insertBfImg(Long objid, String epc, String user, String pathName) {
mapper.insertBfImg(objid,epc,user, pathName);
}
public List<CheckTaskInfo> selectLocationFromLedger() {
return mapper.selectLocationFromLedger();
}
}

@ -0,0 +1,38 @@
package com.ruoyi.api.service.impl;
import com.ruoyi.api.domain.CheckTaskInfo;
import com.ruoyi.api.mapper.ApiMapper;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.manage.domain.RecordInspection;
import com.ruoyi.manage.mapper.RecordInspectionMapper;
import com.ruoyi.manage.service.IRecordInspectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
@Service
@Component("TaskService")
public class TaskService {
@Autowired
private ApiMapper mapper;
@Autowired
private RecordInspectionMapper recordInspectionMapper;
//定时任务创建巡检单
public void inspectionCreate(){
System.out.println("创建成功");
int number=recordInspectionMapper.countInsertRecordNumber();
number++;
RecordInspection recordInspection = new RecordInspection();
recordInspection.setInspectionCode(DateUtils.parseDateToStr("yyyyMMdd",new Date())+"00"+number);
System.out.println();
//插入主表
int insertNumber = recordInspectionMapper.insertRecordInspection(recordInspection);
List<CheckTaskInfo> list = mapper.selectLocationFromLedger();
mapper.insertCheckTask(Math.toIntExact(recordInspection.getInspectionId()), list);
}
}

@ -222,8 +222,7 @@
rit.inspection_id
from record_inspection_task rit
right join record_inspection ri on rit.inspection_id = ri.inspection_id
where task_state = '待完成'
and inspection_user = #{user}
where inspection_user = #{user}
</select>
<select id="inspectionSelectLocation" resultType="com.ruoyi.api.domain.StockDto">
@ -250,4 +249,17 @@
INSERT INTO bg_wheel_chocks.record_invalidated_img (invalidated_id, epc, img_path, create_by)
VALUES (#{objid}, #{epc},#{pathName},#{user});
</insert>
<!--查询台账绑定RFID的机位信息-->
<select id="selectLocationFromLedger" resultMap="checkTaskResultMap">
select lr.location_code,
bs.store_name,
bs.store_id
from ledger_rfid lr
left join base_location bl on lr.location_code = bl.location_code
left join base_store bs on bl.store_id = bs.store_id
where lr.location_type = 2
and is_scrap = 1
group by bl.location_code
order by bl.location_code
</select>
</mapper>

@ -25,6 +25,7 @@ public class RecordInspection extends BaseEntity
@Excel(name = "巡检时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date inspectionTime;
private String inspectionCode;
/** 巡检人 */
@Excel(name = "巡检人")
private String inspectionUser;
@ -34,6 +35,14 @@ public class RecordInspection extends BaseEntity
private int abnormalNumber;
private int skipNumber;
public String getInspectionCode() {
return inspectionCode;
}
public void setInspectionCode(String inspectionCode) {
this.inspectionCode = inspectionCode;
}
public void setInspectionId(Long inspectionId)
{
this.inspectionId = inspectionId;

@ -59,4 +59,6 @@ public interface RecordInspectionMapper
* @return
*/
public int deleteRecordInspectionByInspectionIds(String[] inspectionIds);
int countInsertRecordNumber();
}

@ -58,4 +58,6 @@ public interface IRecordInspectionService
* @return
*/
public int deleteRecordInspectionByInspectionId(Long inspectionId);
}

@ -92,4 +92,6 @@ public class RecordInspectionServiceImpl implements IRecordInspectionService {
infoMapper.deleteRecordInspectionInfoByInspectionId(inspectionId);
return recordInspectionMapper.deleteRecordInspectionByInspectionId(inspectionId);
}
}

@ -8,6 +8,7 @@
<result property="inspectionId" column="inspection_id"/>
<result property="inspectionTime" column="inspection_time"/>
<result property="inspectionUser" column="inspection_user"/>
<result property="inspectionCode" column="inspection_code"/>
<result property="totalNumber" column="total_number"/>
<result property="normalNumber" column="normal_number"/>
<result property="abnormalNumber" column="abnormal_number"/>
@ -48,11 +49,11 @@
insert into record_inspection
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="inspectionTime != null">inspection_time,</if>
<if test="inspectionUser != null">inspection_user,</if>
<if test="inspectionCode != null">inspection_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="inspectionTime != null">#{inspectionTime},</if>
<if test="inspectionUser != null">#{inspectionUser},</if>
<if test="inspectionCode != null">#{inspectionCode},</if>
</trim>
</insert>
@ -78,4 +79,8 @@
</foreach>
</delete>
<select id="countInsertRecordNumber" resultType="integer">
select count(inspection_id) from record_inspection where date(inspection_time)= date(now())
</select>
</mapper>
Loading…
Cancel
Save