修改 巡检图片显示

master
wanghao 2 weeks ago
parent 9f7c202882
commit 54aab1a1d5

@ -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<MultipartFile> files) {
public AjaxResult inspectionSubmit(long tableId, String json, long inspectionId, String user,String locationCode, List<MultipartFile> files) {
//插入 info 表
List<StockDto> 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) {

@ -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<RecordInspectionInfo> list=recordInspectionInfoService.selectInfoByInspectionId(ids);
System.out.println("巡检记录"+list.size());
List<RecordInspectionImg> 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<RecordInspection> 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<RecordInspection> list = recordInspectionService.selectRecordInspectionList(recordInspection);
ExcelUtil<RecordInspection> util = new ExcelUtil<RecordInspection>(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));
}
}

@ -61,4 +61,6 @@ public interface RecordInspectionImgMapper
public int deleteRecordInspectionImgByInspectionIds(String[] inspectionIds);
List<RecordInspectionImg> selectRecordInspectionlocationList(RecordInspectionImg recordInspectionImg);
List<RecordInspectionImg> recordInspectionImgMapper(String[] strArray);
}

@ -59,4 +59,6 @@ public interface RecordInspectionInfoMapper
* @return
*/
public int deleteRecordInspectionInfoByInspectionIds(String[] inspectionIds);
List<RecordInspectionInfo> selectInfoByInspectionId(String[] inspectionIds);
}

@ -60,4 +60,6 @@ public interface IRecordInspectionImgService
public int deleteRecordInspectionImgByInspectionId(Long inspectionId);
List<RecordInspectionImg> selectRecordInspectionlocationList(RecordInspectionImg recordInspectionImg);
List<RecordInspectionImg> selectImgByInspectionId(String ids);
}

@ -58,4 +58,6 @@ public interface IRecordInspectionInfoService
* @return
*/
public int deleteRecordInspectionInfoByInspectionId(Long inspectionId);
List<RecordInspectionInfo> selectInfoByInspectionId(String ids);
}

@ -100,4 +100,9 @@ public class RecordInspectionImgServiceImpl implements IRecordInspectionImgServi
public List<RecordInspectionImg> selectRecordInspectionlocationList(RecordInspectionImg recordInspectionImg) {
return recordInspectionImgMapper.selectRecordInspectionlocationList( recordInspectionImg);
}
@Override
public List<RecordInspectionImg> selectImgByInspectionId(String ids) {
return recordInspectionImgMapper.recordInspectionImgMapper(Convert.toStrArray(ids));
}
}

@ -109,4 +109,9 @@ public class RecordInspectionInfoServiceImpl implements IRecordInspectionInfoSer
public int deleteRecordInspectionInfoByInspectionId(Long inspectionId) {
return recordInspectionInfoMapper.deleteRecordInspectionInfoByInspectionId(inspectionId);
}
@Override
public List<RecordInspectionInfo> selectInfoByInspectionId(String ids) {
return recordInspectionInfoMapper.selectInfoByInspectionId(Convert.toStrArray(ids));
}
}

@ -78,6 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<select id="selectRecordInspectionlocationList" parameterType="RecordInspectionImg" resultMap="RecordInspectionImgResult">
select location_code
from record_inspection_img
@ -88,4 +89,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
group by location_code order by location_code
</select>
<select id="recordInspectionImgMapper" resultMap="RecordInspectionImgResult">
<include refid="selectRecordInspectionImgVo"/>
where inspection_id in
<foreach item="inspectionId" collection="array" open="(" separator="," close=")">
#{inspectionId}
</foreach>
</select>
</mapper>

@ -73,4 +73,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<select id="selectInfoByInspectionId" resultMap="RecordInspectionInfoResult">
<include refid="selectRecordInspectionInfoVo"/>
where inspection_id in
<foreach item="inspectionId" collection="array" open="(" separator="," close=")">
#{inspectionId}
</foreach>
</select>
</mapper>

