添加轮档入库出库搜索功能

master
wg 2 months ago
parent a2c6e962b0
commit f504d4f03e

@ -1,18 +1,19 @@
package com.ruoyi.manage.controller;
import java.util.Date;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.List;
import com.github.pagehelper.Page;
import com.ruoyi.manage.domain.RecordInSort;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.manage.domain.RecordIn;
@ -52,18 +53,7 @@ public class RecordInController extends BaseController
{
return prefix2 + "/record_in_sort";
}
/**
*
*/
@RequiresPermissions("manage:record_in:sort_list")
@PostMapping("/sort_list")
@ResponseBody
public TableDataInfo sort_list(RecordInSort recordInSort)
{
startPage();
List<RecordInSort> list = recordInService.selectRecordInSortList(recordInSort);
return getDataTable(list);
}
/**
*
*/
@ -89,7 +79,47 @@ public class RecordInController extends BaseController
List<RecordIn> list = recordInService.selectRecordInList(recordIn);
return getDataTable(list);
}
// /**
// *
// * 查询轮挡入库记录列表
// */
// @RequiresPermissions("manage:record_in:list")
// @PostMapping("/list1")
// @ResponseBody
//// public ResponseEntity<List<RecordInSort>> searchRecords(
// @RequestParam(value = "batchCode", required = false) String batchCode,
// @RequestParam(value = "params[beginCheckTime]", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime,
// @RequestParam(value = "params[endCheckTime]", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) {
//
// List<RecordInSort> records = recordInService.searchRecordsByDateAndBatchCode(batchCode, startTime, endTime);
// return ResponseEntity.ok(records);
// }
// public ResponseEntity<List<RecordInSort>> searchRecords(
// @RequestParam(value = "batchCode", required = false) String batchCode,
// @RequestParam(value = "params[beginCheckTime]", required = false) String beginCheckTimeStr,
// @RequestParam(value = "params[endCheckTime]", required = false) String endCheckTimeStr) {
//
// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
// Date startTime = null;
// Date endTime = null;
//
// try {
// if (beginCheckTimeStr != null && !beginCheckTimeStr.isEmpty()) {
// startTime = dateFormat.parse(beginCheckTimeStr);
// }
// if (endCheckTimeStr != null && !endCheckTimeStr.isEmpty()) {
// endTime = dateFormat.parse(endCheckTimeStr);
// }
// } catch (ParseException e) {
// // Handle parsing exception
// e.printStackTrace();
// // Return an error response or handle it as per your application's requirements
// return ResponseEntity.badRequest().body(null);
// }
//
// List<RecordInSort> records = recordInService.searchRecordsByDateAndBatchCode(batchCode, startTime, endTime);
// return ResponseEntity.ok(records);
// }
/**
*
*/
@ -103,7 +133,31 @@ public class RecordInController extends BaseController
ExcelUtil<RecordIn> util = new ExcelUtil<RecordIn>(RecordIn.class);
return util.exportExcel(list, "轮挡入库记录数据");
}
/**
*
*/
@RequiresPermissions("manage:record_in:sort_list")
@PostMapping("/sort_list")
@ResponseBody
public TableDataInfo sort_list(RecordInSort recordInSort)
{
startPage();
List<RecordInSort> list = recordInService.selectRecordInSortList(recordInSort);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("manage:record_in:export")
@Log(title = "轮挡入库记录", businessType = BusinessType.EXPORT)
@PostMapping("/export_sort")
@ResponseBody
public AjaxResult export_sort(RecordInSort recordInSort)
{
List<RecordInSort> list = recordInService.selectRecordInSortList(recordInSort);
ExcelUtil<RecordInSort> util = new ExcelUtil<RecordInSort>(RecordInSort.class);
return util.exportExcel(list, "轮挡入库分类记录数据");
}
/**
*
*/
@ -160,4 +214,5 @@ public class RecordInController extends BaseController
{
return toAjax(recordInService.deleteRecordInByObjids(ids));
}
}

@ -1,8 +1,10 @@
package com.ruoyi.manage.mapper;
import java.util.Date;
import java.util.List;
import com.ruoyi.manage.domain.RecordIn;
import com.ruoyi.manage.domain.RecordInSort;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
/**
* Mapper
@ -75,4 +77,12 @@ public interface RecordInMapper
*/
public List<RecordIn> selectByBatchCode(String batchCode);
List<RecordInSort> selectRecordInList1(RecordInSort recordInSort);
List<RecordInSort> searchRecordsByDateAndBatchCode(
@Param("batchCode") String batchCode,
@Param("startDate") Date startDate,
@Param("endDate") Date endDate);
}

