添加轮档出库分类记录模块

master
wg 2 months ago
parent 8b5544fad2
commit a2c6e962b0

@ -1,6 +1,10 @@
package com.ruoyi.manage.controller;
import java.util.List;
import com.ruoyi.manage.domain.RecordIn;
import com.ruoyi.manage.domain.RecordInSort;
import com.ruoyi.manage.domain.RecordOutSort;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@ -30,7 +34,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
public class RecordOutController extends BaseController
{
private String prefix = "manage/record_out";
private String prefix2 = "manage/record_out_sort";
@Autowired
private IRecordOutService recordOutService;
@ -40,7 +44,12 @@ public class RecordOutController extends BaseController
{
return prefix + "/record_out";
}
@RequiresPermissions("manage:record_out_sort:view")
@GetMapping("/record_out_sort")
public String record_out_sort()
{
return prefix2 + "/record_out_sort";
}
/**
*
*/
@ -53,7 +62,30 @@ public class RecordOutController extends BaseController
List<RecordOut> list = recordOutService.selectRecordOutList(recordOut);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("manage:record_out:sort_list")
@PostMapping("/sort_list")
@ResponseBody
public TableDataInfo sort_list(RecordOutSort recordOutSort)
{
startPage();
List<RecordOutSort> list = recordOutService.selectRecordOutSortList(recordOutSort);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("manage:record_out:sort_list")
@PostMapping("/sort_LocationCode")
@ResponseBody
public TableDataInfo selectByBatchCode(String locationCode)
{
// startPage();
List<RecordOut> list = recordOutService.selectByLocationCode(locationCode);
return getDataTable(list);
}
/**
*
*/

@ -0,0 +1,51 @@
package com.ruoyi.manage.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* record_out
*
* @author wangh
* @date 2024-01-18
*/
public class RecordOutSort extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 机位码 */
@Excel(name = "机位码")
private String locationCode;
/** 数量 */
@Excel(name = "数量")
public int recordCount;
public void setLocationCode(String locationCode)
{
this.locationCode = locationCode;
}
public String getLocationCode()
{
return locationCode;
}
public int getRecordCount() {
return recordCount;
}
public void setRecordCount(int recordCount) {
this.recordCount = recordCount;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("locationCode", getLocationCode())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.toString();
}
}

@ -1,7 +1,11 @@
package com.ruoyi.manage.mapper;
import java.util.List;
import com.ruoyi.manage.domain.RecordIn;
import com.ruoyi.manage.domain.RecordInSort;
import com.ruoyi.manage.domain.RecordOut;
import com.ruoyi.manage.domain.RecordOutSort;
import org.springframework.stereotype.Repository;
/**
* Mapper
@ -59,4 +63,18 @@ public interface RecordOutMapper
* @return
*/
public int deleteRecordOutByObjids(String[] objids);
/**
*
*
* @param recordOutSort
* @return
*/
List<RecordOutSort> selectRecordOutSortList(RecordOutSort recordOutSort);
/**
*
*
* @param locationCode
* @return
*/
public List<RecordOut> selectByLocationCode(String locationCode);
}

@ -1,7 +1,11 @@
package com.ruoyi.manage.service;
import java.util.List;
import com.ruoyi.manage.domain.RecordIn;
import com.ruoyi.manage.domain.RecordInSort;
import com.ruoyi.manage.domain.RecordOut;
import com.ruoyi.manage.domain.RecordOutSort;
/**
* Service
@ -58,4 +62,18 @@ public interface IRecordOutService
* @return
*/
public int deleteRecordOutByObjid(Long objid);
/**
*
*
* @param recordOutSort
* @return
*/
List<RecordOutSort> selectRecordOutSortList(RecordOutSort recordOutSort);
/**
*
*
* @param
* @return
*/
public List<RecordOut> selectByLocationCode(String locationCode);
}

