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 6029194..3442d1d 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 @@ -191,13 +191,26 @@ public class ApiController { return success(); } + /** + * 完成巡检 + * + * @param tableId + * @param json + * @param inspectionId + * @param user + * @param files + * @return + */ @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,String locationCode, List files) { //插入 info 表 List list = JSONObject.parseArray(json, StockDto.class); - String locationCode = list.get(0).getLocationCode(); - apiService.deleteInspectionInfo(locationCode, inspectionId); - apiService.insertInspectionInfo(list, inspectionId); + if (list != null && !list.isEmpty()) { + + apiService.deleteInspectionInfo(locationCode, inspectionId); + apiService.insertInspectionInfo(list, inspectionId); + } + //修改task状态 apiService.updataInspectionTaskByObjid(tableId, null, "已完成"); @@ -298,7 +311,7 @@ public class ApiController { recordInvalidated.setTypeName(Long.valueOf(type)); recordInvalidatedService.insertRecordInvalidated(recordInvalidated); //修改台账 - apiService.updataLedgerForBf(epc, type+""); + apiService.updataLedgerForBf(epc, type + ""); //存储图片,插库 String filePath = RuoYiConfig.getUploadPath() + "/inspection"; if (files != null && files.size() > 0) { diff --git a/ruoyi-manage/src/main/java/com/ruoyi/manage/controller/RecordInspectionController.java b/ruoyi-manage/src/main/java/com/ruoyi/manage/controller/RecordInspectionController.java index cfee233..3ddc772 100644 --- a/ruoyi-manage/src/main/java/com/ruoyi/manage/controller/RecordInspectionController.java +++ b/ruoyi-manage/src/main/java/com/ruoyi/manage/controller/RecordInspectionController.java @@ -1,6 +1,11 @@ package com.ruoyi.manage.controller; import java.util.List; + +import com.ruoyi.manage.domain.RecordInspectionImg; +import com.ruoyi.manage.domain.RecordInspectionInfo; +import com.ruoyi.manage.service.IRecordInspectionImgService; +import com.ruoyi.manage.service.IRecordInspectionInfoService; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -21,39 +26,51 @@ import com.ruoyi.common.core.page.TableDataInfo; /** * 巡检记录Controller - * + * * @author wangh * @date 2024-02-18 */ @Controller @RequestMapping("/manage/record_inspection") -public class RecordInspectionController extends BaseController -{ +public class RecordInspectionController extends BaseController { private String prefix = "manage/record_inspection"; - + @Autowired + private IRecordInspectionInfoService recordInspectionInfoService; + @Autowired + private IRecordInspectionImgService recordInspectionImgService; @Autowired private IRecordInspectionService recordInspectionService; @RequiresPermissions("manage:record_inspection:view") @GetMapping() - public String record_inspection() - { + public String record_inspection() { return prefix + "/record_inspection"; } + @GetMapping("/imgGroup") - public String record_img() - { + public String record_img() { return prefix + "/record_img_group"; } + @GetMapping("/print") + public String print(String ids) { + System.out.println(ids); + + List list=recordInspectionInfoService.selectInfoByInspectionId(ids); + System.out.println("巡检记录"+list.size()); + List recordInspectionImgs = recordInspectionImgService.selectImgByInspectionId(ids); + System.out.println("巡检图片"+recordInspectionImgs.size()); + return prefix +""; + } + + /** * 查询巡检记录列表 */ @RequiresPermissions("manage:record_inspection:list") @PostMapping("/list") @ResponseBody - public TableDataInfo list(RecordInspection recordInspection) - { + public TableDataInfo list(RecordInspection recordInspection) { startPage(); List list = recordInspectionService.selectRecordInspectionList(recordInspection); return getDataTable(list); @@ -66,8 +83,7 @@ public class RecordInspectionController extends BaseController @Log(title = "巡检记录", businessType = BusinessType.EXPORT) @PostMapping("/export") @ResponseBody - public AjaxResult export(RecordInspection recordInspection) - { + public AjaxResult export(RecordInspection recordInspection) { List list = recordInspectionService.selectRecordInspectionList(recordInspection); ExcelUtil util = new ExcelUtil(RecordInspection.class); return util.exportExcel(list, "巡检记录数据"); @@ -77,8 +93,7 @@ public class RecordInspectionController extends BaseController * 新增巡检记录 */ @GetMapping("/add") - public String add() - { + public String add() { return prefix + "/add"; } @@ -89,8 +104,7 @@ public class RecordInspectionController extends BaseController @Log(title = "巡检记录", businessType = BusinessType.INSERT) @PostMapping("/add") @ResponseBody - public AjaxResult addSave(RecordInspection recordInspection) - { + public AjaxResult addSave(RecordInspection recordInspection) { return toAjax(recordInspectionService.insertRecordInspection(recordInspection)); } @@ -99,8 +113,7 @@ public class RecordInspectionController extends BaseController */ @RequiresPermissions("manage:record_inspection:edit") @GetMapping("/edit/{inspectionId}") - public String edit(@PathVariable("inspectionId") Long inspectionId, ModelMap mmap) - { + public String edit(@PathVariable("inspectionId") Long inspectionId, ModelMap mmap) { RecordInspection recordInspection = recordInspectionService.selectRecordInspectionByInspectionId(inspectionId); mmap.put("recordInspection", recordInspection); return prefix + "/edit"; @@ -113,8 +126,7 @@ public class RecordInspectionController extends BaseController @Log(title = "巡检记录", businessType = BusinessType.UPDATE) @PostMapping("/edit") @ResponseBody - public AjaxResult editSave(RecordInspection recordInspection) - { + public AjaxResult editSave(RecordInspection recordInspection) { return toAjax(recordInspectionService.updateRecordInspection(recordInspection)); } @@ -123,10 +135,9 @@ public class RecordInspectionController extends BaseController */ @RequiresPermissions("manage:record_inspection:remove") @Log(title = "巡检记录", businessType = BusinessType.DELETE) - @PostMapping( "/remove") + @PostMapping("/remove") @ResponseBody - public AjaxResult remove(String ids) - { + public AjaxResult remove(String ids) { return toAjax(recordInspectionService.deleteRecordInspectionByInspectionIds(ids)); } } diff --git a/ruoyi-manage/src/main/java/com/ruoyi/manage/mapper/RecordInspectionImgMapper.java b/ruoyi-manage/src/main/java/com/ruoyi/manage/mapper/RecordInspectionImgMapper.java index a9e6a75..ac7552c 100644 --- a/ruoyi-manage/src/main/java/com/ruoyi/manage/mapper/RecordInspectionImgMapper.java +++ b/ruoyi-manage/src/main/java/com/ruoyi/manage/mapper/RecordInspectionImgMapper.java @@ -61,4 +61,6 @@ public interface RecordInspectionImgMapper public int deleteRecordInspectionImgByInspectionIds(String[] inspectionIds); List selectRecordInspectionlocationList(RecordInspectionImg recordInspectionImg); + + List recordInspectionImgMapper(String[] strArray); } diff --git a/ruoyi-manage/src/main/java/com/ruoyi/manage/mapper/RecordInspectionInfoMapper.java b/ruoyi-manage/src/main/java/com/ruoyi/manage/mapper/RecordInspectionInfoMapper.java index df75bb8..9106e57 100644 --- a/ruoyi-manage/src/main/java/com/ruoyi/manage/mapper/RecordInspectionInfoMapper.java +++ b/ruoyi-manage/src/main/java/com/ruoyi/manage/mapper/RecordInspectionInfoMapper.java @@ -59,4 +59,6 @@ public interface RecordInspectionInfoMapper * @return 结果 */ public int deleteRecordInspectionInfoByInspectionIds(String[] inspectionIds); + + List selectInfoByInspectionId(String[] inspectionIds); } diff --git a/ruoyi-manage/src/main/java/com/ruoyi/manage/service/IRecordInspectionImgService.java b/ruoyi-manage/src/main/java/com/ruoyi/manage/service/IRecordInspectionImgService.java index ed8721f..9d352ab 100644 --- a/ruoyi-manage/src/main/java/com/ruoyi/manage/service/IRecordInspectionImgService.java +++ b/ruoyi-manage/src/main/java/com/ruoyi/manage/service/IRecordInspectionImgService.java @@ -60,4 +60,6 @@ public interface IRecordInspectionImgService public int deleteRecordInspectionImgByInspectionId(Long inspectionId); List selectRecordInspectionlocationList(RecordInspectionImg recordInspectionImg); + + List selectImgByInspectionId(String ids); } diff --git a/ruoyi-manage/src/main/java/com/ruoyi/manage/service/IRecordInspectionInfoService.java b/ruoyi-manage/src/main/java/com/ruoyi/manage/service/IRecordInspectionInfoService.java index cb48c56..a55c9f6 100644 --- a/ruoyi-manage/src/main/java/com/ruoyi/manage/service/IRecordInspectionInfoService.java +++ b/ruoyi-manage/src/main/java/com/ruoyi/manage/service/IRecordInspectionInfoService.java @@ -58,4 +58,6 @@ public interface IRecordInspectionInfoService * @return 结果 */ public int deleteRecordInspectionInfoByInspectionId(Long inspectionId); + + List selectInfoByInspectionId(String ids); } diff --git a/ruoyi-manage/src/main/java/com/ruoyi/manage/service/impl/RecordInspectionImgServiceImpl.java b/ruoyi-manage/src/main/java/com/ruoyi/manage/service/impl/RecordInspectionImgServiceImpl.java index 638eca0..89d47df 100644 --- a/ruoyi-manage/src/main/java/com/ruoyi/manage/service/impl/RecordInspectionImgServiceImpl.java +++ b/ruoyi-manage/src/main/java/com/ruoyi/manage/service/impl/RecordInspectionImgServiceImpl.java @@ -100,4 +100,9 @@ public class RecordInspectionImgServiceImpl implements IRecordInspectionImgServi public List selectRecordInspectionlocationList(RecordInspectionImg recordInspectionImg) { return recordInspectionImgMapper.selectRecordInspectionlocationList( recordInspectionImg); } + + @Override + public List selectImgByInspectionId(String ids) { + return recordInspectionImgMapper.recordInspectionImgMapper(Convert.toStrArray(ids)); + } } diff --git a/ruoyi-manage/src/main/java/com/ruoyi/manage/service/impl/RecordInspectionInfoServiceImpl.java b/ruoyi-manage/src/main/java/com/ruoyi/manage/service/impl/RecordInspectionInfoServiceImpl.java index 086193f..e8608ec 100644 --- a/ruoyi-manage/src/main/java/com/ruoyi/manage/service/impl/RecordInspectionInfoServiceImpl.java +++ b/ruoyi-manage/src/main/java/com/ruoyi/manage/service/impl/RecordInspectionInfoServiceImpl.java @@ -109,4 +109,9 @@ public class RecordInspectionInfoServiceImpl implements IRecordInspectionInfoSer public int deleteRecordInspectionInfoByInspectionId(Long inspectionId) { return recordInspectionInfoMapper.deleteRecordInspectionInfoByInspectionId(inspectionId); } + + @Override + public List selectInfoByInspectionId(String ids) { + return recordInspectionInfoMapper.selectInfoByInspectionId(Convert.toStrArray(ids)); + } } diff --git a/ruoyi-manage/src/main/resources/mapper/manage/RecordInspectionImgMapper.xml b/ruoyi-manage/src/main/resources/mapper/manage/RecordInspectionImgMapper.xml index edb8754..e037fa9 100644 --- a/ruoyi-manage/src/main/resources/mapper/manage/RecordInspectionImgMapper.xml +++ b/ruoyi-manage/src/main/resources/mapper/manage/RecordInspectionImgMapper.xml @@ -78,6 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + \ No newline at end of file diff --git a/ruoyi-manage/src/main/resources/mapper/manage/RecordInspectionInfoMapper.xml b/ruoyi-manage/src/main/resources/mapper/manage/RecordInspectionInfoMapper.xml index 616bb42..463985f 100644 --- a/ruoyi-manage/src/main/resources/mapper/manage/RecordInspectionInfoMapper.xml +++ b/ruoyi-manage/src/main/resources/mapper/manage/RecordInspectionInfoMapper.xml @@ -73,4 +73,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + \ No newline at end of file diff --git a/ruoyi-manage/src/main/resources/templates/manage/record_inspection/record_inspection.html b/ruoyi-manage/src/main/resources/templates/manage/record_inspection/record_inspection.html index f6eb42f..27a4ca3 100644 --- a/ruoyi-manage/src/main/resources/templates/manage/record_inspection/record_inspection.html +++ b/ruoyi-manage/src/main/resources/templates/manage/record_inspection/record_inspection.html @@ -1,77 +1,90 @@ - + -
-
-
-
-
- -
-
-
- -
- - - - - 修改 - - - 删除 - - - - -
-
-
-
+
+
+
+
+
+ +
+
+
+ + +
+
- - + ] + }); + }; + + // 选中数据 + function checkItem() { + var arrays = $.table.selectColumns("inspectionId"); + // alert(arrays); + var data = {"ids": arrays.toString()}; + $.operate.submit(prefix + "/print", "get", "json", data); + } + + \ No newline at end of file