@ -1,5 +1,6 @@
package com.ruoyi.manage.service;
import java.util.Date;
import java.util.List;
import com.ruoyi.manage.domain.RecordIn;
import com.ruoyi.manage.domain.RecordInSort;
@ -27,7 +28,13 @@ public interface IRecordInService
* @return
*/
public List<RecordIn> selectRecordInList(RecordIn recordIn);
/**
*
*
* @param recordInSort
* @return
*/
public List<RecordInSort> selectRecordInList(RecordInSort recordInSort);
/**
*
*
@ -73,4 +80,7 @@ public interface IRecordInService
* @return
*/
public List<RecordIn> selectByBatchCode(String bathCode);
List<RecordInSort> searchRecordsByDateAndBatchCode(String batchCode, Date startDate, Date endDate);
}

@ -1,5 +1,6 @@
package com.ruoyi.manage.service.impl;
import java.util.Date;
import java.util.List;
@ -46,6 +47,17 @@ public class RecordInServiceImpl implements IRecordInService {
return recordInMapper.selectRecordInList(recordIn);
}
/**
* list1
*
* @param recordInSort
* @return
*/
@Override
public List<RecordInSort> selectRecordInList(RecordInSort recordInSort) {
return recordInMapper.selectRecordInList1(recordInSort);
}
/**
*
*
@ -111,4 +123,8 @@ public class RecordInServiceImpl implements IRecordInService {
public List<RecordIn> selectByBatchCode(String batchCode) {
return recordInMapper.selectByBatchCode(batchCode);
}
@Override
public List<RecordInSort> searchRecordsByDateAndBatchCode(String batchCode, Date startDate, Date endDate) {
return recordInMapper.searchRecordsByDateAndBatchCode(batchCode, startDate, endDate);
}
}

@ -46,13 +46,56 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectRecordInSortList" resultMap="RecordInSortResult">
SELECT batch_code, create_time, COUNT(*) AS record_count
FROM record_in
<where>
<if test="params.beginCheckTime != null and params.beginCheckTime != '' and params.endCheckTime != null and params.endCheckTime != ''"> and create_time between #{params.beginCheckTime} and #{params.endCheckTime}</if><if test="batchCode != null and batchCode != ''"> and batch_code = #{batchCode}</if>
<if test="batchCode != null and batchCode != ''"> and batch_code = #{batchCode}</if>
</where>
GROUP BY batch_code
ORDER BY batch_code
</select>
<!-- <select id="searchRecordsByDateAndBatchCode" resultMap="RecordInSortResult">-->
<!-- SELECT batch_code, DATE(create_time) AS create_date, COUNT(*) AS record_count-->
<!-- FROM record_in-->
<!-- WHERE-->
<!-- (batch_code = #{batchCode} OR #{batchCode} IS NULL OR #{batchCode} = '')-->
<!-- AND (DATE(create_time) >= #{startDate} OR #{startDate} IS NULL)-->
<!-- AND (DATE(create_time) <= #{endDate} OR #{endDate} IS NULL)-->
<!-- GROUP BY DATE(create_time), batch_code-->
<!-- ORDER BY batch_code, DATE(create_time);-->
<!-- </select>-->
<select id="searchRecordsByDateAndBatchCode" resultMap="RecordInSortResult">
SELECT batch_code, DATE(create_time) AS create_date, COUNT(*) AS record_count
FROM record_in
WHERE
(batch_code = #{batchCode} OR #{batchCode} IS NULL OR #{batchCode} = '')
AND (
(#{startDate} IS NOT NULL AND DATE(create_time) >= #{startDate})
OR (#{startDate} IS NULL AND #{endDate} IS NOT NULL AND DATE(create_time) &lt;= #{endDate})
OR (#{startDate} IS NULL AND #{endDate} IS NULL)
)
AND (
(#{endDate} IS NOT NULL AND DATE(create_time) &gt;= #{endDate})
OR (#{endDate} IS NULL AND #{startDate} IS NOT NULL AND DATE(create_time) >= #{startDate})
OR (#{startDate} IS NULL AND #{endDate} IS NULL)
)
GROUP BY DATE(create_time), batch_code
ORDER BY batch_code, DATE(create_time);
</select>
<select id="selectByBatchCode" parameterType="String" resultMap="RecordInResult">
SELECT * FROM record_in WHERE batch_code = #{batchCode}
</select>
<select id="selectRecordInList1" resultType="com.ruoyi.manage.domain.RecordInSort"></select>
<insert id="insertRecordIn" parameterType="RecordIn" useGeneratedKeys="true" keyProperty="objid">
insert into record_in

@ -40,6 +40,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectRecordOutSortList" resultMap="RecordOutSortResult">
SELECT location_code, COUNT(*) AS record_count
FROM record_out
<where>
<if test="locationCode != null and locationCode != ''"> and location_code = #{locationCode}</if>
</where>
GROUP BY location_code
ORDER BY location_code
</select>

@ -20,14 +20,39 @@
<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[beginCheckTime]"/>
<span>-</span>
<input type="text" class="time-input" id="endTime" placeholder="结束时间"
name="params[endCheckTime]"/>
</li>
<li>
<label>批次码:</label>
<input type="text" name="batchCode"/>
</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-primary btn-rounded btn-sm" id="btnSearch"><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="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> 勾选数据导出指定列,否则为全部
<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>
@ -61,7 +86,10 @@
var prefix = ctx + "manage/record_in";
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,
@ -74,6 +102,9 @@
initChildTable(index, row, $detail);
},
columns: [
{
checkbox: true
},
{
field: 'createTime',
title: '入库时间',
@ -120,6 +151,7 @@
// }
}]
};
$.table.init(options);
});
@ -149,9 +181,6 @@
};
},
columns: [
{
checkbox: true
},
{
title: '序号',
formatter: function (value, row, index) {
@ -206,64 +235,28 @@
}*/]
});
};
// 导出数据
// 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是子表每行的唯一标识
}));
function exportSelected() {
var $table =$('#bootstrap-table');
var selections = $table.bootstrapTable('getSelections');
var objIds = $.map(selections, function (row) {
return row.batchCode; // 假设objid是父表每行的唯一标识
});
if(userIds.length === 0){
// var objIds = row.batchCode;
if (objIds.length === 0) {
$.modal.alertWarning("请至少选择一条记录");
return;
}
var dataParam = {
userIds: userIds.join(',')
objIds: objIds.join(',')
};
$.modal.confirm("确定导出选中的" + userIds.length + "条数据吗?", function() {
$.modal.confirm("确定导出勾选的" + objIds.length + "条数据吗?", function() {
$.ajax({
url: prefix + "/export", // 修改为你的导出接口URL
url: prefix + "/export_sort", // 修改为您的导出接口URL
method: 'POST',
data: dataParam,
// data: dataParam,
success: function(result) {
if (result.code === web_status.SUCCESS) {
window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
@ -278,6 +271,7 @@
});
}
</script>
</body>
</html>

@ -24,10 +24,34 @@
<!-- 点击事件的方式打开使用 detailViewIcon: false and detailViewByClick: true
data-detail-view-icon="false"
data-detail-view-by-click="true" -->
<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[beginCheckTime]"/>-->
<!-- <span>-</span>-->
<!-- <input type="text" class="time-input" id="endTime" placeholder="结束时间"-->
<!-- name="params[endCheckTime]"/>-->
<!-- </li>-->
<li>
<label>机位码:</label>
<input type="text" name="locationCode"/>
</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-primary btn-rounded btn-sm" id="btnSearch"><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>
<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> 勾选数据导出指定列,否则为全部
<i class="fa fa-info-circle" style="color: red;"></i>
勾选数据导出指定列,否则为全部
<a class="btn btn-warning" onclick="exportSelected()">
<i class="fa fa-download"></i> 导出
</a>
@ -135,12 +159,12 @@
// pageSize: 10, // 设置每页显示的记录数
// pageList: [10, 25, 50, 100], // 设置可供选择的每页显示的记录数
// queryParams : {
// userName: '轮挡库分类记录'
// userName: '轮挡库分类记录'
// },
queryParams: function(params) {
// 在queryParams中添加批次码参数
return {
locationCode: locationCode, // 将批次码添加到查询参数中
locationCode: locationCode, //
// limit: params.limit,
// offset: params.offset,
// sort: params.sort,

@ -124,7 +124,6 @@
},
columns: [
{
title: '序号',
formatter: function (value, row, index) {
return index+1

Loading…
Cancel
Save