@ -5,6 +5,9 @@ import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.manage.domain.RecordIn;
import com.ruoyi.manage.domain.RecordInSort;
import com.ruoyi.manage.domain.RecordOutSort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.manage.mapper.RecordOutMapper;
@ -90,4 +93,24 @@ public class RecordOutServiceImpl implements IRecordOutService {
public int deleteRecordOutByObjid(Long objid) {
return recordOutMapper.deleteRecordOutByObjid(objid);
}
/**
*
*
* @param recordOutSort
* @return
*/
@Override
public List<RecordOutSort> selectRecordOutSortList(RecordOutSort recordOutSort) {
return recordOutMapper.selectRecordOutSortList(recordOutSort);
}
/**
*
*
* @param
* @return
*/
@Override
public List<RecordOut> selectByLocationCode(String locationCode) {
return recordOutMapper.selectByLocationCode(locationCode);
}
}

@ -12,7 +12,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
</resultMap>
<resultMap type="RecordOutSort" id="RecordOutSortResult">
<!-- <result property="objid" column="objid" />-->
<result property="locationCode" column="location_code" />
<!-- <result property="createTime" column="create_time" />-->
<result property="recordCount" column="record_count" />
<!-- <result property="remark" column="remark" />-->
<!-- <result property="createBy" column="create_by" />-->
</resultMap>
<sql id="selectRecordOutVo">
select objid, epc_code, location_code, use_user, create_by, create_time from record_out
</sql>
@ -30,7 +37,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectRecordOutVo"/>
where objid = #{objid}
</select>
<select id="selectRecordOutSortList" resultMap="RecordOutSortResult">
SELECT location_code, COUNT(*) AS record_count
FROM record_out
GROUP BY location_code
ORDER BY location_code
</select>
<select id="selectByLocationCode" parameterType="String" resultMap="RecordOutResult">
SELECT * FROM record_out WHERE location_code = #{locationCode}
</select>
<insert id="insertRecordOut" parameterType="RecordOut" useGeneratedKeys="true" keyProperty="objid">
insert into record_out
<trim prefix="(" suffix=")" suffixOverrides=",">

