| | |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.result.CheckReport; |
| | | import com.zy.asrs.mapper.ReportQueryMapper; |
| | | import com.zy.asrs.service.LocDetlService; |
| | | import com.zy.common.web.BaseController; |
| | |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | /***************************盘点日志***************************/ |
| | | @RequestMapping("/checkReport") |
| | | public Map<String,Object> checkReport(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam(required = false)String condition, |
| | | @RequestParam Map<String, Object> param){ |
| | | Integer pageNumber = Integer.valueOf((String) param.get("pageNumber")); |
| | | Integer pageSize = Integer.valueOf((String)param.get("pageSize")); |
| | | param.put("curr",(pageNumber - 1) * pageSize + 1); |
| | | param.put("limit",pageNumber * pageSize); |
| | | List<CheckReport> checkReports = reportQueryMapper.selectCheckReport(param); |
| | | Integer checkReportCount = reportQueryMapper.selectCheckReportCount(param); |
| | | Page<CheckReport> checkReportPage = new Page<>(); |
| | | checkReportPage.setRecords(checkReports); |
| | | checkReportPage.setCurrent(curr); |
| | | checkReportPage.setSize(limit); |
| | | checkReportPage.setTotal(checkReportCount); |
| | | return R.ok(checkReportPage); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.entity.result; |
| | | |
| | | import com.core.common.Cools; |
| | | import lombok.Data; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Collection; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class CheckReport { |
| | | private Date appeTime; |
| | | private Double anfme; |
| | | private String zpallet; |
| | | private String matnr; |
| | | private String maktx; |
| | | private String batch; |
| | | private String specs; |
| | | private String locNo; |
| | | private String staNo; |
| | | |
| | | public String getAppeTime$(){ |
| | | if (!Cools.isEmpty(appeTime)){ |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | return simpleDateFormat.format(this.appeTime); |
| | | } |
| | | |
| | | return ""; |
| | | } |
| | | } |
| | |
| | | package com.zy.asrs.mapper; |
| | | |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.result.CheckReport; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Mapper |
| | | @Repository |
| | |
| | | Integer selectWorkCountInSum(String matnr, @Param("start") String startTime, @Param("end") String endTime); |
| | | |
| | | Integer selectWorkCountOutSum(String matnr, @Param("start") String startTime, @Param("end") String endTime); |
| | | |
| | | List<CheckReport> selectCheckReport(Map<String, Object> param); |
| | | |
| | | Integer selectCheckReportCount(Map<String, Object> param); |
| | | } |
| | |
| | | and matnr = #{matnr} |
| | | </if> |
| | | </select> |
| | | <sql id="checkReportCondition"> |
| | | <if test="matnr!=null and matnr!='' "> |
| | | and matnr like '%' + #{matnr} + '%' |
| | | </if> |
| | | <if test="maktx!=null and maktx!='' "> |
| | | and maktx like '%' + #{maktx} + '%' |
| | | </if> |
| | | <if test="specs!=null and specs!='' "> |
| | | and specs like '%' + #{specs} + '%' |
| | | </if> |
| | | <if test="batch!=null and batch!='' "> |
| | | and batch like '%' + #{batch} + '%' |
| | | </if> |
| | | <if test="zpallet!=null and zpallet!='' "> |
| | | and zpallet like '%' + #{zpallet} + '%' |
| | | </if> |
| | | <if test="locNo!=null and locNo!='' "> |
| | | and locNo like '%' + #{locNo} + '%' |
| | | </if> |
| | | <if test="staNo!=null and staNo!='' "> |
| | | and staNo like '%' + #{staNo} + '%' |
| | | </if> |
| | | |
| | | </sql> |
| | | <select id="selectCheckReport" resultType="com.zy.asrs.entity.result.CheckReport"> |
| | | SELECT * FROM ( |
| | | SELECT ROW_NUMBER() OVER(Order by appeTime desc ) as row , * FROM asr_check_report WHERE 1 = 1 |
| | | <include refid="checkReportCondition"></include> ) as a WHERE a.row between #{curr} and #{limit} |
| | | </select> |
| | | <select id="selectCheckReportCount" resultType="java.lang.Integer"> |
| | | |
| | | SELECT COUNT(*) FROM asr_check_report WHERE 1 = 1 |
| | | <include refid="checkReportCondition"></include> |
| | | </select> |
| | | |
| | | </mapper> |
New file |
| | |
| | | var pageCurr; |
| | | function getCol() { |
| | | var cols = [ |
| | | {field: 'appeTime$', align: 'center', title: '盘点日期', width: 200} |
| | | ,{field: 'staNo', align: 'center',title: '盘点口'} |
| | | ,{field: 'locNo', align: 'center',title: '盘点库位'} |
| | | ,{field: 'zpallet', align: 'center',title: '托盘码'} |
| | | ,{field: 'matnr', align: 'center',title: '物料编码'} |
| | | ,{field: 'maktx', align: 'center',title: '物料名称'} |
| | | ,{field: 'anfme', align: 'center',title: '盘点数量'} |
| | | ,{field: 'batch', align: 'center',title: '批号'} |
| | | ,{field: 'specs', align: 'center',title: '规格'} |
| | | |
| | | ]; |
| | | return cols; |
| | | } |
| | | |
| | | layui.use(['table','laydate', 'form'], function(){ |
| | | var table = layui.table; |
| | | var $ = layui.jquery; |
| | | var layer = layui.layer; |
| | | var layDate = layui.laydate; |
| | | var form = layui.form; |
| | | |
| | | |
| | | // 数据渲染 |
| | | tableIns = table.render({ |
| | | elem: '#workIn', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | url: baseUrl+'/report/checkReport', |
| | | page: true, |
| | | limit: 16, |
| | | limits: [16, 30, 50, 100, 200, 500], |
| | | toolbar: '#toolbar', |
| | | cellMinWidth: 50, |
| | | cols: [getCol()], |
| | | request: { |
| | | pageName: 'pageNumber', |
| | | limitName: 'pageSize' |
| | | }, |
| | | parseData: function (res) { |
| | | return { |
| | | 'code': res.code, |
| | | 'msg': res.msg, |
| | | 'count': res.data.total, |
| | | 'data': res.data.records |
| | | } |
| | | }, |
| | | response: { |
| | | statusCode: 200 |
| | | }, |
| | | done: function(res, curr, count) { |
| | | if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | | } |
| | | pageCurr=curr; |
| | | limit(); |
| | | } |
| | | }); |
| | | |
| | | // 监听排序事件 |
| | | table.on('sort(workIn)', function (obj) { |
| | | var searchData = {}; |
| | | $.each($('#search-box [name]').serializeArray(), function() { |
| | | searchData[this.name] = this.value; |
| | | }); |
| | | searchData['orderByField'] = obj.field; |
| | | searchData['orderByType'] = obj.type; |
| | | tableIns.reload({ |
| | | where: searchData, |
| | | page: { |
| | | curr: 1 |
| | | }, |
| | | done: function (res, curr, count) { |
| | | if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | | } |
| | | pageCurr=curr; |
| | | limit(); |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | // 监听头工具栏事件 |
| | | table.on('toolbar(workIn)', function (obj) { |
| | | var checkStatus = table.checkStatus(obj.config.id); |
| | | switch(obj.event) { |
| | | case 'exportData': |
| | | layer.confirm('确定导出Excel吗', {shadeClose: true}, function(){ |
| | | var titles=[]; |
| | | var fields=[]; |
| | | obj.config.cols[0].map(function (col) { |
| | | if (col.type === 'normal' && col.hide === false && col.toolbar == null) { |
| | | titles.push(col.title); |
| | | fields.push(col.field); |
| | | } |
| | | }); |
| | | var exportData = {}; |
| | | $.each($('#search-box [name]').serializeArray(), function() { |
| | | exportData[this.name] = this.value; |
| | | }); |
| | | var param = { |
| | | fields: fields, |
| | | exportData: exportData |
| | | }; |
| | | $.ajax({ |
| | | url: baseUrl+"/report/viewWorkInExport.action", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: JSON.stringify(param), |
| | | dataType:'json', |
| | | contentType:'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.closeAll(); |
| | | if (res.code === 200) { |
| | | table.exportFile(titles,res.data,'xls'); |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg) |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | // 搜索栏搜索事件 |
| | | form.on('submit(search)', function (data) { |
| | | pageCurr = 1; |
| | | tableReload(false); |
| | | }); |
| | | // 搜索栏重置事件 |
| | | form.on('submit(reset)', function (data) { |
| | | pageCurr = 1; |
| | | clearFormVal($('#search-box')); |
| | | tableReload(false); |
| | | }); |
| | | layDate.render({ |
| | | elem: '.layui-laydate-range' |
| | | ,type: 'datetime' |
| | | ,range: true |
| | | }); |
| | | }); |
| | | |
| | | // 关闭动作 |
| | | $(document).on('click','#data-detail-close', function () { |
| | | parent.layer.closeAll(); |
| | | }); |
| | | |
| | | function tableReload(child) { |
| | | var searchData = {}; |
| | | $.each($('#search-box [name]').serializeArray(), function() { |
| | | searchData[this.name] = this.value; |
| | | }); |
| | | (child ? parent.tableIns : tableIns).reload({ |
| | | where: searchData, |
| | | page: { |
| | | curr: pageCurr |
| | | }, |
| | | done: function (res, curr, count) { |
| | | if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | | } |
| | | pageCurr=curr; |
| | | if (res.data.length === 0 && count !== 0) { |
| | | tableIns.reload({ |
| | | where: searchData, |
| | | page: { |
| | | curr: pageCurr-1 |
| | | } |
| | | }); |
| | | pageCurr -= 1; |
| | | } |
| | | limit(child); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function setFormVal(el, data, showImg) { |
| | | for (var val in data) { |
| | | var find = el.find(":input[id='" + val + "']"); |
| | | find.val(data[val]); |
| | | if (showImg){ |
| | | var next = find.next(); |
| | | if (next.get(0)){ |
| | | if (next.get(0).localName === "img") { |
| | | find.hide(); |
| | | next.attr("src", data[val]); |
| | | next.show(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | function clearFormVal(el) { |
| | | $(':input', el) |
| | | .val('') |
| | | .removeAttr('checked') |
| | | .removeAttr('selected'); |
| | | } |
| | | |
| | | function detailScreen(index) { |
| | | var detail = layer.getChildFrame('#data-detail', index); |
| | | var height = detail.height()+60; |
| | | if (height > ($(window).height()*0.9)) { |
| | | height = ($(window).height()*0.9); |
| | | } |
| | | layer.style(index, { |
| | | top: (($(window).height()-height)/3)+"px", |
| | | height: height+'px' |
| | | }); |
| | | $(".layui-layer-shade").remove(); |
| | | } |
| | | |
| | | $('body').keydown(function () { |
| | | if (event.keyCode === 13) { |
| | | $("#search").click(); |
| | | } |
| | | }); |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html lang="en"> |
| | | <head> |
| | | <meta charset="utf-8"> |
| | | <title></title> |
| | | <meta name="renderer" content="webkit"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | | <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
| | | <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all"> |
| | | <link rel="stylesheet" href="../../static/css/cool.css" media="all"> |
| | | <link rel="stylesheet" href="../../static/css/common.css" media="all"> |
| | | <style> |
| | | #btn-export { |
| | | margin-top: 10px; |
| | | } |
| | | </style> |
| | | </head> |
| | | <body> |
| | | |
| | | <!-- 搜索栏 --> |
| | | <div id="search-box" class="layui-form layui-card-header"> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" name="locNo" placeholder="盘点库位" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" name="zpallet" placeholder="托盘码" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" name="matnr" placeholder="物料编码" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" name="batch" placeholder="批号" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" name="specs" placeholder="规格" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | |
| | | <div id="data-search-btn" class="layui-btn-container layui-form-item"> |
| | | <button id="search" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="search">搜索</button> |
| | | <button id="reset" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="reset">重置</button> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 表格 --> |
| | | <table class="layui-hide" id="workIn" lay-filter="workIn"></table> |
| | | <script type="text/html" id="toolbar"> |
| | | <div class="layui-btn-container"> |
| | | <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData" >导出</button> |
| | | </div> |
| | | </script> |
| | | |
| | | <script type="text/html" id="operate"> |
| | | </script> |
| | | |
| | | <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> |
| | | <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/js/report/checkReport.js" charset="utf-8"></script> |
| | | </body> |
| | | </html> |
| | | |