| | |
| | | return R.ok(locDetlPage); |
| | | } |
| | | |
| | | @RequestMapping(value = "/locDetl/groupLocExport/auth") |
| | | @ManagerAuth(memo = "库位汇总导出") |
| | | public R groupLocExport(@RequestBody JSONObject param) { |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("locDetl")); |
| | | Map<String, Object> queryParam = new HashMap<>(); |
| | | putIfPresent(queryParam, "matnr", map.get("matnr")); |
| | | putIfPresent(queryParam, "maktx", map.get("maktx")); |
| | | putIfPresent(queryParam, "specs", map.get("specs")); |
| | | putIfPresent(queryParam, "warnStatus", map.get("warnStatus")); |
| | | int total = Optional.ofNullable(locDetlMapper.groupLocListCount(queryParam)).orElse(0); |
| | | if (total <= 0) { |
| | | return R.ok(new ArrayList<>()); |
| | | } |
| | | queryParam.put("pageNumber", 1); |
| | | queryParam.put("pageSize", total); |
| | | List<AbnormalLocDetlParam> list = locDetlMapper.groupLocList(queryParam); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | private void putIfPresent(Map<String, Object> target, String key, Object value) { |
| | | String normalized = normalizeFilterText(value); |
| | | if (normalized != null) { |
| | |
| | | return '<span style="color:' + color + ';">' + text + '</span>'; |
| | | } |
| | | } |
| | | // , {field: 'storeMaxDate', align: 'center', title: '库龄上限', sort: true} |
| | | , {field: 'anfme', align: 'center', title: '实际数量'} |
| | | // , {field: 'nowTime', align: 'center', title: '实际库龄'} |
| | | |
| | |
| | | break; |
| | | 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 titles = ['物料号', '物料名称', '数量上限', '数量下限', '状态', '实际数量']; |
| | | var fields = ['matnr', 'maktx', 'storeMax', 'storeMin', 'warnStatus', 'anfme']; |
| | | var exportData = {}; |
| | | $.each($('#search-box [name]').serializeArray(), function () { |
| | | exportData[this.name] = this.value; |
| | |
| | | }; |
| | | var loadIndex = layer.msg('正在导出...', {icon: 16, shade: 0.01, time: false}); |
| | | $.ajax({ |
| | | url: baseUrl + "/locDetl/export/auth", |
| | | url: baseUrl + "/locDetl/groupLocExport/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: JSON.stringify(param), |
| | | dataType: 'json', |