From f504d4f03ed5b6e858066744d3988c6fda59e3d7 Mon Sep 17 00:00:00 2001 From: wg <2023838292@qq.com> Date: Tue, 12 Nov 2024 13:34:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BD=AE=E6=A1=A3=E5=85=A5?= =?UTF-8?q?=E5=BA=93=E5=87=BA=E5=BA=93=E6=90=9C=E7=B4=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/controller/RecordInController.java | 93 ++++++++++++++---- .../ruoyi/manage/mapper/RecordInMapper.java | 10 ++ .../manage/service/IRecordInService.java | 12 ++- .../service/impl/RecordInServiceImpl.java | 16 +++ .../mapper/manage/RecordInMapper.xml | 43 ++++++++ .../mapper/manage/RecordOutMapper.xml | 3 + .../manage/record_in_sort/record_in_sort.html | 98 +++++++++---------- .../record_out_sort/record_out_sort.html | 30 +++++- .../record_store_check.html | 1 - 9 files changed, 230 insertions(+), 76 deletions(-) diff --git a/ruoyi-manage/src/main/java/com/ruoyi/manage/controller/RecordInController.java b/ruoyi-manage/src/main/java/com/ruoyi/manage/controller/RecordInController.java index 98c9d22..c55f9fe 100644 --- a/ruoyi-manage/src/main/java/com/ruoyi/manage/controller/RecordInController.java +++ b/ruoyi-manage/src/main/java/com/ruoyi/manage/controller/RecordInController.java @@ -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 list = recordInService.selectRecordInSortList(recordInSort); - return getDataTable(list); - } + /** * 按批次码分类查询轮挡入库记录列表 */ @@ -89,7 +79,47 @@ public class RecordInController extends BaseController List list = recordInService.selectRecordInList(recordIn); return getDataTable(list); } - +// /** +// * +// * 查询轮挡入库记录列表 +// */ +// @RequiresPermissions("manage:record_in:list") +// @PostMapping("/list1") +// @ResponseBody +//// public ResponseEntity> 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 records = recordInService.searchRecordsByDateAndBatchCode(batchCode, startTime, endTime); +// return ResponseEntity.ok(records); +// } +// public ResponseEntity> 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 records = recordInService.searchRecordsByDateAndBatchCode(batchCode, startTime, endTime); +// return ResponseEntity.ok(records); +// } /** * 导出轮挡入库记录列表 */ @@ -103,7 +133,31 @@ public class RecordInController extends BaseController ExcelUtil util = new ExcelUtil(RecordIn.class); return util.exportExcel(list, "轮挡入库记录数据"); } - + /** + * 分类查询轮挡入库记录列表 + */ + @RequiresPermissions("manage:record_in:sort_list") + @PostMapping("/sort_list") + @ResponseBody + public TableDataInfo sort_list(RecordInSort recordInSort) + { + startPage(); + List 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 list = recordInService.selectRecordInSortList(recordInSort); + ExcelUtil util = new ExcelUtil(RecordInSort.class); + return util.exportExcel(list, "轮挡入库分类记录数据"); + } /** * 新增轮挡入库记录 */ @@ -160,4 +214,5 @@ public class RecordInController extends BaseController { return toAjax(recordInService.deleteRecordInByObjids(ids)); } + } diff --git a/ruoyi-manage/src/main/java/com/ruoyi/manage/mapper/RecordInMapper.java b/ruoyi-manage/src/main/java/com/ruoyi/manage/mapper/RecordInMapper.java index 27327b1..a0bd3c0 100644 --- a/ruoyi-manage/src/main/java/com/ruoyi/manage/mapper/RecordInMapper.java +++ b/ruoyi-manage/src/main/java/com/ruoyi/manage/mapper/RecordInMapper.java @@ -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 selectByBatchCode(String batchCode); + List selectRecordInList1(RecordInSort recordInSort); + + + + List searchRecordsByDateAndBatchCode( + @Param("batchCode") String batchCode, + @Param("startDate") Date startDate, + @Param("endDate") Date endDate); } diff --git a/ruoyi-manage/src/main/java/com/ruoyi/manage/service/IRecordInService.java b/ruoyi-manage/src/main/java/com/ruoyi/manage/service/IRecordInService.java index d6b1809..7c86a5a 100644 --- a/ruoyi-manage/src/main/java/com/ruoyi/manage/service/IRecordInService.java +++ b/ruoyi-manage/src/main/java/com/ruoyi/manage/service/IRecordInService.java @@ -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 selectRecordInList(RecordIn recordIn); - + /** + * 查询轮挡入库记录列表 + * + * @param recordInSort 搜索 + * @return 搜索轮挡入库分类记录集合 + */ + public List selectRecordInList(RecordInSort recordInSort); /** * 新增轮挡入库记录 * @@ -73,4 +80,7 @@ public interface IRecordInService * @return 分类轮挡入库记录 */ public List selectByBatchCode(String bathCode); + + List searchRecordsByDateAndBatchCode(String batchCode, Date startDate, Date endDate); + } diff --git a/ruoyi-manage/src/main/java/com/ruoyi/manage/service/impl/RecordInServiceImpl.java b/ruoyi-manage/src/main/java/com/ruoyi/manage/service/impl/RecordInServiceImpl.java index 37f3446..1b806c9 100644 --- a/ruoyi-manage/src/main/java/com/ruoyi/manage/service/impl/RecordInServiceImpl.java +++ b/ruoyi-manage/src/main/java/com/ruoyi/manage/service/impl/RecordInServiceImpl.java @@ -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 selectRecordInList(RecordInSort recordInSort) { + return recordInMapper.selectRecordInList1(recordInSort); + } + /** * 新增轮挡入库记录 * @@ -111,4 +123,8 @@ public class RecordInServiceImpl implements IRecordInService { public List selectByBatchCode(String batchCode) { return recordInMapper.selectByBatchCode(batchCode); } + @Override + public List searchRecordsByDateAndBatchCode(String batchCode, Date startDate, Date endDate) { + return recordInMapper.searchRecordsByDateAndBatchCode(batchCode, startDate, endDate); + } } diff --git a/ruoyi-manage/src/main/resources/mapper/manage/RecordInMapper.xml b/ruoyi-manage/src/main/resources/mapper/manage/RecordInMapper.xml index 3bc604e..b85bb90 100644 --- a/ruoyi-manage/src/main/resources/mapper/manage/RecordInMapper.xml +++ b/ruoyi-manage/src/main/resources/mapper/manage/RecordInMapper.xml @@ -46,13 +46,56 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + + + + + + + + + + + + + + + + + insert into record_in diff --git a/ruoyi-manage/src/main/resources/mapper/manage/RecordOutMapper.xml b/ruoyi-manage/src/main/resources/mapper/manage/RecordOutMapper.xml index fbf9036..02dd07d 100644 --- a/ruoyi-manage/src/main/resources/mapper/manage/RecordOutMapper.xml +++ b/ruoyi-manage/src/main/resources/mapper/manage/RecordOutMapper.xml @@ -40,6 +40,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" diff --git a/ruoyi-manage/src/main/resources/templates/manage/record_in_sort/record_in_sort.html b/ruoyi-manage/src/main/resources/templates/manage/record_in_sort/record_in_sort.html index 75d659e..630707b 100644 --- a/ruoyi-manage/src/main/resources/templates/manage/record_in_sort/record_in_sort.html +++ b/ruoyi-manage/src/main/resources/templates/manage/record_in_sort/record_in_sort.html @@ -20,14 +20,39 @@
+
+
+
+
    +
  • + + + - + +
  • +
  • + + +
  • +
  • +  搜索 + +  重置 +
  • +