@ -26,6 +26,12 @@
data-detail-view-by-click="true" -->
<table id="bootstrap-table"></table>
</div>
<div class="btn-group-sm" id="toolbar" role="group">`
<i class="fa fa-info-circle" style="color: red;"></i> 勾选数据导出指定列,否则为全部
<a class="btn btn-warning" onclick="exportSelected()">
<i class="fa fa-download"></i> 导出
</a>
</div>
</div>
</div>
<div>
@ -63,6 +69,7 @@
showToggle: false,
showColumns: false,
detailView: true,
onExpandRow : function(index, row, $detail) {
initChildTable(index, row, $detail);
},
@ -118,7 +125,7 @@
initChildTable = function(index, row, $detail) {
var batchCode = row.batchCode;
var childTable = $detail.html('<table </table>').find('table');
var childTable = $detail.html('<table></table>').find('table');
$(childTable).bootstrapTable({
url: prefix + "/sort_BatchCode",
method: 'post',
@ -142,9 +149,9 @@
};
},
columns: [
// {
// checkbox: true
// },
{
checkbox: true
},
{
title: '序号',
formatter: function (value, row, index) {
@ -199,6 +206,78 @@
}*/]
});
};
// 导出数据
// function exportSelected() {
// var $table =$('#bootstrap-table');
// var selections = $table.bootstrapTable('getSelections');
// var userIds = $.map(selections, function (row) {
// return row.objid; // 假设objid是子表每行的唯一标识
// });
//
// if(userIds.length === 0){
// $.modal.alertWarning("请至少选择一条记录");
// return;
// }
//
// var dataParam = {
// userIds: userIds.join(',')
// };
// if($.common.isNotEmpty(userIds)){
// tipMsg = "确定导出勾选" + userIds.length + "条数据吗?";
// dataParam.push({ "name": "userIds", "value": userIds });
// }
// $.modal.confirm(tipMsg, function() {
// $.post(prefix + "/export", dataParam, function(result) {
// if (result.code == web_status.SUCCESS) {
// window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
// } else {
// $.modal.alertError(result.msg);
// }
// });
// });
// }
// 导出子表数据
function exportSelected() {
var childTables = $('.detail-view table'); // 获取所有子表的引用
var userIds = [];
// 遍历每个子表
childTables.each(function() {
var selections = $(this).bootstrapTable('getSelections'); // 获取子表中的选中行
// 将子表中选中行的objid添加到userIds数组中
userIds = userIds.concat($.map(selections, function (row) {
return row.objid; // 假设objid是子表每行的唯一标识
}));
});
if(userIds.length === 0){
$.modal.alertWarning("请至少选择一条记录");
return;
}
var dataParam = {
userIds: userIds.join(',')
};
$.modal.confirm("确定导出选中的" + userIds.length + "条数据吗?", function() {
$.ajax({
url: prefix + "/export", // 修改为你的导出接口URL
method: 'POST',
data: dataParam,
success: function(result) {
if (result.code === web_status.SUCCESS) {
window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
} else {
$.modal.alertError(result.msg);
}
},
error: function(error) {
$.modal.alertError("导出失败");
}
});
});
}
</script>
</body>
</html>

@ -0,0 +1,232 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="keywords" content="">
<meta name="description" content="">
<title>轮挡入库分类记录</title>
<link href="/css/bootstrap.min.css?v=3.3.7" rel="stylesheet"/>
<link href="/css/font-awesome.min.css?v=4.7.0" rel="stylesheet"/>
<!-- bootstrap-table 表格插件样式 -->
<link href="/ajax/libs/bootstrap-table/bootstrap-table.min.css?v=1.22.6" rel="stylesheet"/>
<link href="/css/animate.min.css?v=20210831" rel="stylesheet"/>
<link href="/css/style.min.css?v=20210831" rel="stylesheet"/>
<link href="/ruoyi/css/ry-ui.css?v=4.7.9" rel="stylesheet"/>
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 select-table table-striped">
<!-- 点击事件的方式打开使用 detailViewIcon: false and detailViewByClick: true
data-detail-view-icon="false"
data-detail-view-by-click="true" -->
<table id="bootstrap-table"></table>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<i class="fa fa-info-circle" style="color: red;"></i> 勾选数据导出指定列,否则为全部
<a class="btn btn-warning" onclick="exportSelected()">
<i class="fa fa-download"></i> 导出
</a>
</div>
</div>
</div>
<div>
<script> var ctx = "\/"; var lockscreen = null; if(lockscreen){window.top.location=ctx+"lockscreen";} </script>
<a id="scroll-up" href="javascript:;" class="btn btn-sm display"><i class="fa fa-angle-double-up"></i></a>
<script src="/js/jquery.min.js?v=3.6.3"></script>
<script src="/js/bootstrap.min.js?v=3.3.7"></script>
<!-- bootstrap-table 表格插件 -->
<script src="/ajax/libs/bootstrap-table/bootstrap-table.min.js?v=1.22.6"></script>
<script src="/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js?v=1.22.6"></script>
<script src="/ajax/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js?v=1.22.6"></script>
<!-- jquery-validate 表单验证插件 -->
<script src="/ajax/libs/validate/jquery.validate.min.js?v=1.19.3"></script>
<script src="/ajax/libs/validate/jquery.validate.extend.js?v=1.19.3"></script>
<script src="/ajax/libs/validate/messages_zh.js?v=1.19.3"></script>
<!-- bootstrap-table 表格树插件 -->
<script src="/ajax/libs/bootstrap-table/extensions/tree/bootstrap-table-tree.min.js?v=1.22.6"></script>
<!-- 遮罩层 -->
<script src="/ajax/libs/blockUI/jquery.blockUI.js?v=2.70.0"></script>
<script src="/ajax/libs/iCheck/icheck.min.js?v=1.0.3"></script>
<script src="/ajax/libs/layer/layer.min.js?v=3.7.0"></script>
<script src="/ajax/libs/layui/layui.min.js?v=2.8.18"></script>
<script src="/ruoyi/js/common.js?v=4.7.9"></script>
<script src="/ruoyi/js/ry-ui.js?v=4.7.9"></script>
</div>
<script>
var prefix = ctx + "manage/record_out";
var datas = [{"createBy":"admin","createTime":"2024-06-06 02:06:39","updateBy":null,"updateTime":null,"remark":"\u6B63\u5E38\u72B6\u6001","dictCode":6,"dictSort":1,"dictLabel":"\u6B63\u5E38","dictValue":"0","dictType":"sys_normal_disable","cssClass":"","listClass":"primary","isDefault":"Y","status":"0","default":true},{"createBy":"admin","createTime":"2024-06-06 02:06:39","updateBy":null,"updateTime":null,"remark":"\u505C\u7528\u72B6\u6001","dictCode":7,"dictSort":2,"dictLabel":"\u505C\u7528","dictValue":"1","dictType":"sys_normal_disable","cssClass":"","listClass":"danger","isDefault":"N","status":"0","default":false}];
$(function() {
var options = {
url: prefix + "/sort_list",
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
detailView: true,
onExpandRow : function(index, row, $detail) {
initChildTable(index, row, $detail);
},
columns: [
// {
// field: 'createTime',
// title: '入库时间',
// formatter: function(value, row, index) {
// // 假设value是一个标准的日期时间字符串
// if (value) {
// // 解析日期时间字符串并格式化为仅显示日期部分
// var date = new Date(value);
// // 使用JavaScript的Date对象方法来格式化日期
// // 注意这里使用了简单的拼接来格式化日期您也可以使用更复杂的库如moment.js来格式化日期
// return date.getFullYear() + '-' + (date.getMonth() + 1).toString().padStart(2, '0') + '-' + date.getDate().toString().padStart(2, '0');
// }
// return value; // 如果value为空或不是有效的日期时间字符串则直接返回原始值
// }
// },
{
field : 'locationCode',
title : '机位码'
},
{
field: 'recordCount',
title: '数量',
formatter: function(value, row, index) {
console.log('Record Count Value:', value); // 在控制台打印数量值
return value;
}
},
// {
// // field: 'status',
// // title: '用户状态',
// // align: 'center',
// formatter: function(value, row, index) {
// return $.table.selectDictLabel(datas, value);
// }
// },
{
// title: '操作',
// align: 'center',
// formatter: function(value, row, index) {
// var actions = [];
// actions.push('<a class="btn btn-success btn-xs" href="javascript:;"><i class="fa fa-edit"></i>编辑</a> ');
// actions.push('<a class="btn btn-danger btn-xs" href="javascript:;"><i class="fa fa-remove"></i>删除</a>');
// return actions.join('');
// }
}]
};
$.table.init(options);
});
initChildTable = function(index, row, $detail) {
var locationCode = row.locationCode;
var childTable = $detail.html('<table </table>').find('table');
$(childTable).bootstrapTable({
url: prefix + "/sort_LocationCode",
method: 'post',
sidePagination: "server",
contentType: "application/x-www-form-urlencoded",
// pagination: true, // 开启分页功能
// pageSize: 10, // 设置每页显示的记录数
// pageList: [10, 25, 50, 100], // 设置可供选择的每页显示的记录数
// queryParams : {
// userName: '轮挡入库分类记录'
// },
queryParams: function(params) {
// 在queryParams中添加批次码参数
return {
locationCode: locationCode, // 将批次码添加到查询参数中
// limit: params.limit,
// offset: params.offset,
// sort: params.sort,
// order: params.order,
// 可以根据需要添加其他查询参数
};
},
columns: [
{
checkbox: true
},
{
title: '序号',
formatter: function (value, row, index) {
return index+1
}
},
{
field: 'objid',
title: '主键',
visible: false
},
{
field: 'epcCode',
title: 'RFID编码'
},
// {
// field: 'batchCode',
// title: '批次码'
// },
{
field: 'recordCount',
title: '数量',
visible: false
},
{
field: 'useUser',
title: '领用人'
},
{
field: 'createBy',
title: '出库人'
},
{
field: 'createTime',
title: '出库时间'
},
// {
// field: 'createTime',
// title: '入库时间'
// },
/* {
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.objid + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.objid + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}*/]
});
};
// 导出数据
function exportSelected() {
var userIds = $.table.selectColumns("objid");
var dataParam = $("#export-form").serializeArray();
var tipMsg = "确定导出所有数据吗?";
if($.common.isNotEmpty(userIds)){
tipMsg = "确定导出勾选" + userIds.length + "条数据吗?";
dataParam.push({ "name": "userIds", "value": userIds });
}
$.modal.confirm(tipMsg, function() {
$.post(prefix + "/exportData", dataParam, function(result) {
if (result.code == web_status.SUCCESS) {
window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
} else {
$.modal.alertError(result.msg);
}
});
});
}
</script>
</body>
</html>
Loading…
Cancel
Save