rev:提交审核刷新页面,导入excel的时候将错误信息导出到excel中
This commit is contained in:
@@ -30,6 +30,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -83,6 +84,7 @@ public class PdmProduceWorkorderController {
|
|||||||
iPdmProduceWorkorderService.down(param);
|
iPdmProduceWorkorderService.down(param);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/unSubmits")
|
@PostMapping("/unSubmits")
|
||||||
@Log("工单取消下发")
|
@Log("工单取消下发")
|
||||||
@ApiOperation("工单取消下发")
|
@ApiOperation("工单取消下发")
|
||||||
@@ -176,5 +178,12 @@ public class PdmProduceWorkorderController {
|
|||||||
build.setTotalElements(page.getTotal());
|
build.setTotalElements(page.getTotal());
|
||||||
return new ResponseEntity<>(build, HttpStatus.OK);
|
return new ResponseEntity<>(build, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Log("导出数据")
|
||||||
|
@ApiOperation("导出数据")
|
||||||
|
@PostMapping(value = "/download")
|
||||||
|
public void download(@RequestBody Map map, HttpServletResponse response) throws IOException {
|
||||||
|
iPdmProduceWorkorderService.download(map, response);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -133,5 +133,6 @@ public interface IPdmProduceWorkorderService extends IService<PdmProduceWorkorde
|
|||||||
|
|
||||||
List<Map> reportQuery(ReportQuery query);
|
List<Map> reportQuery(ReportQuery query);
|
||||||
|
|
||||||
|
void download(Map map, HttpServletResponse response) throws IOException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import org.nl.common.enums.WorkerOrderEnum;
|
|||||||
import org.nl.common.utils.*;
|
import org.nl.common.utils.*;
|
||||||
import org.nl.common.utils.api.RestBusinessTemplate;
|
import org.nl.common.utils.api.RestBusinessTemplate;
|
||||||
import org.nl.modules.common.exception.BadRequestException;
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
|
import org.nl.modules.common.utils.FileUtil;
|
||||||
import org.nl.modules.system.util.CodeUtil;
|
import org.nl.modules.system.util.CodeUtil;
|
||||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||||
import org.nl.wms.masterdata_manage.master.service.classstandard.IMdPbClassstandardService;
|
import org.nl.wms.masterdata_manage.master.service.classstandard.IMdPbClassstandardService;
|
||||||
@@ -252,17 +253,19 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|||||||
List<List<Object>> read = excelReader.read();
|
List<List<Object>> read = excelReader.read();
|
||||||
// 循环获取的数据
|
// 循环获取的数据
|
||||||
List<PdmProduceWorkorder> data = new ArrayList<>();
|
List<PdmProduceWorkorder> data = new ArrayList<>();
|
||||||
List<Map> errlist = new ArrayList<>();
|
Map<String, String> errorMap = new HashMap();
|
||||||
row:
|
row:
|
||||||
for (int i = 0; i < read.size(); i++) {
|
for (int i = 0; i < read.size(); i++) {
|
||||||
Map<String,String> errorMap = new HashMap();
|
|
||||||
List<Object> list = read.get(i);
|
List<Object> list = read.get(i);
|
||||||
if (ObjectUtil.isEmpty(list)) {continue;}
|
if (ObjectUtil.isEmpty(list)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
PdmProduceWorkorder workorder = new PdmProduceWorkorder();
|
PdmProduceWorkorder workorder = new PdmProduceWorkorder();
|
||||||
packageForm(workorder);
|
packageForm(workorder);
|
||||||
for (int j = 0; j < list.size(); j++) {
|
for (int j = 0; j < list.size(); j++) {
|
||||||
String col = String.valueOf(list.get(j));
|
String col = String.valueOf(list.get(j));
|
||||||
解析cell:{ //如果是第一行 为生产日期
|
解析cell:
|
||||||
|
{ //如果是第一行 为生产日期
|
||||||
if (i == 0 && j == 0) {
|
if (i == 0 && j == 0) {
|
||||||
continue row;
|
continue row;
|
||||||
}
|
}
|
||||||
@@ -283,13 +286,13 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|||||||
//物料
|
//物料
|
||||||
List<MdMeMaterialbase> material_specs = materialbaseService.list(new QueryWrapper<MdMeMaterialbase>().eq("material_spec", col));
|
List<MdMeMaterialbase> material_specs = materialbaseService.list(new QueryWrapper<MdMeMaterialbase>().eq("material_spec", col));
|
||||||
if (CollectionUtils.isEmpty(material_specs)) {
|
if (CollectionUtils.isEmpty(material_specs)) {
|
||||||
errorMap.put("第" + j + "行", col+"物料规格对应物料信息不存在");
|
errorMap.put("第" + (i + 1) + "行,第" + (j + 1) + "列", col + "物料规格对应物料信息不存在");
|
||||||
} else {
|
} else {
|
||||||
Optional<MdMeMaterialbase> first = material_specs.stream().filter(mdMeMaterialbase -> mdMeMaterialbase.getMaterial_code().contains("S")
|
Optional<MdMeMaterialbase> first = material_specs.stream().filter(mdMeMaterialbase -> mdMeMaterialbase.getMaterial_code().contains("S")
|
||||||
&& Pattern.matches("^[0-9]*$", mdMeMaterialbase.getMaterial_name().substring(mdMeMaterialbase.getMaterial_name().length() - 1))
|
&& Pattern.matches("^[0-9]*$", mdMeMaterialbase.getMaterial_name().substring(mdMeMaterialbase.getMaterial_name().length() - 1))
|
||||||
).findFirst();
|
).findFirst();
|
||||||
if (!first.isPresent()) {
|
if (!first.isPresent()) {
|
||||||
errorMap.put("第" + j + "行", col+"物料规格对应物料信息不存在");
|
errorMap.put("第" + (i + 1) + "行,第" + (j + 1) + "列", col + "物料规格对应物料信息不存在");
|
||||||
}
|
}
|
||||||
workorder.setMaterial_id(first.get().getMaterial_id());
|
workorder.setMaterial_id(first.get().getMaterial_id());
|
||||||
}
|
}
|
||||||
@@ -297,7 +300,7 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|||||||
if (j == 3) {
|
if (j == 3) {
|
||||||
PdmBiWorkprocedure workprocedure = workprocedureService.getOne(new QueryWrapper<PdmBiWorkprocedure>().eq("workprocedure_name", col));
|
PdmBiWorkprocedure workprocedure = workprocedureService.getOne(new QueryWrapper<PdmBiWorkprocedure>().eq("workprocedure_name", col));
|
||||||
if (ObjectUtil.isEmpty(workprocedure)) {
|
if (ObjectUtil.isEmpty(workprocedure)) {
|
||||||
errorMap.put("第" + j + "行", col+"工序名称是否正确");
|
errorMap.put("第" + (i + 1) + "行,第" + (j + 1) + "列", col + "工序名称是否正确");
|
||||||
} else {
|
} else {
|
||||||
workorder.setWorkprocedure_id(workprocedure.getWorkprocedure_id());
|
workorder.setWorkprocedure_id(workprocedure.getWorkprocedure_id());
|
||||||
}
|
}
|
||||||
@@ -315,7 +318,7 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|||||||
//操作工
|
//操作工
|
||||||
SysUser user = userService.getOne(new QueryWrapper<SysUser>().eq("person_name", col));
|
SysUser user = userService.getOne(new QueryWrapper<SysUser>().eq("person_name", col));
|
||||||
if (ObjectUtil.isEmpty(user)) {
|
if (ObjectUtil.isEmpty(user)) {
|
||||||
errorMap.put("第" + j + "行", col+" 操作工没有账号");
|
errorMap.put("第" + (i + 1) + "行,第" + (j + 1) + "列", col + " 操作工没有账号");
|
||||||
} else {
|
} else {
|
||||||
workorder.setCurrent_produce_person_id(user.getUser_id());
|
workorder.setCurrent_produce_person_id(user.getUser_id());
|
||||||
}
|
}
|
||||||
@@ -330,10 +333,11 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|||||||
}
|
}
|
||||||
if (CollectionUtils.isEmpty(errorMap)) {
|
if (CollectionUtils.isEmpty(errorMap)) {
|
||||||
data.add(workorder);
|
data.add(workorder);
|
||||||
}else { errlist.add(errorMap); };
|
|
||||||
}
|
}
|
||||||
if (!CollectionUtils.isEmpty(errlist)){
|
;
|
||||||
throw new BadRequestException(JSON.toJSONString(errlist));
|
}
|
||||||
|
if (!CollectionUtils.isEmpty(errorMap)) {
|
||||||
|
throw new BadRequestException(JSON.toJSONString(errorMap));
|
||||||
} else {
|
} else {
|
||||||
this.saveBatch(data);
|
this.saveBatch(data);
|
||||||
}
|
}
|
||||||
@@ -344,7 +348,8 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|||||||
if (inputStream != null) {
|
if (inputStream != null) {
|
||||||
try {
|
try {
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
}catch (Exception ex){ }
|
} catch (Exception ex) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -520,6 +525,7 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|||||||
list.add(report_qty);
|
list.add(report_qty);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO:切换设备
|
//TODO:切换设备
|
||||||
@Override
|
@Override
|
||||||
public void replaceDevice(JSONObject param) {
|
public void replaceDevice(JSONObject param) {
|
||||||
@@ -550,6 +556,21 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
|||||||
//this.update(produceshiftorderDto);
|
//this.update(produceshiftorderDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void download(Map whereJson, HttpServletResponse response) throws IOException {
|
||||||
|
HashMap<String, String> map = new HashMap<>(whereJson);
|
||||||
|
int i = 1;
|
||||||
|
List<Map<String, Object>> excel_lst = new ArrayList<>();
|
||||||
|
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||||
|
Map<String, Object> mp = new LinkedHashMap<>();
|
||||||
|
mp.put("序号", i);
|
||||||
|
mp.put("错误信息", entry.getKey() + entry.getValue());
|
||||||
|
excel_lst.add(mp);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
FileUtil.downloadExcel(excel_lst, response);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map> reportQuery(ReportQuery query) {
|
public List<Map> reportQuery(ReportQuery query) {
|
||||||
Assert.notNull(query, "参数不能为空");
|
Assert.notNull(query, "参数不能为空");
|
||||||
|
|||||||
@@ -19,3 +19,12 @@ export function download(url, params) {
|
|||||||
responseType: 'blob'
|
responseType: 'blob'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function download2(url, data) {
|
||||||
|
return request({
|
||||||
|
url: url,
|
||||||
|
method: 'post',
|
||||||
|
data: data,
|
||||||
|
responseType: 'blob'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -40,6 +40,8 @@
|
|||||||
<script>
|
<script>
|
||||||
import crudProduceshiftorder from '@/views/wms/product_manage/workorder/produceshiftorder'
|
import crudProduceshiftorder from '@/views/wms/product_manage/workorder/produceshiftorder'
|
||||||
import CRUD, { crud } from '@crud/crud'
|
import CRUD, { crud } from '@crud/crud'
|
||||||
|
import { download2 } from '@/api/data'
|
||||||
|
import { downloadFile } from '@/utils'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'UploadDialog',
|
name: 'UploadDialog',
|
||||||
@@ -105,6 +107,13 @@ export default {
|
|||||||
this.crud.notify('导入成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
this.crud.notify('导入成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||||
this.$emit('tableChanged3', '')
|
this.$emit('tableChanged3', '')
|
||||||
this.$emit('update:dialogShow', false)
|
this.$emit('update:dialogShow', false)
|
||||||
|
}).catch(err => {
|
||||||
|
debugger
|
||||||
|
const list = err.response.data.message
|
||||||
|
download2('/api/produceWorkorder/download', list).then(result => {
|
||||||
|
downloadFile(result, '错误信息汇总', 'xlsx')
|
||||||
|
crud.downloadLoading = false
|
||||||
|
})
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.crud.notify('文件过大,请上传小于10MB的文件〜', CRUD.NOTIFICATION_TYPE.WARNING)
|
this.crud.notify('文件过大,请上传小于10MB的文件〜', CRUD.NOTIFICATION_TYPE.WARNING)
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ export default {
|
|||||||
const arr = []
|
const arr = []
|
||||||
arr.push(data)
|
arr.push(data)
|
||||||
crudProduceshiftorder.reportApprove(arr).then(res => {
|
crudProduceshiftorder.reportApprove(arr).then(res => {
|
||||||
//todo:刷新数据
|
this.crud.refresh()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
setForm() {
|
setForm() {
|
||||||
|
|||||||
@@ -76,15 +76,18 @@
|
|||||||
<el-table-column prop="needproduct_qty" label="待生产数"/>
|
<el-table-column prop="needproduct_qty" label="待生产数"/>
|
||||||
<el-table-column prop="report_qty" label="报工数量">
|
<el-table-column prop="report_qty" label="报工数量">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input v-model="scope.row.report_qty/" /></template>
|
<el-input v-model="scope.row.report_qty"/>
|
||||||
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="nok_qty" label="报废数量">
|
<el-table-column prop="nok_qty" label="报废数量">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input v-model="scope.row.nok_qty/" /></template>
|
<el-input v-model="scope.row.nok_qty"/>
|
||||||
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="repare_qty" label="报修数量">
|
<el-table-column prop="repare_qty" label="报修数量">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input v-model="scope.row.repare_qty/" /></template>
|
<el-input v-model="scope.row.repare_qty"/>
|
||||||
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="person_finish_qty" label="人员期末数量"/>
|
<el-table-column prop="person_finish_qty" label="人员期末数量"/>
|
||||||
<el-table-column prop="operatetime_start" label="开工时间"/>
|
<el-table-column prop="operatetime_start" label="开工时间"/>
|
||||||
@@ -99,7 +102,9 @@
|
|||||||
<el-table-column prop="confirm_time" label="审核时间" align="center"/>
|
<el-table-column prop="confirm_time" label="审核时间" align="center"/>
|
||||||
<el-table-column label="操作" width="120px" align="center" fixed="right">
|
<el-table-column label="操作" width="120px" align="center" fixed="right">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button :disabled="scope.row.report_status =='3'" size="mini" style="margin-left: -1px;margin-right: 2px" type="text" @click="reportApprove(scope.row)">提交审核</el-button>
|
<el-button :disabled="scope.row.report_status =='3'" size="mini" style="margin-left: -1px;margin-right: 2px"
|
||||||
|
type="text" @click="reportApprove(scope.row)">提交审核
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -115,7 +120,9 @@ import CRUD, { presenter, header, form } from '@crud/crud'
|
|||||||
import crudOperation from '@crud/CRUD.operation'
|
import crudOperation from '@crud/CRUD.operation'
|
||||||
import pagination from '@crud/Pagination'
|
import pagination from '@crud/Pagination'
|
||||||
import rrOperation from '@crud/RR.operation'
|
import rrOperation from '@crud/RR.operation'
|
||||||
const defaultForm = { sale_id: null,
|
|
||||||
|
const defaultForm = {
|
||||||
|
sale_id: null,
|
||||||
is_report: null,
|
is_report: null,
|
||||||
workorder_id: null,
|
workorder_id: null,
|
||||||
workorder_code: null,
|
workorder_code: null,
|
||||||
@@ -148,7 +155,8 @@ const defaultForm = { sale_id: null,
|
|||||||
material_name: null,
|
material_name: null,
|
||||||
device_id: null,
|
device_id: null,
|
||||||
is_canupdate_update: null,
|
is_canupdate_update: null,
|
||||||
material_spec: null }
|
material_spec: null
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ReportDialog',
|
name: 'ReportDialog',
|
||||||
@@ -156,7 +164,13 @@ export default {
|
|||||||
dicts: ['product_area'],
|
dicts: ['product_area'],
|
||||||
cruds() {
|
cruds() {
|
||||||
return [
|
return [
|
||||||
CRUD({ title: '报工审核', url: '/api/produceWorkorder/reportQuery2', query: {}, idField: 'macoperate_id', crudMethod: { ...crudReport }})
|
CRUD({
|
||||||
|
title: '报工审核',
|
||||||
|
url: '/api/produceWorkorder/reportQuery2',
|
||||||
|
query: {},
|
||||||
|
idField: 'macoperate_id',
|
||||||
|
crudMethod: {...crudReport}
|
||||||
|
})
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
mixins: [presenter(), header(), form(defaultForm)],
|
mixins: [presenter(), header(), form(defaultForm)],
|
||||||
|
|||||||
Reference in New Issue
Block a user