From 26e38e002f87822c31242eb182a1c38ebd7a6b0c Mon Sep 17 00:00:00 2001 From: wanghao Date: Fri, 8 Nov 2024 13:51:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E5=B7=A1=E6=A3=80?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/api/controller/ApiController.java | 56 ++++++++++++------- .../java/com/ruoyi/api/mapper/ApiMapper.java | 16 +++++- .../ruoyi/api/service/impl/ApiService.java | 20 +++++-- .../src/main/resources/mapper/ApiMapper.xml | 28 ++++++++-- 4 files changed, 85 insertions(+), 35 deletions(-) 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 6c81cf5..bc5715c 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 @@ -173,7 +173,6 @@ public class ApiController { private IRecordInvalidatedService recordInvalidatedService; - @PostMapping("/xj/selectLite") public String xjSelectLite(String user) { List list = apiService.xjSelect(user); @@ -186,13 +185,21 @@ public class ApiController { @Autowired private IRecordInspectionService inspectionService; + @PostMapping("/inspection/skipTask") + public AjaxResult inspectionSubmit(long tableId, String remark) { + apiService.updataInspectionTaskByObjid(tableId,remark,"跳过"); + return success(); + } + @PostMapping("/xj/submit") - public AjaxResult inspectionSubmit(long tableId, String json, long inspectionId, String user,List files) { + public AjaxResult inspectionSubmit(long tableId, String json, long inspectionId, String user, List files) { //插入 info 表 List list = JSONObject.parseArray(json, StockDto.class); + String locationCode = list.get(0).getLocationCode(); + apiService.deleteInspectionInfo(locationCode, inspectionId); apiService.insertInspectionInfo(list, inspectionId); //修改task状态 - apiService.updataInspectionTaskByObjid(tableId); + apiService.updataInspectionTaskByObjid(tableId,null,"已完成"); //存储图片,插库 String filePath = RuoYiConfig.getUploadPath() + "/inspection"; @@ -205,7 +212,8 @@ public class ApiController { e.printStackTrace(); } System.out.println("上传图片路径:" + pathName); - apiService.insertInspetionPictrue(inspectionId, tableId,user, pathName); + + apiService.insertInspetionPictrue(inspectionId, tableId, user, pathName, locationCode); } } @@ -213,20 +221,6 @@ public class ApiController { } - /** - * 查询巡检机位 - * - * @param user - * @return - */ - @PostMapping("/inspection/selectTask") - public AjaxResult inspectionSelectTask(String user) { - List list = apiService.inspectionSelectTask(user); - if (list == null || list.isEmpty()) { - return error("需要创建"); - } - return success(list); - } /** * 根据机位查询轮挡 @@ -263,17 +257,37 @@ public class ApiController { } - + /** + * 查询巡检机位 + * + * @return + */ + @PostMapping("/inspection/selectTask") + public AjaxResult inspectionSelectTask(@RequestParam(value = "state", defaultValue = "") String state) { + try { + int inspectionid = apiService.selectCodeFromRecode(); + System.out.println(inspectionid + "-" + state); + List list = apiService.inspectionSelectTask(state, inspectionid); + // if (list == null || list.isEmpty()) { + // return error("需要领用轮挡到机位"); + // } + return success(list); + } catch (Exception e) { + e.printStackTrace(); + return error("需要创建"); + } + } /** * 轮挡报废 + * * @param epc * @param user * @param remark * @return */ @PostMapping("/bf/submit") - public AjaxResult bfSubmit(String epc, String reason,String user, String remark,List files) { + public AjaxResult bfSubmit(String epc, String reason, String user, String remark, List files) { //插入记录 RecordInvalidated recordInvalidated = new RecordInvalidated(); recordInvalidated.setEpc(epc); @@ -296,7 +310,7 @@ public class ApiController { e.printStackTrace(); } System.out.println("上传图片路径:" + pathName); - apiService.insertBfImg(recordInvalidated.getObjid(),epc,user, pathName); + apiService.insertBfImg(recordInvalidated.getObjid(), epc, user, pathName); } } 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 652bf15..29c1dd3 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 @@ -59,16 +59,22 @@ public interface ApiMapper { void insertCheckTask(@Param("id") int id,@Param("list") List list); - List inspectionSelectTask(String user); + List inspectionSelectTask(@Param("state") String state, + @Param("id")int id); List inspectionSelectLocation(String code); - void updataInspectionTaskByObjid(long tableId); + void updataInspectionTaskByObjid( @Param("tableId")long tableId, + @Param("remark") String remark, + @Param("state") String state + ); void insertInspetionPictrue(@Param("inspetionId") long inspectionId, @Param("tableId") long tableId, @Param("user") String user, - @Param("pathName") String pathName); + @Param("pathName") String pathName, + @Param("locationCode") String locationCode + ); void insertBfImg(@Param("objid") Long objid, @Param("epc") String epc, @@ -76,4 +82,8 @@ public interface ApiMapper { @Param("pathName") String pathName); List selectLocationFromLedger(); + + int selectCodeFromRecode(); + + void deleteInspectionInfo(@Param("inspectionId") long inspectionId,@Param("locationCode") String locationCode); } 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 984eb17..0774801 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 @@ -109,20 +109,20 @@ public class ApiService { mapper.insertCheckTask(id, list); } - public List inspectionSelectTask(String user) { - return mapper.inspectionSelectTask(user); + public List inspectionSelectTask(String state,int id) { + return mapper.inspectionSelectTask(state,id); } public List inspectionSelectLocation(String code) { return mapper.inspectionSelectLocation(code); } - public void updataInspectionTaskByObjid(long tableId) { - mapper.updataInspectionTaskByObjid(tableId); + public void updataInspectionTaskByObjid(long tableId, String remark,String state) { + mapper.updataInspectionTaskByObjid(tableId,remark,state); } - public void insertInspetionPictrue(long inspectionId, long tableId, String user, String pathName) { - mapper.insertInspetionPictrue(inspectionId, tableId,user, pathName); + public void insertInspetionPictrue(long inspectionId, long tableId, String user, String pathName,String locationCode) { + mapper.insertInspetionPictrue(inspectionId, tableId,user, pathName,locationCode); } public void insertBfImg(Long objid, String epc, String user, String pathName) { @@ -132,4 +132,12 @@ public class ApiService { public List selectLocationFromLedger() { return mapper.selectLocationFromLedger(); } + + public int selectCodeFromRecode() { + return mapper.selectCodeFromRecode(); + } + + public void deleteInspectionInfo(String locationCode, long inspectionId) { + mapper.deleteInspectionInfo(inspectionId,locationCode); + } } diff --git a/ruoyi-api/src/main/resources/mapper/ApiMapper.xml b/ruoyi-api/src/main/resources/mapper/ApiMapper.xml index 3688efd..a7dcec5 100644 --- a/ruoyi-api/src/main/resources/mapper/ApiMapper.xml +++ b/ruoyi-api/src/main/resources/mapper/ApiMapper.xml @@ -192,6 +192,7 @@ + @@ -221,8 +222,14 @@ task_state, rit.inspection_id from record_inspection_task rit - right join record_inspection ri on rit.inspection_id = ri.inspection_id - where inspection_user = #{user} + + + inspection_id=#{id} + + AND task_state = #{state} + + + - UPDATE record_inspection_task SET task_state = '完成' WHERE objid = #{tableId}; + UPDATE record_inspection_task SET task_state = #{state},remark = #{remark} WHERE objid = #{tableId}; - INSERT INTO record_inspection_img (inspection_id, task_id, img_path, create_by) - VALUES (#{inspetionId},#{tableId}, #{pathName}, #{user}); + INSERT INTO record_inspection_img (inspection_id, task_id, img_path, create_by,location_code) + VALUES (#{inspetionId},#{tableId}, #{pathName}, #{user},#{locationCode}); @@ -262,4 +269,15 @@ group by bl.location_code order by bl.location_code + + + + delete from bg_wheel_chocks.record_inspection_info where inspection_id = #{inspectionId} and location_code =#{locationCode} + \ No newline at end of file