+
+
+
-
` - 勾选数据导出指定列,否则为全部 +
+ 勾选数据导出指定列,否则为全部 导出 @@ -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 @@ }); } + diff --git a/ruoyi-manage/src/main/resources/templates/manage/record_out_sort/record_out_sort.html b/ruoyi-manage/src/main/resources/templates/manage/record_out_sort/record_out_sort.html index 1996698..f41eea6 100644 --- a/ruoyi-manage/src/main/resources/templates/manage/record_out_sort/record_out_sort.html +++ b/ruoyi-manage/src/main/resources/templates/manage/record_out_sort/record_out_sort.html @@ -24,10 +24,34 @@ +
+
+ +
+
- 勾选数据导出指定列,否则为全部 + + 勾选数据导出指定列,否则为全部 导出 @@ -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, diff --git a/ruoyi-manage/src/main/resources/templates/manage/record_store_check/record_store_check.html b/ruoyi-manage/src/main/resources/templates/manage/record_store_check/record_store_check.html index 55225dd..a7b5890 100644 --- a/ruoyi-manage/src/main/resources/templates/manage/record_store_check/record_store_check.html +++ b/ruoyi-manage/src/main/resources/templates/manage/record_store_check/record_store_check.html @@ -124,7 +124,6 @@ }, columns: [ { - title: '序号', formatter: function (value, row, index) { return index+1