diff --git a/ruoyi-api/src/main/java/com/ruoyi/api/controller/ApiController.java b/ruoyi-api/src/main/java/com/ruoyi/api/controller/ApiController.java index e3326d0..6c81cf5 100644 --- a/ruoyi-api/src/main/java/com/ruoyi/api/controller/ApiController.java +++ b/ruoyi-api/src/main/java/com/ruoyi/api/controller/ApiController.java @@ -262,6 +262,9 @@ public class ApiController { return success("创建成功", insertNumber); } + + + /** * 轮挡报废 * @param epc diff --git a/ruoyi-api/src/main/java/com/ruoyi/api/mapper/ApiMapper.java b/ruoyi-api/src/main/java/com/ruoyi/api/mapper/ApiMapper.java index 11e431f..652bf15 100644 --- a/ruoyi-api/src/main/java/com/ruoyi/api/mapper/ApiMapper.java +++ b/ruoyi-api/src/main/java/com/ruoyi/api/mapper/ApiMapper.java @@ -74,4 +74,6 @@ public interface ApiMapper { @Param("epc") String epc, @Param("user") String user, @Param("pathName") String pathName); + + List selectLocationFromLedger(); } diff --git a/ruoyi-api/src/main/java/com/ruoyi/api/service/impl/ApiService.java b/ruoyi-api/src/main/java/com/ruoyi/api/service/impl/ApiService.java index 38122db..984eb17 100644 --- a/ruoyi-api/src/main/java/com/ruoyi/api/service/impl/ApiService.java +++ b/ruoyi-api/src/main/java/com/ruoyi/api/service/impl/ApiService.java @@ -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 selectLocationFromLedger() { + return mapper.selectLocationFromLedger(); + } } diff --git a/ruoyi-api/src/main/java/com/ruoyi/api/service/impl/TaskService.java b/ruoyi-api/src/main/java/com/ruoyi/api/service/impl/TaskService.java new file mode 100644 index 0000000..89b9675 --- /dev/null +++ b/ruoyi-api/src/main/java/com/ruoyi/api/service/impl/TaskService.java @@ -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 list = mapper.selectLocationFromLedger(); + mapper.insertCheckTask(Math.toIntExact(recordInspection.getInspectionId()), list); + } +} diff --git a/ruoyi-api/src/main/resources/mapper/ApiMapper.xml b/ruoyi-api/src/main/resources/mapper/ApiMapper.xml index 066798a..3688efd 100644 --- a/ruoyi-api/src/main/resources/mapper/ApiMapper.xml +++ b/ruoyi-api/src/main/resources/mapper/ApiMapper.xml @@ -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 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 + \ No newline at end of file diff --git a/ruoyi-manage/src/main/java/com/ruoyi/manage/domain/RecordInspection.java b/ruoyi-manage/src/main/java/com/ruoyi/manage/domain/RecordInspection.java index 3b1f5de..c4ba9f9 100644 --- a/ruoyi-manage/src/main/java/com/ruoyi/manage/domain/RecordInspection.java +++ b/ruoyi-manage/src/main/java/com/ruoyi/manage/domain/RecordInspection.java @@ -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,7 +35,15 @@ public class RecordInspection extends BaseEntity private int abnormalNumber; private int skipNumber; - public void setInspectionId(Long inspectionId) + public String getInspectionCode() { + return inspectionCode; + } + + public void setInspectionCode(String inspectionCode) { + this.inspectionCode = inspectionCode; + } + + public void setInspectionId(Long inspectionId) { this.inspectionId = inspectionId; } diff --git a/ruoyi-manage/src/main/java/com/ruoyi/manage/mapper/RecordInspectionMapper.java b/ruoyi-manage/src/main/java/com/ruoyi/manage/mapper/RecordInspectionMapper.java index a36eabd..e104b9c 100644 --- a/ruoyi-manage/src/main/java/com/ruoyi/manage/mapper/RecordInspectionMapper.java +++ b/ruoyi-manage/src/main/java/com/ruoyi/manage/mapper/RecordInspectionMapper.java @@ -59,4 +59,6 @@ public interface RecordInspectionMapper * @return 结果 */ public int deleteRecordInspectionByInspectionIds(String[] inspectionIds); + + int countInsertRecordNumber(); } diff --git a/ruoyi-manage/src/main/java/com/ruoyi/manage/service/IRecordInspectionService.java b/ruoyi-manage/src/main/java/com/ruoyi/manage/service/IRecordInspectionService.java index 6356fea..30dda54 100644 --- a/ruoyi-manage/src/main/java/com/ruoyi/manage/service/IRecordInspectionService.java +++ b/ruoyi-manage/src/main/java/com/ruoyi/manage/service/IRecordInspectionService.java @@ -58,4 +58,6 @@ public interface IRecordInspectionService * @return 结果 */ public int deleteRecordInspectionByInspectionId(Long inspectionId); + + } diff --git a/ruoyi-manage/src/main/java/com/ruoyi/manage/service/impl/RecordInspectionServiceImpl.java b/ruoyi-manage/src/main/java/com/ruoyi/manage/service/impl/RecordInspectionServiceImpl.java index 3b53a2d..7567d85 100644 --- a/ruoyi-manage/src/main/java/com/ruoyi/manage/service/impl/RecordInspectionServiceImpl.java +++ b/ruoyi-manage/src/main/java/com/ruoyi/manage/service/impl/RecordInspectionServiceImpl.java @@ -92,4 +92,6 @@ public class RecordInspectionServiceImpl implements IRecordInspectionService { infoMapper.deleteRecordInspectionInfoByInspectionId(inspectionId); return recordInspectionMapper.deleteRecordInspectionByInspectionId(inspectionId); } + + } diff --git a/ruoyi-manage/src/main/resources/mapper/manage/RecordInspectionMapper.xml b/ruoyi-manage/src/main/resources/mapper/manage/RecordInspectionMapper.xml index 756c04f..0b50270 100644 --- a/ruoyi-manage/src/main/resources/mapper/manage/RecordInspectionMapper.xml +++ b/ruoyi-manage/src/main/resources/mapper/manage/RecordInspectionMapper.xml @@ -8,6 +8,7 @@ + @@ -48,11 +49,11 @@ insert into record_inspection inspection_time, - inspection_user, + inspection_code, #{inspectionTime}, - #{inspectionUser}, + #{inspectionCode}, @@ -78,4 +79,8 @@ + + \ No newline at end of file