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.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -83,6 +84,7 @@ public class PdmProduceWorkorderController {
|
||||
iPdmProduceWorkorderService.down(param);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/unSubmits")
|
||||
@Log("工单取消下发")
|
||||
@ApiOperation("工单取消下发")
|
||||
@@ -95,9 +97,9 @@ public class PdmProduceWorkorderController {
|
||||
@ApiOperation("删除工单管理")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
||||
if (ids != null && ids.length > 0){
|
||||
if (ids != null && ids.length > 0) {
|
||||
iPdmProduceWorkorderService.update(new UpdateWrapper<PdmProduceWorkorder>()
|
||||
.set("is_delete",true)
|
||||
.set("is_delete", true)
|
||||
.in("workorder_id", Arrays.asList(ids)));
|
||||
}
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
@@ -107,7 +109,7 @@ public class PdmProduceWorkorderController {
|
||||
@Log("根据工序查询没有工单的设备")
|
||||
@ApiOperation("根据工序查询没有工单的设备")
|
||||
public ResponseEntity<Object> getNotWorkDeviceByWorkproceduceId(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(deviceService.getNotWorkDeviceByWorkproceduceId(param)),HttpStatus.CREATED);
|
||||
return new ResponseEntity<>(TableDataInfo.build(deviceService.getNotWorkDeviceByWorkproceduceId(param)), HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PostMapping("/forceFinish")
|
||||
@@ -122,9 +124,9 @@ public class PdmProduceWorkorderController {
|
||||
@Log("excel导入")
|
||||
@ApiOperation("excel导入")
|
||||
public ResponseEntity<Object> excelImport(@RequestParam("file") MultipartFile file, HttpServletRequest request, HttpServletResponse response) {
|
||||
RedissonUtils.lock(()->{
|
||||
iPdmProduceWorkorderService.excelImport(file,request, response);
|
||||
},"工单导入",null);
|
||||
RedissonUtils.lock(() -> {
|
||||
iPdmProduceWorkorderService.excelImport(file, request, response);
|
||||
}, "工单导入", null);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -156,25 +158,32 @@ public class PdmProduceWorkorderController {
|
||||
@ApiOperation("报工数修改")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> reportQuery(@RequestBody ReportQuery param) {
|
||||
if (!SecurityUtils.getCurrentUserId().equals("1")){
|
||||
if (!SecurityUtils.getCurrentUserId().equals("1")) {
|
||||
param.setUser_id(SecurityUtils.getCurrentUserId());
|
||||
}
|
||||
return new ResponseEntity<>(TableDataInfo.build(iPdmProduceWorkorderService.reportQuery(param)),HttpStatus.OK);
|
||||
return new ResponseEntity<>(TableDataInfo.build(iPdmProduceWorkorderService.reportQuery(param)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/reportQuery2")
|
||||
@Log("报工数修改")
|
||||
@ApiOperation("报工数修改")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> reportQuery2(ReportQuery param ,PageQuery pageQuery) {
|
||||
public ResponseEntity<Object> reportQuery2(ReportQuery param, PageQuery pageQuery) {
|
||||
Page<Object> page = PageHelper
|
||||
.startPage(pageQuery.getPage()+1, pageQuery.getSize())
|
||||
.startPage(pageQuery.getPage() + 1, pageQuery.getSize())
|
||||
.setOrderBy("workorder_code desc,seq_number asc");
|
||||
param.setOrderby("true");
|
||||
List<Map> list = iPdmProduceWorkorderService.reportQuery(param);
|
||||
TableDataInfo<Map> build = TableDataInfo.build(list);
|
||||
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);
|
||||
|
||||
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.api.RestBusinessTemplate;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.FileUtil;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.nl.wms.masterdata_manage.master.service.classstandard.IMdPbClassstandardService;
|
||||
@@ -108,8 +109,8 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
.stream().collect(Collectors.joining("','"));
|
||||
query.setProduct_series("('" + collect + "')");
|
||||
}
|
||||
if (!StringUtils.isEmpty(query.getOrder_status()) && query.getOrder_status().contains("-1")){
|
||||
query.setOrder_status(query.getOrder_status().replaceAll("-1","1,2,3,4"));
|
||||
if (!StringUtils.isEmpty(query.getOrder_status()) && query.getOrder_status().contains("-1")) {
|
||||
query.setOrder_status(query.getOrder_status().replaceAll("-1", "1,2,3,4"));
|
||||
|
||||
}
|
||||
Page<Object> page = PageHelper.startPage(pageQuery.getPage() + 1, pageQuery.getSize()).setOrderBy("ShiftOrder.workorder_code desc");
|
||||
@@ -248,21 +249,23 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
inputStream = file.getInputStream();
|
||||
//A1_TW_+device_code 日期2023/5/30
|
||||
//material_spec='24030921S'
|
||||
ExcelReader excelReader = ExcelUtil.getReader(inputStream,"推弯计划表");
|
||||
List<List<Object>> read = excelReader.read();
|
||||
// 循环获取的数据
|
||||
List<PdmProduceWorkorder> data = new ArrayList<>();
|
||||
List<Map> errlist = new ArrayList<>();
|
||||
ExcelReader excelReader = ExcelUtil.getReader(inputStream, "推弯计划表");
|
||||
List<List<Object>> read = excelReader.read();
|
||||
// 循环获取的数据
|
||||
List<PdmProduceWorkorder> data = new ArrayList<>();
|
||||
Map<String, String> errorMap = new HashMap();
|
||||
row:
|
||||
for (int i = 0; i < read.size(); i++) {
|
||||
Map<String,String> errorMap = new HashMap();
|
||||
List<Object> list = read.get(i);
|
||||
if (ObjectUtil.isEmpty(list)) {continue;}
|
||||
if (ObjectUtil.isEmpty(list)) {
|
||||
continue;
|
||||
}
|
||||
PdmProduceWorkorder workorder = new PdmProduceWorkorder();
|
||||
packageForm(workorder);
|
||||
for (int j = 0; j < list.size(); j++) {
|
||||
String col = String.valueOf(list.get(j));
|
||||
解析cell:{ //如果是第一行 为生产日期
|
||||
解析cell:
|
||||
{ //如果是第一行 为生产日期
|
||||
if (i == 0 && j == 0) {
|
||||
continue row;
|
||||
}
|
||||
@@ -276,20 +279,20 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
}
|
||||
if (j == 1) {
|
||||
//物料
|
||||
workorder.setPlanproduceend_date(col.substring(0,col.indexOf(" "))+" 18:30:00");
|
||||
workorder.setPlanproducestart_date(col.substring(0,col.indexOf(" "))+" 07:30:00");
|
||||
workorder.setPlanproduceend_date(col.substring(0, col.indexOf(" ")) + " 18:30:00");
|
||||
workorder.setPlanproducestart_date(col.substring(0, col.indexOf(" ")) + " 07:30:00");
|
||||
}
|
||||
if (j == 2) {
|
||||
//物料
|
||||
List<MdMeMaterialbase> material_specs = materialbaseService.list(new QueryWrapper<MdMeMaterialbase>().eq("material_spec", col));
|
||||
if (CollectionUtils.isEmpty(material_specs)) {
|
||||
errorMap.put("第" + j + "行", col+"物料规格对应物料信息不存在");
|
||||
errorMap.put("第" + (i + 1) + "行,第" + (j + 1) + "列", col + "物料规格对应物料信息不存在");
|
||||
} else {
|
||||
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))
|
||||
).findFirst();
|
||||
if (!first.isPresent()) {
|
||||
errorMap.put("第" + j + "行", col+"物料规格对应物料信息不存在");
|
||||
errorMap.put("第" + (i + 1) + "行,第" + (j + 1) + "列", col + "物料规格对应物料信息不存在");
|
||||
}
|
||||
workorder.setMaterial_id(first.get().getMaterial_id());
|
||||
}
|
||||
@@ -297,7 +300,7 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
if (j == 3) {
|
||||
PdmBiWorkprocedure workprocedure = workprocedureService.getOne(new QueryWrapper<PdmBiWorkprocedure>().eq("workprocedure_name", col));
|
||||
if (ObjectUtil.isEmpty(workprocedure)) {
|
||||
errorMap.put("第" + j + "行", col+"工序名称是否正确");
|
||||
errorMap.put("第" + (i + 1) + "行,第" + (j + 1) + "列", col + "工序名称是否正确");
|
||||
} else {
|
||||
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));
|
||||
if (ObjectUtil.isEmpty(user)) {
|
||||
errorMap.put("第" + j + "行", col+" 操作工没有账号");
|
||||
errorMap.put("第" + (i + 1) + "行,第" + (j + 1) + "列", col + " 操作工没有账号");
|
||||
} else {
|
||||
workorder.setCurrent_produce_person_id(user.getUser_id());
|
||||
}
|
||||
@@ -324,27 +327,29 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
workorder.setPlan_qty(new BigDecimal(Long.valueOf(col)));
|
||||
}
|
||||
if (j == 13) {
|
||||
workorder.setIs_needmove(col.equals("是")?true:false);
|
||||
workorder.setIs_needmove(col.equals("是") ? true : false);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isEmpty(errorMap)){
|
||||
if (CollectionUtils.isEmpty(errorMap)) {
|
||||
data.add(workorder);
|
||||
}else { errlist.add(errorMap); };
|
||||
}
|
||||
;
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(errlist)){
|
||||
throw new BadRequestException(JSON.toJSONString(errlist));
|
||||
}else {
|
||||
if (!CollectionUtils.isEmpty(errorMap)) {
|
||||
throw new BadRequestException(JSON.toJSONString(errorMap));
|
||||
} else {
|
||||
this.saveBatch(data);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}finally {
|
||||
if (inputStream !=null){
|
||||
} finally {
|
||||
if (inputStream != null) {
|
||||
try {
|
||||
inputStream.close();
|
||||
}catch (Exception ex){ }
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,12 +395,12 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
PdmProduceWorkorderrecord workorderrecord = packageRecordForm(workOrder);
|
||||
try {
|
||||
reportRecordService.save(workorderrecord);
|
||||
}catch (Exception ex){
|
||||
} catch (Exception ex) {
|
||||
throw new BadRequestException("当前工单存在未报工的报工记录,请先进行报工");
|
||||
}
|
||||
Map<String, Object> resp = wmsToAcsService.order(array);
|
||||
if (HttpStatus.BAD_REQUEST.equals(resp.get("status"))) {
|
||||
throw new BadRequestException(resp.get("message")!=null?String.valueOf(resp.get("message")):"acs反馈异常");
|
||||
throw new BadRequestException(resp.get("message") != null ? String.valueOf(resp.get("message")) : "acs反馈异常");
|
||||
}
|
||||
return RestBusinessTemplate.execute(() -> resp);
|
||||
}
|
||||
@@ -440,16 +445,16 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
@Override
|
||||
@Transactional
|
||||
public Object report(JSONObject param) {
|
||||
Assert.notNull(new Object[]{param, param.get("report_qty"),param.getString("workorder_id")}, "请求参数不能为空");
|
||||
Assert.notNull(new Object[]{param, param.get("report_qty"), param.getString("workorder_id")}, "请求参数不能为空");
|
||||
|
||||
PdmProduceWorkorder workorder = this.getOne(new QueryWrapper<PdmProduceWorkorder>().eq("workorder_id", param.getString("workorder_id")));
|
||||
// if (workorder.getWorkorder_status().equals(WorkerOrderEnum.COMPLETE.getCode()) || workorder.getWorkorder_status().equals(WorkerOrderEnum.FORCE_COMPLETE.getCode())) {
|
||||
// throw new BadRequestException(param.getString("workorder_id") + "当前工单已经完工不允许报工");
|
||||
// }
|
||||
Assert.notNull(workorder,"当前工单不存在");
|
||||
Assert.notNull(workorder, "当前工单不存在");
|
||||
PdmProduceWorkorderrecord one = reportRecordService.getOne(new QueryWrapper<PdmProduceWorkorderrecord>()
|
||||
.eq("workorder_id", param.getString("workorder_id")).eq("report_status", ReportEnum.REPORT_STATUS.code("生成")));
|
||||
Assert.notNull(one,param.getString("workorder_id") + "当前工单没有生成状态的报工记录");
|
||||
Assert.notNull(one, param.getString("workorder_id") + "当前工单没有生成状态的报工记录");
|
||||
workorder.setReport_qty(workorder.getReport_qty().add(param.getBigDecimal("report_qty")));
|
||||
if (workorder.getPlan_qty().doubleValue() <= workorder.getReport_qty().doubleValue()) {
|
||||
workorder.setWorkorder_status(WorkerOrderEnum.COMPLETE.getCode());
|
||||
@@ -465,16 +470,16 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
reportRecordService.update(new UpdateWrapper<PdmProduceWorkorderrecord>()
|
||||
.set("report_qty", param.getBigDecimal("report_qty"))
|
||||
.set("report_status", ReportEnum.REPORT_STATUS.code("报工"))
|
||||
.set("needproduct_qty", Math.max(0,workorder.getPlan_qty().intValue() - workorder.getReport_qty().intValue()))
|
||||
.set("needproduct_qty", Math.max(0, workorder.getPlan_qty().intValue() - workorder.getReport_qty().intValue()))
|
||||
.eq("macoperate_id", one.getMacoperate_id()));
|
||||
return one.getMacoperate_id();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unqualReport(JSONObject param) {
|
||||
Assert.notNull(new Object[]{param, param.get("report_qty"),param.getString("workorder_id")}, "请求参数不能为空");
|
||||
Assert.notNull(new Object[]{param, param.get("report_qty"), param.getString("workorder_id")}, "请求参数不能为空");
|
||||
PdmProduceWorkorder workorder = this.getOne(new QueryWrapper<PdmProduceWorkorder>().eq("workorder_id", param.getString("workorder_id")));
|
||||
Assert.notNull(workorder,"当前工单不存在");
|
||||
Assert.notNull(workorder, "当前工单不存在");
|
||||
workorder.setRepare_qty(param.getBigDecimal("nok_qty"));
|
||||
workorder.setRepare_qty(param.getBigDecimal("repare_qty"));
|
||||
workorder.setReal_qty(null);
|
||||
@@ -510,8 +515,8 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
private List<Map> packageWorkorderQty(List<PdmProduceWorkorderrecord> record, List<PdmProduceWorkorderrecord> itemRecord) {
|
||||
List<String> ids = itemRecord.stream().map(PdmProduceWorkorderrecord::getMacoperate_id).collect(Collectors.toList());
|
||||
List<PdmProduceWorkorderrecord> oldRecord = record.stream().filter(item -> ids.contains(item.getMacoperate_id())).collect(Collectors.toList());
|
||||
long old_report_qty = oldRecord.stream().mapToLong(a->a.getReport_qty().longValue()).sum();
|
||||
long new_report_qty = itemRecord.stream().mapToLong(a->a.getReport_qty().longValue()).sum();
|
||||
long old_report_qty = oldRecord.stream().mapToLong(a -> a.getReport_qty().longValue()).sum();
|
||||
long new_report_qty = itemRecord.stream().mapToLong(a -> a.getReport_qty().longValue()).sum();
|
||||
List<Map> list = new ArrayList<>();
|
||||
Map<String, Object> report_qty = new HashMap<>();
|
||||
report_qty.put("field", "report_qty");
|
||||
@@ -520,6 +525,7 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
list.add(report_qty);
|
||||
return list;
|
||||
}
|
||||
|
||||
//TODO:切换设备
|
||||
@Override
|
||||
public void replaceDevice(JSONObject param) {
|
||||
@@ -550,23 +556,38 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
//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
|
||||
public List<Map> reportQuery(ReportQuery query) {
|
||||
Assert.notNull(query,"参数不能为空");
|
||||
if (query.getIs_report()){
|
||||
Assert.notNull(query, "参数不能为空");
|
||||
if (query.getIs_report()) {
|
||||
query.setReport_status("'1','2'");
|
||||
}
|
||||
List<Map> list = reportRecordService.reportQuery(query);
|
||||
Map<String, String> hashMap = new HashMap<>();
|
||||
int i =0;
|
||||
int i = 0;
|
||||
for (Map map : list) {
|
||||
String code = (String)map.get("workorder_code");
|
||||
if (hashMap.get(code)==null){
|
||||
hashMap.put(code,code);
|
||||
i =0;
|
||||
String code = (String) map.get("workorder_code");
|
||||
if (hashMap.get(code) == null) {
|
||||
hashMap.put(code, code);
|
||||
i = 0;
|
||||
}
|
||||
i++;
|
||||
map.put("seq_number",i);
|
||||
map.put("seq_number", i);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -579,22 +600,22 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
|
||||
@Override
|
||||
public void updateReport(JSONObject param) {
|
||||
Assert.notNull(param,"参数不能为空");
|
||||
Assert.notNull(param, "参数不能为空");
|
||||
PdmProduceWorkorderrecord record = reportRecordService.getOne(new QueryWrapper<PdmProduceWorkorderrecord>()
|
||||
.eq("macoperate_id", param.getString("macoperate_id")));
|
||||
PdmProduceWorkorder workorder = this.getOne(new QueryWrapper<PdmProduceWorkorder>()
|
||||
.eq("workorder_id", record.getWorkorder_id()));
|
||||
if (!workorder.getIs_canupdate_update()){
|
||||
if (!workorder.getIs_canupdate_update()) {
|
||||
throw new BadRequestException("当前工单设置为不允许修改报工记录");
|
||||
}
|
||||
UpdateWrapper<PdmProduceWorkorderrecord> updateWrapper = new UpdateWrapper<>();
|
||||
if (param.getBigDecimal("nok_qty")!=null){
|
||||
updateWrapper.set("nok_qty",param.getBigDecimal("nok_qty"));
|
||||
if (param.getBigDecimal("nok_qty") != null) {
|
||||
updateWrapper.set("nok_qty", param.getBigDecimal("nok_qty"));
|
||||
}
|
||||
if (param.getBigDecimal("repare_qty")!=null){
|
||||
updateWrapper.set("repare_qty",param.getBigDecimal("repare_qty"));
|
||||
if (param.getBigDecimal("repare_qty") != null) {
|
||||
updateWrapper.set("repare_qty", param.getBigDecimal("repare_qty"));
|
||||
}
|
||||
updateWrapper.set("report_qty",param.getBigDecimal("report_qty"));
|
||||
updateWrapper.set("report_qty", param.getBigDecimal("report_qty"));
|
||||
reportRecordService.update(updateWrapper
|
||||
.eq("macoperate_id", param.getString("macoperate_id")));
|
||||
}
|
||||
|
||||
@@ -7,15 +7,24 @@ export function initData(url, params) {
|
||||
params.end_time = params.createTime[1]
|
||||
}
|
||||
return request({
|
||||
url: url + '?' + qs.stringify(params, { indices: false }),
|
||||
url: url + '?' + qs.stringify(params, {indices: false}),
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function download(url, params) {
|
||||
return request({
|
||||
url: url + '?' + qs.stringify(params, { indices: false }),
|
||||
url: url + '?' + qs.stringify(params, {indices: false}),
|
||||
method: 'get',
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
export function download2(url, data) {
|
||||
return request({
|
||||
url: url,
|
||||
method: 'post',
|
||||
data: data,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
@@ -40,6 +40,8 @@
|
||||
<script>
|
||||
import crudProduceshiftorder from '@/views/wms/product_manage/workorder/produceshiftorder'
|
||||
import CRUD, { crud } from '@crud/crud'
|
||||
import { download2 } from '@/api/data'
|
||||
import { downloadFile } from '@/utils'
|
||||
|
||||
export default {
|
||||
name: 'UploadDialog',
|
||||
@@ -105,6 +107,13 @@ export default {
|
||||
this.crud.notify('导入成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.$emit('tableChanged3', '')
|
||||
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 {
|
||||
this.crud.notify('文件过大,请上传小于10MB的文件〜', CRUD.NOTIFICATION_TYPE.WARNING)
|
||||
|
||||
@@ -260,7 +260,7 @@ export default {
|
||||
const arr = []
|
||||
arr.push(data)
|
||||
crudProduceshiftorder.reportApprove(arr).then(res => {
|
||||
//todo:刷新数据
|
||||
this.crud.refresh()
|
||||
})
|
||||
},
|
||||
setForm() {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<!-- 搜索 -->
|
||||
<el-form ref="form" :inline="true" :rules="rules" size="mini" label-width="180px">
|
||||
<el-form-item label="工单编码">
|
||||
<el-input v-model="query.workorder_code" style="width: 200px;" clearable />
|
||||
<el-input v-model="query.workorder_code" style="width: 200px;" clearable/>
|
||||
</el-form-item>
|
||||
<el-form-item label="班次类型" prop="shift_type_scode">
|
||||
<el-select
|
||||
@@ -47,11 +47,11 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-dropdown split-button type="primary" class="filter-item" @click="report()">
|
||||
<i class="el-icon-search el-icon--left" />查询
|
||||
<i class="el-icon-search el-icon--left"/>查询
|
||||
</el-dropdown>
|
||||
</el-form>
|
||||
</div>
|
||||
<crudOperation v-show="false" :permission="permission" />
|
||||
<crudOperation v-show="false" :permission="permission"/>
|
||||
</div>
|
||||
<!--表格渲染-->
|
||||
|
||||
@@ -63,59 +63,66 @@
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="workorder_code" label="工单编号" />
|
||||
<el-table-column prop="seq_number" label="报工顺序号" />
|
||||
<el-table-column type="selection" width="55"/>
|
||||
<el-table-column prop="workorder_code" label="工单编号"/>
|
||||
<el-table-column prop="seq_number" label="报工顺序号"/>
|
||||
<el-table-column prop="shift_type_scode" label="班次类型">
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.PDM_BI_SHIFTTYPE[scope.row.shift_type_scode] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="product_area" label="生产车间" />
|
||||
<el-table-column prop="device_code" label="设备编码" align="center" />
|
||||
<el-table-column prop="needproduct_qty" label="待生产数" />
|
||||
<el-table-column prop="product_area" label="生产车间"/>
|
||||
<el-table-column prop="device_code" label="设备编码" align="center"/>
|
||||
<el-table-column prop="needproduct_qty" label="待生产数"/>
|
||||
<el-table-column prop="report_qty" label="报工数量">
|
||||
<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 prop="nok_qty" label="报废数量">
|
||||
<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 prop="repare_qty" label="报修数量">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.repare_qty/" /></template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="person_finish_qty" label="人员期末数量" />
|
||||
<el-table-column prop="operatetime_start" label="开工时间" />
|
||||
<el-table-column prop="operatetime_end" label="完工时间" />
|
||||
<el-table-column prop="report_status" label="报工状态">
|
||||
<template slot-scope="scope">
|
||||
{{ reportStatus[scope.row.report_status-1].label }}
|
||||
<el-input v-model="scope.row.repare_qty"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="produce_person_name" label="操作人" align="center" />
|
||||
<el-table-column prop="confirm_name" label="审核人" align="center" />
|
||||
<el-table-column prop="confirm_time" label="审核时间" align="center" />
|
||||
<el-table-column prop="person_finish_qty" label="人员期末数量"/>
|
||||
<el-table-column prop="operatetime_start" label="开工时间"/>
|
||||
<el-table-column prop="operatetime_end" label="完工时间"/>
|
||||
<el-table-column prop="report_status" label="报工状态">
|
||||
<template slot-scope="scope">
|
||||
{{ reportStatus[scope.row.report_status - 1].label }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="produce_person_name" label="操作人" align="center"/>
|
||||
<el-table-column prop="confirm_name" label="审核人" align="center"/>
|
||||
<el-table-column prop="confirm_time" label="审核时间" align="center"/>
|
||||
<el-table-column label="操作" width="120px" align="center" fixed="right">
|
||||
<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>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
<pagination/>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudReport from '@/views/wms/product_manage/workorder/produceshiftorder'
|
||||
import CRUD, { presenter, header, form } from '@crud/crud'
|
||||
import CRUD, {presenter, header, form} from '@crud/crud'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
const defaultForm = { sale_id: null,
|
||||
|
||||
const defaultForm = {
|
||||
sale_id: null,
|
||||
is_report: null,
|
||||
workorder_id: null,
|
||||
workorder_code: null,
|
||||
@@ -148,29 +155,36 @@ const defaultForm = { sale_id: null,
|
||||
material_name: null,
|
||||
device_id: null,
|
||||
is_canupdate_update: null,
|
||||
material_spec: null }
|
||||
material_spec: null
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'ReportDialog',
|
||||
components: { crudOperation, pagination, rrOperation },
|
||||
components: {crudOperation, pagination, rrOperation},
|
||||
dicts: ['product_area'],
|
||||
cruds() {
|
||||
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)],
|
||||
data() {
|
||||
return {
|
||||
trueorfalse: [{ value: true, label: '是' }, { value: false, label: '否' }],
|
||||
reportStatus: [{ value: '1', label: '创建记录' }, { value: '2', label: '报工完成' }, { value: '3', label: '审核完成' }],
|
||||
trueorfalse: [{value: true, label: '是'}, {value: false, label: '否'}],
|
||||
reportStatus: [{value: '1', label: '创建记录'}, {value: '2', label: '报工完成'}, {value: '3', label: '审核完成'}],
|
||||
queryTypeOptions: [
|
||||
{ key: 'name', display_name: '字典名称' },
|
||||
{ key: 'description', display_name: '描述' }
|
||||
{key: 'name', display_name: '字典名称'},
|
||||
{key: 'description', display_name: '描述'}
|
||||
],
|
||||
rules: {
|
||||
material_spec: [
|
||||
{ required: true, message: '请输入编码', trigger: 'blur' }
|
||||
{required: true, message: '请输入编码', trigger: 'blur'}
|
||||
]
|
||||
},
|
||||
permission: {
|
||||
@@ -182,7 +196,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
report() {
|
||||
crudReport.reportQuery({ workorder_code: this.form.workorder_code, is_report: this.form.is_report }).then(res => {
|
||||
crudReport.reportQuery({workorder_code: this.form.workorder_code, is_report: this.form.is_report}).then(res => {
|
||||
this.tableData = res.content
|
||||
})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user