@ -1,77 +1,90 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('巡检记录列表')" />
<th:block th:include="include :: header('巡检记录列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li class="select-time">
<label>巡检时间:</label>
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginInspectionTime]"/>
<span>-</span>
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endInspectionTime]"/>
</li>
<!-- <li>-->
<!-- <label>巡检人:</label>-->
<!-- <input type="text" name="inspectionUser"/>-->
<!-- </li>-->
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<!-- <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="manage:record_inspection:add">-->
<!-- <i class="fa fa-plus"></i> 添加-->
<!-- </a>-->
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="manage:record_inspection:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="manage:record_inspection:remove">
<i class="fa fa-remove"></i> 删除
</a>
<!-- <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="manage:record_inspection:export">-->
<!-- <i class="fa fa-download"></i> 导出-->
<!-- </a>-->
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li class="select-time">
<label>巡检时间:</label>
<input type="text" class="time-input" id="startTime" placeholder="开始时间"
name="params[beginInspectionTime]"/>
<span>-</span>
<input type="text" class="time-input" id="endTime" placeholder="结束时间"
name="params[endInspectionTime]"/>
</li>
<!-- <li>-->
<!-- <label>巡检人:</label>-->
<!-- <input type="text" name="inspectionUser"/>-->
<!-- </li>-->
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<!-- <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="manage:record_inspection:add">-->
<!-- <i class="fa fa-plus"></i> 添加-->
<!-- </a>-->
<a class="btn btn-primary single disabled" onclick="$.operate.edit()"
shiro:hasPermission="manage:record_inspection:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
shiro:hasPermission="manage:record_inspection:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn">
</a>
<a class="btn btn-success multiple disabled" onclick="checkItem()">
<i class="fa fa-print"></i> 打印
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('manage:record_inspection:edit')}]];
var removeFlag = [[${@permission.hasPermi('manage:record_inspection:remove')}]];
var prefix = ctx + "manage/record_inspection";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "巡检记录",
sortOrder: "desc",
sortName : "inspectionTime",
detailView: true,
onExpandRow: function (index, row, $detail) {
initinspectionTable(index, row, $detail);
},
columns: [{
checkbox: true
},
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('manage:record_inspection:edit')}]];
var removeFlag = [[${@permission.hasPermi('manage:record_inspection:remove')}]];
var prefix = ctx + "manage/record_inspection";
$(function () {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "巡检记录",
sortOrder: "desc",
sortName: "inspectionTime",
rememberSelected: true,
detailView: true,
onExpandRow: function (index, row, $detail) {
initinspectionTable(index, row, $detail);
},
columns: [{
field: 'state',
checkbox: true
},
{
field: 'inspectionId',
title: '主键',
@ -85,19 +98,19 @@
// field: 'inspectionUser',
// title: '巡检人'
// },
{
{
field: 'totalNumber',
title: '巡检数量'
},
{
{
field: 'normalNumber',
title: '正常数量'
},
{
{
field: 'abnormalNumber',
title: '异常数量'
},
{
{
field: 'skipNumber',
title: '跳过数量'
},
@ -106,62 +119,75 @@
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
formatter: function (value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)"' +
' onclick="openTaskTable(\'' + row.inspectionId + '\')"><i class="fa fa-camera"></i>查看机位</a> ');
return actions.join('');
}
}]
};
$.table.init(options);
});
};
$.table.init(options);
});
function openTaskTable(id){
$.modal.openTab('巡检机位情况', ctx + "manage/record_inspection_task/"+id);
}
initinspectionTable = function (index, row, $detail) {
var childTable = $detail.html('<table style="table-layout:fixed"></table>').find('table');
$(childTable).bootstrapTable({
url: ctx + "manage/record_inspection_info/list",
method: 'post',
sidePagination: "server",
contentType: "application/x-www-form-urlencoded",
queryParams: {
inspectionId: row.inspectionId
},
columns: [
{
title: '序号',
formatter: function (value, row, index) {
return index+1
}
},
{
field: 'epcCode',
title: 'RFID'
},
{
field: 'locationCode',
title: '机位码'
},
{
field: 'inspectionState',
title: '巡检结果'
},
{
field: 'inspectionRemark',
title: '异常原因'
},
{
field: 'createTime',
title: '提交时间'
function openTaskTable(id) {
$.modal.openTab('巡检机位情况', ctx + "manage/record_inspection_task/" + id);
}
initinspectionTable = function (index, row, $detail) {
var childTable = $detail.html('<table style="table-layout:fixed"></table>').find('table');
$(childTable).bootstrapTable({
url: ctx + "manage/record_inspection_info/list",
method: 'post',
sidePagination: "server",
contentType: "application/x-www-form-urlencoded",
queryParams: {
inspectionId: row.inspectionId
},
columns: [
{
title: '序号',
formatter: function (value, row, index) {
return index + 1
}
},
{
field: 'epcCode',
title: 'RFID'
},
{
field: 'locationCode',
title: '机位码'
},
{
field: 'inspectionState',
title: '巡检结果'
},
{
field: 'inspectionRemark',
title: '异常原因'
},
{
field: 'createTime',
title: '提交时间'
}
]
});
};
</script>
]
});
};
// 选中数据
function checkItem() {
var arrays = $.table.selectColumns("inspectionId");
// alert(arrays);
var data = {"ids": arrays.toString()};
$.operate.submit(prefix + "/print", "get", "json", data);
}
</script>
</body>
</html>
Loading…
Cancel
Save