add:统计分析
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
package org.nl.wms.analysis_manage.productCapacity.controller;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2023/10/8 10:24
|
||||
*/
|
||||
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.analysis_manage.productCapacity.dto.ProductCapQuery;
|
||||
import org.nl.wms.product_manage.service.workorder.IPdmProduceWorkorderService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/productCap")
|
||||
@Slf4j
|
||||
public class ProductCapController {
|
||||
|
||||
@Autowired
|
||||
private IPdmProduceWorkorderService workorderService;
|
||||
|
||||
@GetMapping()
|
||||
@Log("查询产能利用率")
|
||||
public ResponseEntity<Object> byMaterial(ProductCapQuery query, PageQuery page) {
|
||||
Page<Object> result = PageHelper.startPage(page.getPage() + 1, page.getSize());
|
||||
List<Map> list = workorderService.productCap(query);
|
||||
TableDataInfo build = TableDataInfo.build(list);
|
||||
build.setTotalElements(result.getTotal());
|
||||
return new ResponseEntity<>(build, HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.nl.wms.analysis_manage.productCapacity.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2023/10/8 10:25
|
||||
*/
|
||||
@Data
|
||||
public class ProductCapQuery {
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
private String device_code;
|
||||
/**
|
||||
* 工序id
|
||||
*/
|
||||
private String workprocedure_id;
|
||||
/**
|
||||
* 车间
|
||||
*/
|
||||
private String product_area;
|
||||
/**
|
||||
* 日期
|
||||
*/
|
||||
private String[] create_time;
|
||||
private String start_time;
|
||||
private String end_time;
|
||||
|
||||
|
||||
public void setCreate_time(String[] create_time) {
|
||||
this.create_time = create_time;
|
||||
if (create_time!=null && create_time.length == 2){
|
||||
this.start_time = create_time[0];
|
||||
this.end_time = create_time[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package org.nl.wms.analysis_manage.scrapRate.controller;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2023/10/8 10:24
|
||||
*/
|
||||
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.analysis_manage.scrapRate.service.dto.ScrapRateQuery;
|
||||
import org.nl.wms.analysis_manage.workingGoods.service.dto.ByProcessQuery;
|
||||
import org.nl.wms.product_manage.service.workorder.IPdmProduceWorkorderService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/scrapRate")
|
||||
@Slf4j
|
||||
public class ScrapRateController {
|
||||
|
||||
@Autowired
|
||||
private IPdmProduceWorkorderService workorderService;
|
||||
|
||||
@GetMapping()
|
||||
@Log("查询废品率")
|
||||
public ResponseEntity<Object> byMaterial(ScrapRateQuery query, PageQuery page) {
|
||||
Page<Object> result = PageHelper.startPage(page.getPage() + 1, page.getSize());
|
||||
List<Map> list = workorderService.scrapRate(query);
|
||||
TableDataInfo build = TableDataInfo.build(list);
|
||||
build.setTotalElements(result.getTotal());
|
||||
return new ResponseEntity<>(build, HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.nl.wms.analysis_manage.scrapRate.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2023/10/8 10:25
|
||||
*/
|
||||
@Data
|
||||
public class ScrapRateQuery {
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
private String device_code;
|
||||
/**
|
||||
* 工序id
|
||||
*/
|
||||
private String workprocedure_id;
|
||||
/**
|
||||
* 车间
|
||||
*/
|
||||
private String product_area;
|
||||
/**
|
||||
* 日期
|
||||
*/
|
||||
private String[] create_time;
|
||||
private String start_time;
|
||||
private String end_time;
|
||||
|
||||
|
||||
public void setCreate_time(String[] create_time) {
|
||||
this.create_time = create_time;
|
||||
if (create_time!=null && create_time.length == 2){
|
||||
this.start_time = create_time[0];
|
||||
this.end_time = create_time[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package org.nl.wms.analysis_manage.workingGoods.service.dto;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2023/10/7 10:11
|
||||
*/
|
||||
public class ByMaterialQuery {
|
||||
|
||||
public void sdfds(){
|
||||
System.out.println(this.getClass().getName()+"调用方法");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
System.out.println("对象被释放");
|
||||
}
|
||||
}
|
||||
class demo{
|
||||
public static void main(String[] args) {
|
||||
ByMaterialQuery query = new ByMaterialQuery();
|
||||
query.sdfds();
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.ext_manage.acs.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
@@ -53,9 +54,12 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@@ -357,11 +361,24 @@ public class AcsToWmsServiceImpl implements AcsToWmsService{
|
||||
return;
|
||||
}
|
||||
Iterator<String> iterator = param.keySet().iterator();
|
||||
Map<String, PdmProduceWorkorder> map = workorderService.list(new QueryWrapper<PdmProduceWorkorder>()
|
||||
.in("workorder_code", param.keySet()))
|
||||
.stream().collect(HashMap::new, (k, v) -> k.put(v.getWorkorder_code(), v), HashMap::putAll);
|
||||
Date now = new Date();
|
||||
BigDecimal divide = new BigDecimal(0);
|
||||
while (iterator.hasNext()){
|
||||
String workorderCode = iterator.next();
|
||||
BigDecimal dq_real_qty = param.getBigDecimal(workorderCode);
|
||||
PdmProduceWorkorder workorder = map.get(workorderCode);
|
||||
BigDecimal subtract = dq_real_qty.subtract(workorder.getDq_real_qty());
|
||||
if (workorder.getUpdate_time() !=null){
|
||||
divide = subtract.divide(new BigDecimal(DateUtil.between(workorder.getUpdate_time(), now, DateUnit.SECOND)), 3, RoundingMode.HALF_UP);
|
||||
}
|
||||
workorderService.update(new UpdateWrapper<PdmProduceWorkorder>()
|
||||
.set("dq_real_qty",dq_real_qty).eq("workorder_code",workorderCode));
|
||||
.set("dq_real_qty",dq_real_qty)
|
||||
.set("update_time",DateUtil.now())
|
||||
.set("slope",divide)
|
||||
.eq("workorder_code",workorderCode));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -408,6 +408,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService{
|
||||
map.put("update_id", currentUserId);
|
||||
map.put("update_name", nickName);
|
||||
map.put("update_time", DateUtil.now());
|
||||
map.put("confirm_time", DateUtil.now());
|
||||
map.put("realproduceend_date", DateUtil.now());
|
||||
wo.update(map, "workorder_id = '" + workorder_id + "'");
|
||||
//2.设置实际数量:数量待确认: 是否需要从报工记录表统计
|
||||
|
||||
@@ -5,6 +5,8 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.analysis_manage.productCapacity.dto.ProductCapQuery;
|
||||
import org.nl.wms.analysis_manage.scrapRate.service.dto.ScrapRateQuery;
|
||||
import org.nl.wms.analysis_manage.workingGoods.service.dto.ByProcessQuery;
|
||||
import org.nl.wms.product_manage.service.workorder.dao.PdmProduceWorkorder;
|
||||
import org.nl.wms.product_manage.service.workorder.dto.PdmProduceWorkorderDto;
|
||||
@@ -155,8 +157,27 @@ public interface IPdmProduceWorkorderService extends IService<PdmProduceWorkorde
|
||||
|
||||
List<Map> reportQuery(ReportQuery query);
|
||||
|
||||
/**
|
||||
* 在制品统计分析
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
List<Map> goodAnilysis(ByProcessQuery query);
|
||||
|
||||
/**
|
||||
* 不合格品分析
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
List<Map> scrapRate(ScrapRateQuery query);
|
||||
|
||||
/**
|
||||
* 不合格品分析
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
List<Map> productCap(ProductCapQuery query);
|
||||
|
||||
void download(Map map, HttpServletResponse response)
|
||||
throws IOException;
|
||||
}
|
||||
|
||||
@@ -176,6 +176,18 @@ public class PdmProduceWorkorder implements Serializable{
|
||||
* 下发时间
|
||||
*/
|
||||
private String down_time;
|
||||
|
||||
/**
|
||||
* 开工时间
|
||||
*/
|
||||
private String open_time;
|
||||
|
||||
|
||||
/**
|
||||
* 增长率
|
||||
*/
|
||||
private BigDecimal slope;
|
||||
|
||||
/**
|
||||
* 完工人
|
||||
*/
|
||||
|
||||
@@ -3,6 +3,8 @@ package org.nl.wms.product_manage.service.workorder.dao.mapper;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.wms.analysis_manage.productCapacity.dto.ProductCapQuery;
|
||||
import org.nl.wms.analysis_manage.scrapRate.service.dto.ScrapRateQuery;
|
||||
import org.nl.wms.analysis_manage.workingGoods.service.dto.ByProcessQuery;
|
||||
import org.nl.wms.product_manage.service.workorder.dao.PdmProduceWorkorder;
|
||||
import org.nl.wms.product_manage.service.workorder.dto.PdmProduceWorkorderDto;
|
||||
@@ -47,4 +49,17 @@ public interface PdmProduceWorkorderMapper extends BaseMapper<PdmProduceWorkorde
|
||||
*/
|
||||
List<Map> goodAnalysis(ByProcessQuery query);
|
||||
|
||||
/**
|
||||
* 不合格品统计
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
List<Map> scrapRate(ScrapRateQuery query);
|
||||
/**
|
||||
* 不合格品统计
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
List<Map> productCap(ProductCapQuery query);
|
||||
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@
|
||||
<if test="product_area != null and product_area != ''">
|
||||
and pdm_produce_workorder.product_area >= #{product_area}
|
||||
</if>
|
||||
<if test="start_time != null and start_time != ''">
|
||||
<if test="end_time != null and end_time != ''">
|
||||
and #{end_time} >= pdm_produce_workorder.create_time
|
||||
</if>
|
||||
<if test="blurry != null and blurry != ''">
|
||||
@@ -269,6 +269,76 @@
|
||||
md_me_materialbase.material_code,
|
||||
pdm_bi_workprocedure.workprocedure_name
|
||||
</select>
|
||||
<select id="scrapRate" resultType="java.util.Map">
|
||||
SELECT
|
||||
pdm_produce_workorder.product_area,
|
||||
pdm_produce_workorder.device_code,
|
||||
sum( real_qty ) real_qty,
|
||||
sum( nok_qty ) nok_qty,
|
||||
pdm_bi_device.device_name,
|
||||
pdm_bi_workprocedure.workprocedure_name,
|
||||
IF
|
||||
( sum( real_qty ) > 0, sum( nok_qty ) / sum( real_qty ), 99 ) AS nok_rate
|
||||
FROM
|
||||
pdm_produce_workorder
|
||||
LEFT JOIN pdm_bi_device ON pdm_bi_device.device_code = pdm_produce_workorder.device_code
|
||||
LEFT JOIN pdm_bi_workprocedure ON pdm_bi_workprocedure.workprocedure_id = pdm_produce_workorder.workprocedure_id
|
||||
WHERE
|
||||
workorder_status IN ( '6', '7' )
|
||||
<if test="device_code != null and device_code != ''">
|
||||
and pdm_produce_workorder.device_code = #{device_code}
|
||||
</if>
|
||||
<if test="workprocedure_id != null and workprocedure_id != ''">
|
||||
and pdm_produce_workorder.workprocedure_id = #{workprocedure_id}
|
||||
</if>
|
||||
<if test="start_time != null and start_time != ''">
|
||||
and pdm_produce_workorder.create_time >= #{start_time}
|
||||
</if>
|
||||
<if test="product_area != null and product_area != ''">
|
||||
and pdm_produce_workorder.product_area >= #{product_area}
|
||||
</if>
|
||||
<if test="end_time != null and end_time != ''">
|
||||
and #{end_time} >= create_time
|
||||
</if>
|
||||
GROUP BY pdm_produce_workorder.device_code
|
||||
|
||||
</select>
|
||||
<select id="productCap" resultType="java.util.Map">
|
||||
SELECT GROUP_CONCAT(pdm_produce_workorder.workorder_code) orders,
|
||||
pdm_produce_workorder.product_area,
|
||||
pdm_produce_workorder.device_code,
|
||||
pdm_bi_device.device_name,
|
||||
REPLACE(pdm_bi_bomdtl.manufacture,'ph','') theory,
|
||||
sum(real_qty)/sum( TIMESTAMPDIFF( HOUR, confirm_time, open_time ) ) realty,
|
||||
pdm_bi_workprocedure.workprocedure_name,
|
||||
sum( real_qty ) real_qty,
|
||||
sum( plan_qty ) plan_qty,
|
||||
sum( TIMESTAMPDIFF( HOUR, confirm_time, open_time ) ) hours
|
||||
FROM
|
||||
pdm_produce_workorder
|
||||
LEFT JOIN pdm_bi_device ON pdm_bi_device.device_code = pdm_produce_workorder.device_code
|
||||
LEFT JOIN pdm_bi_workprocedure ON pdm_bi_workprocedure.workprocedure_id = pdm_produce_workorder.workprocedure_id
|
||||
LEFT JOIN pdm_bi_bomdtl on pdm_bi_device.device_name = pdm_bi_bomdtl.resources
|
||||
WHERE
|
||||
workorder_status IN ( '6', '7' )
|
||||
<if test="device_code != null and device_code != ''">
|
||||
and pdm_produce_workorder.device_code = #{device_code}
|
||||
</if>
|
||||
<if test="workprocedure_id != null and workprocedure_id != ''">
|
||||
and pdm_produce_workorder.workprocedure_id = #{workprocedure_id}
|
||||
</if>
|
||||
<if test="start_time != null and start_time != ''">
|
||||
and pdm_produce_workorder.create_time >= #{start_time}
|
||||
</if>
|
||||
<if test="product_area != null and product_area != ''">
|
||||
and pdm_produce_workorder.product_area >= #{product_area}
|
||||
</if>
|
||||
<if test="end_time != null and end_time != ''">
|
||||
and #{end_time} >= pdm_produce_workorder.create_time
|
||||
</if>
|
||||
GROUP BY
|
||||
device_code
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@ 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.analysis_manage.productCapacity.dto.ProductCapQuery;
|
||||
import org.nl.wms.analysis_manage.scrapRate.service.dto.ScrapRateQuery;
|
||||
import org.nl.wms.analysis_manage.workingGoods.service.dto.ByProcessQuery;
|
||||
import org.nl.wms.ext_manage.acs.service.WmsToAcsService;
|
||||
import org.nl.wms.masterdata_manage.master.service.classstandard.IMdPbClassstandardService;
|
||||
@@ -203,7 +205,7 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
this.update(updateWrapper);
|
||||
});
|
||||
}
|
||||
this.update(new UpdateWrapper<PdmProduceWorkorder>().set("workorder_status", WorkerOrderEnum.SEND.getCode()).set("down_id", SecurityUtils.getCurrentUserId()).set("down_name", SecurityUtils.getCurrentNickName()).set("down_time", new Date()).in("workorder_id", ids));
|
||||
this.update(new UpdateWrapper<PdmProduceWorkorder>().set("workorder_status", WorkerOrderEnum.SEND.getCode()).set("down_id", SecurityUtils.getCurrentUserId()).set("down_name", SecurityUtils.getCurrentNickName()).set("update_time", new Date()).set("down_time", new Date()).in("workorder_id", ids));
|
||||
this.recordWorkOrder(OptionRecord.OptionEnum.UPDATE, ids.toArray(new String[0]));
|
||||
}
|
||||
|
||||
@@ -269,6 +271,9 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
workorder.setRealproduceend_date(DateUtil.now().replace("-", "/"));
|
||||
workorder.setWorkorder_status(WorkerOrderEnum.COMPLETE.getCode());
|
||||
workorder.setAps_workorder_status("B");
|
||||
workorder.setConfirm_time(DateUtil.now());
|
||||
workorder.setConfirm_id(SecurityUtils.getCurrentUserId());
|
||||
workorder.setConfirm_name(SecurityUtils.getCurrentNickName());
|
||||
}
|
||||
else{
|
||||
workorder.setWorkorder_status(WorkerOrderEnum.STOP.getCode());
|
||||
@@ -685,6 +690,7 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
workOrder.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
workOrder.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
workOrder.setReal_qty(null);
|
||||
workOrder.setOpen_time(DateUtil.now());
|
||||
this.update(workOrder, new QueryWrapper<PdmProduceWorkorder>().eq("workorder_id", param.getString("workorder_id")));
|
||||
//开工为首道工序时,更新订单状态为开工
|
||||
PdmBiWorkprocedure isFirst = workprocedureService.getOne(new LambdaUpdateWrapper<PdmBiWorkprocedure>().eq(PdmBiWorkprocedure::getWorkprocedure_id, workOrder.getWorkprocedure_id()).eq(PdmBiWorkprocedure::getIs_first, 1));
|
||||
@@ -876,4 +882,15 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
public List<Map> goodAnilysis(ByProcessQuery query) {
|
||||
return this.baseMapper.goodAnalysis(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map> scrapRate(ScrapRateQuery query) {
|
||||
return this.baseMapper.scrapRate(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map> productCap(ProductCapQuery query) {
|
||||
List<Map> maps = this.baseMapper.productCap(query);
|
||||
return maps;
|
||||
}
|
||||
}
|
||||
|
||||
269
mes/qd/src/views/wms/analysis_manage/productCapacity/index.vue
Normal file
269
mes/qd/src/views/wms/analysis_manage/productCapacity/index.vue
Normal file
@@ -0,0 +1,269 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="demo-form-inline"
|
||||
label-position="right"
|
||||
label-width="80px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="车间">
|
||||
<el-select
|
||||
v-model="query.product_area"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="全部"
|
||||
class="filter-item"
|
||||
@change="crud.toQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.product_area"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="生产日期">
|
||||
<el-date-picker
|
||||
v-model="query.create_time"
|
||||
type="daterange"
|
||||
value-format="yyyy-MM-dd"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="['00:00:00','23:59:59']"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备编号">
|
||||
<el-input
|
||||
v-model="query.device_code"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="物料编码,规格"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属工序">
|
||||
<el-select v-model="query.workprocedure_id" class="filter-item" clearable filterable placeholder="所属工序" size="small" style="width: 280px">
|
||||
<el-option
|
||||
v-for="item in workList"
|
||||
:key="item.workprocedure_id"
|
||||
:label="item.workprocedure_name"
|
||||
:value="item.workprocedure_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<rrOperation />
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission">
|
||||
<!-- <el-button-->
|
||||
<!-- slot="right"-->
|
||||
<!-- class="filter-item"-->
|
||||
<!-- type="warning"-->
|
||||
<!-- icon="el-icon-check"-->
|
||||
<!-- size="mini"-->
|
||||
<!-- @click="sync"-->
|
||||
<!-- >-->
|
||||
<!-- 同步-->
|
||||
<!-- </el-button>-->
|
||||
</crudOperation>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
:data="crud.data"
|
||||
size="mini"
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<el-table-column prop="product_area" width="120" label="所属车间">
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.product_area[scope.row.product_area] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="device_code" label="设备编号" width="120" show-overflow-tooltip />
|
||||
<el-table-column prop="device_name" label="设备名称" width="150" />
|
||||
<el-table-column prop="workprocedure_name" label="工序名称" width="150" show-overflow-tooltip />
|
||||
<el-table-column prop="plan_qty" label="计划生产数量" width="120" />
|
||||
<el-table-column prop="real_qty" label="实际生产数量" width="120" />
|
||||
<el-table-column prop="hours" label="实际生产耗时(h)" width="120" :formatter="crud.formatNum0"/>
|
||||
<el-table-column prop="theory" label="设计产能(ph)" width="120" />
|
||||
<el-table-column prop="realty" label="实际产能(ph)" width="120" />
|
||||
<el-table-column prop="realty" label="产能利用率(%)" width="120" >
|
||||
<template slot-scope="scope" :formatter="crud.formatNum0">
|
||||
<span>{{ Number(scope.row.realty/scope.row.theory).toFixed(3)}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="orders" label="工单列表" width="150" show-overflow-tooltip/>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
<div id="main2" style="width: 100%;height:350px;"></div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import productCap from '@/views/wms/analysis_manage/productCapacity/productCap'
|
||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import { downloadFile } from '@/utils'
|
||||
import crudDevice from '@/api/wms/pdm/device'
|
||||
import echarts from 'echarts'
|
||||
|
||||
const defaultForm = {
|
||||
product_area: null,
|
||||
device_code: null,
|
||||
device_name: null,
|
||||
workprocedure_name: null,
|
||||
theory: null,
|
||||
real_qty: null,
|
||||
plan_qty: null,
|
||||
realty: null,
|
||||
hours: null,
|
||||
orders: null,
|
||||
}
|
||||
export default {
|
||||
name: 'WorkGood',
|
||||
dicts: ['product_area'],
|
||||
components: { pagination, crudOperation, rrOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '废品统计',
|
||||
optShow: { add: false, reset: true },
|
||||
url: 'api/productCap',
|
||||
idField: 'id',
|
||||
crudMethod: { ...productCap }
|
||||
})
|
||||
},
|
||||
data() {
|
||||
const numberOne = (rule, value, callback) => {
|
||||
const numReg = /^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/
|
||||
const numRe = new RegExp(numReg)
|
||||
if (value) {
|
||||
if (!numRe.test(value)) {
|
||||
callback(new Error('只能输入数字'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
return {
|
||||
measure_unit: [],
|
||||
sects: [],
|
||||
workList: [],
|
||||
downloadLoading: false,
|
||||
permission: {
|
||||
add: ['admin', 'dept:add'],
|
||||
edit: ['admin', 'dept:edit'],
|
||||
del: ['admin', 'dept:del']
|
||||
},
|
||||
trueorfalse: [{ value: true, label: '是' }, { value: false, label: '否' }]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getWorkprocedure()
|
||||
},
|
||||
methods: {
|
||||
|
||||
sync() {
|
||||
dailyStructivt.sync(Array.of('st_ivt_structivt_bcp', 'st_ivt_structivt_cp', 'st_ivt_structivt_yl')).then(result => {
|
||||
this.crud.notify('同步成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
}).catch(() => { })
|
||||
},
|
||||
getWorkprocedure() { // 获取工序下拉框
|
||||
crudDevice.getWorkprocedure().then(res => {
|
||||
this.workList = res
|
||||
})
|
||||
},
|
||||
[CRUD.HOOK.afterRefresh]() {
|
||||
var pigdata =[]
|
||||
this.crud.data.forEach(a=>{
|
||||
pigdata.push({"value":a.realty,"name":a.device_name})
|
||||
}
|
||||
)
|
||||
var myChart = echarts.init(document.getElementById('main2'));
|
||||
var option = {
|
||||
title: {
|
||||
text: '实际产能饼图',
|
||||
left: 'center'
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'item'
|
||||
},
|
||||
legend: {
|
||||
orient: 'vertical',
|
||||
left: 'left'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '实际产能',
|
||||
type: 'pie',
|
||||
radius: '70%',
|
||||
data: pigdata,
|
||||
emphasis: {
|
||||
itemStyle: {
|
||||
shadowBlur: 10,
|
||||
shadowOffsetX: 0,
|
||||
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
myChart.setOption(option);
|
||||
},
|
||||
downloadMethod() {
|
||||
this.beforeInit()
|
||||
this.downloadLoading = true
|
||||
download(this.url + '/download', this.params).then(result => {
|
||||
this.downloadFile(result, this.title + '数据', 'xlsx')
|
||||
this.downloadLoading = false
|
||||
}).catch(() => {
|
||||
this.downloadLoading = false
|
||||
})
|
||||
},
|
||||
beforeInit() {
|
||||
return true
|
||||
},
|
||||
sectChange(val) {
|
||||
this.form.sect_id = val[1]
|
||||
},
|
||||
formatUnit(row, column) {
|
||||
const values = this.measure_unit.filter(v => {
|
||||
return v.value === row.qty_unit_id
|
||||
})
|
||||
return values[0].label
|
||||
},
|
||||
sectQueryChange(val) {
|
||||
if (val.length === 1) {
|
||||
this.query.stor_id = val[0]
|
||||
this.query.sect_id = ''
|
||||
}
|
||||
if (val.length === 0) {
|
||||
this.query.sect_id = ''
|
||||
this.query.stor_id = ''
|
||||
}
|
||||
if (val.length === 2) {
|
||||
this.query.stor_id = val[0]
|
||||
this.query.sect_id = val[1]
|
||||
}
|
||||
this.crud.toQuery()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -2,7 +2,7 @@ import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/structivtDaily',
|
||||
url: 'api/scrapRate',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
@@ -10,24 +10,18 @@ export function add(data) {
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/structivtDaily',
|
||||
url: 'api/scrapRate',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
export function sync(param) {
|
||||
return request({
|
||||
url: 'api/structivtDaily/sync',
|
||||
method: 'post',
|
||||
data: param
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/structivtDaily',
|
||||
url: 'api/scrapRate',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
export default { add, edit, del, sync }
|
||||
export default { add, edit, del }
|
||||
@@ -9,51 +9,67 @@
|
||||
label-width="80px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="所属库区">
|
||||
<el-cascader
|
||||
placeholder="所属库区"
|
||||
:options="sects"
|
||||
:props="{ checkStrictly: true }"
|
||||
<el-form-item label="车间">
|
||||
<el-select
|
||||
v-model="query.product_area"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="全部"
|
||||
class="filter-item"
|
||||
@change="sectQueryChange"
|
||||
@change="crud.toQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.product_area"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="生产日期">
|
||||
<el-date-picker
|
||||
v-model="query.create_time"
|
||||
type="daterange"
|
||||
value-format="yyyy-MM-dd"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="['00:00:00','23:59:59']"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料编码">
|
||||
<el-form-item label="设备编号">
|
||||
<el-input
|
||||
v-model="query.blurry"
|
||||
v-model="query.device_code"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="物料编码,规格"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属工序">
|
||||
<el-select v-model="query.workprocedure_id" class="filter-item" clearable filterable placeholder="所属工序" size="small" style="width: 280px">
|
||||
<el-option
|
||||
v-for="item in workList"
|
||||
:key="item.workprocedure_id"
|
||||
:label="item.workprocedure_name"
|
||||
:value="item.workprocedure_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<rrOperation />
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission">
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="warning"
|
||||
icon="el-icon-check"
|
||||
size="mini"
|
||||
@click="sync"
|
||||
>
|
||||
同步
|
||||
</el-button>
|
||||
<!-- <el-button-->
|
||||
<!-- slot="right"-->
|
||||
<!-- class="filter-item"-->
|
||||
<!-- type="warning"-->
|
||||
<!-- icon="el-icon-check"-->
|
||||
<!-- size="mini"-->
|
||||
<!-- :disabled="confirm_flag"-->
|
||||
<!-- @click="sync"-->
|
||||
<!-- >-->
|
||||
<!-- 导出-->
|
||||
<!-- </el-button>-->
|
||||
<!-- <el-button-->
|
||||
<!-- slot="right"-->
|
||||
<!-- class="filter-item"-->
|
||||
<!-- type="warning"-->
|
||||
<!-- icon="el-icon-check"-->
|
||||
<!-- size="mini"-->
|
||||
<!-- @click="sync"-->
|
||||
<!-- >-->
|
||||
<!-- 同步-->
|
||||
<!-- </el-button>-->
|
||||
</crudOperation>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
@@ -64,96 +80,68 @@
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<!--
|
||||
<el-table-column type="selection" width="55" />
|
||||
-->
|
||||
<el-table-column prop="stor_name" label="所属仓库" width="120" show-overflow-tooltip />
|
||||
<el-table-column prop="sect_name" label="所属库区" width="120" show-overflow-tooltip />
|
||||
<el-table-column prop="struct_code" label="所属仓位" width="120" />
|
||||
<el-table-column prop="material_code" label="物料编码" width="150" />
|
||||
<el-table-column prop="material_spec" label="物料规格" width="150" />
|
||||
<el-table-column prop="material_id" label="物料id" width="150" />
|
||||
<el-table-column prop="canuse_qty" label="可用总数" width="150" />
|
||||
<el-table-column prop="ivt_qty" label="库存总数" width="150" />
|
||||
<el-table-column prop="frozen_qty" label="冻结总数" width="150" />
|
||||
<el-table-column prop="warehousing_qty" label="待入总数" width="150" />
|
||||
<el-table-column prop="qty_unit_id" label="单位" width="150" :formatter="formatUnit" />
|
||||
<el-table-column prop="create_time" label="统计日期" width="150" fixed="right" align="center" />
|
||||
<el-table-column prop="product_area" width="120" label="所属车间">
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.product_area[scope.row.product_area] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="device_code" label="设备编号" width="120" show-overflow-tooltip />
|
||||
<el-table-column prop="device_name" label="设备名称" width="150" />
|
||||
<el-table-column prop="workprocedure_name" label="工序名称" width="150" show-overflow-tooltip />
|
||||
<el-table-column prop="plan_qty" label="计划生产数量" width="120" />
|
||||
<el-table-column prop="real_qty" label="实际生产数量" width="120" />
|
||||
<el-table-column prop="hours" label="实际生产耗时(h)" width="120" :formatter="crud.formatNum0"/>
|
||||
<el-table-column prop="theory" label="设计产能(ph)" width="120" />
|
||||
<el-table-column prop="realty" label="实际产能(ph)" width="120" />
|
||||
<el-table-column prop="realty" label="产能利用率(%)" width="120" >
|
||||
<template slot-scope="scope" :formatter="crud.formatNum0">
|
||||
<span>{{ Number(scope.row.realty/scope.row.theory).toFixed(3)}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="orders" label="工单列表" width="150" show-overflow-tooltip/>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
<div id="main2" style="width: 100%;height:350px;"></div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import dailyStructivt from '@/views/wms/masterdata_manage/st/dailyStructivt/dailyStructivt'
|
||||
import productCap from '@/views/wms/analysis_manage/productCapacity/productCap'
|
||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import crudSectattr from '@/api/wms/basedata/st/sectattr'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudMdPbMeasureunit from '@/api/wms/basedata/master/mdPbMeasureunit'
|
||||
import { downloadFile } from '@/utils'
|
||||
import crudDevice from '@/api/wms/pdm/device'
|
||||
import echarts from 'echarts'
|
||||
|
||||
const defaultForm = {
|
||||
struct_id: null,
|
||||
cascader: null,
|
||||
struct_code: null,
|
||||
struct_name: null,
|
||||
simple_name: null,
|
||||
sect_id: null,
|
||||
sect_code: null,
|
||||
sect_name: null,
|
||||
stor_id: null,
|
||||
material_code: null,
|
||||
stor_code: null,
|
||||
stor_name: null,
|
||||
stor_type: null,
|
||||
capacity: null,
|
||||
width: null,
|
||||
height: null,
|
||||
zdepth: null,
|
||||
weight: null,
|
||||
xqty: null,
|
||||
yqty: null,
|
||||
zqty: null,
|
||||
is_tempstruct: '0',
|
||||
create_id: null,
|
||||
create_name: null,
|
||||
create_time: null,
|
||||
update_optid: null,
|
||||
update_optname: null,
|
||||
update_time: null,
|
||||
is_delete: null,
|
||||
back_ground_color: null,
|
||||
front_ground_color: null,
|
||||
back_ground_pic: null,
|
||||
font_direction_scode: null,
|
||||
is_used: true,
|
||||
is_zdepth: null,
|
||||
storagevehicle_id: null,
|
||||
storagevehicle_code: null,
|
||||
storagevehicle_type: null,
|
||||
is_emptyvehicle: null,
|
||||
storagevehicle_qty: null,
|
||||
lock_type: null,
|
||||
material_height_type: null,
|
||||
ext_id: null,
|
||||
remark: null
|
||||
product_area: null,
|
||||
device_code: null,
|
||||
device_name: null,
|
||||
workprocedure_name: null,
|
||||
theory: null,
|
||||
real_qty: null,
|
||||
plan_qty: null,
|
||||
realty: null,
|
||||
hours: null,
|
||||
orders: null,
|
||||
}
|
||||
export default {
|
||||
name: 'Structattr',
|
||||
dicts: ['ST_INV_BCP_IN_TYPE'],
|
||||
name: 'WorkGood',
|
||||
dicts: ['product_area'],
|
||||
components: { pagination, crudOperation, rrOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '仓位',
|
||||
title: '废品统计',
|
||||
optShow: { add: false, reset: true },
|
||||
url: 'api/structivtDaily',
|
||||
url: 'api/productCap',
|
||||
idField: 'id',
|
||||
crudMethod: { ...dailyStructivt }
|
||||
crudMethod: { ...productCap }
|
||||
})
|
||||
},
|
||||
data() {
|
||||
@@ -173,6 +161,7 @@ export default {
|
||||
return {
|
||||
measure_unit: [],
|
||||
sects: [],
|
||||
workList: [],
|
||||
downloadLoading: false,
|
||||
permission: {
|
||||
add: ['admin', 'dept:add'],
|
||||
@@ -183,19 +172,57 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
crudSectattr.getSect({}).then(res => {
|
||||
this.sects = res.content
|
||||
})
|
||||
crudMdPbMeasureunit.getSelect().then(res => {
|
||||
this.measure_unit = res.content
|
||||
})
|
||||
this.getWorkprocedure()
|
||||
},
|
||||
methods: {
|
||||
|
||||
sync() {
|
||||
dailyStructivt.sync(Array.of('st_ivt_structivt_bcp', 'st_ivt_structivt_cp', 'st_ivt_structivt_yl')).then(result => {
|
||||
this.crud.notify('同步成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
}).catch(() => { })
|
||||
},
|
||||
getWorkprocedure() { // 获取工序下拉框
|
||||
crudDevice.getWorkprocedure().then(res => {
|
||||
this.workList = res
|
||||
})
|
||||
},
|
||||
[CRUD.HOOK.afterRefresh]() {
|
||||
var pigdata =[]
|
||||
this.crud.data.forEach(a=>{
|
||||
pigdata.push({"value":a.realty,"name":a.device_name})
|
||||
}
|
||||
)
|
||||
var myChart = echarts.init(document.getElementById('main2'));
|
||||
var option = {
|
||||
title: {
|
||||
text: '实际产能饼图',
|
||||
left: 'center'
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'item'
|
||||
},
|
||||
legend: {
|
||||
orient: 'vertical',
|
||||
left: 'left'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '实际产能',
|
||||
type: 'pie',
|
||||
radius: '70%',
|
||||
data: pigdata,
|
||||
emphasis: {
|
||||
itemStyle: {
|
||||
shadowBlur: 10,
|
||||
shadowOffsetX: 0,
|
||||
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
myChart.setOption(option);
|
||||
},
|
||||
downloadMethod() {
|
||||
this.beforeInit()
|
||||
this.downloadLoading = true
|
||||
|
||||
27
mes/qd/src/views/wms/analysis_manage/qlmanage/productCap.js
Normal file
27
mes/qd/src/views/wms/analysis_manage/qlmanage/productCap.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/scrapRate',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/scrapRate',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/scrapRate',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
export default { add, edit, del }
|
||||
259
mes/qd/src/views/wms/analysis_manage/scrapRate/index.vue
Normal file
259
mes/qd/src/views/wms/analysis_manage/scrapRate/index.vue
Normal file
@@ -0,0 +1,259 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="demo-form-inline"
|
||||
label-position="right"
|
||||
label-width="80px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="车间">
|
||||
<el-select
|
||||
v-model="query.product_area"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="全部"
|
||||
class="filter-item"
|
||||
@change="crud.toQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.product_area"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="生产日期">
|
||||
<el-date-picker
|
||||
v-model="query.create_time"
|
||||
type="daterange"
|
||||
value-format="yyyy-MM-dd"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="['00:00:00','23:59:59']"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备编号">
|
||||
<el-input
|
||||
v-model="query.device_code"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="物料编码,规格"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属工序">
|
||||
<el-select v-model="query.workprocedure_id" class="filter-item" clearable filterable placeholder="所属工序" size="small" style="width: 280px">
|
||||
<el-option
|
||||
v-for="item in workList"
|
||||
:key="item.workprocedure_id"
|
||||
:label="item.workprocedure_name"
|
||||
:value="item.workprocedure_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<rrOperation />
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission">
|
||||
<!-- <el-button-->
|
||||
<!-- slot="right"-->
|
||||
<!-- class="filter-item"-->
|
||||
<!-- type="warning"-->
|
||||
<!-- icon="el-icon-check"-->
|
||||
<!-- size="mini"-->
|
||||
<!-- @click="sync"-->
|
||||
<!-- >-->
|
||||
<!-- 同步-->
|
||||
<!-- </el-button>-->
|
||||
</crudOperation>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
:data="crud.data"
|
||||
size="mini"
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<!--
|
||||
<el-table-column type="selection" width="55" />
|
||||
-->
|
||||
<el-table-column prop="product_area" width="150" label="所属车间">
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.product_area[scope.row.product_area] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="device_code" label="设备编号" width="200" show-overflow-tooltip />
|
||||
<el-table-column prop="device_name" label="设备名称" width="200" />
|
||||
<el-table-column prop="workprocedure_name" label="工序名称" width="250" show-overflow-tooltip />
|
||||
<el-table-column prop="real_qty" label="生产总数量" width="200" />
|
||||
<el-table-column prop="nok_qty" label="报废总数量" width="200" />
|
||||
<el-table-column prop="nok_rate" label="废品率" width="200" />
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import workinggood from '@/views/wms/analysis_manage/workingGoods/workinggood'
|
||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import crudSectattr from '@/api/wms/basedata/st/sectattr'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudMdPbMeasureunit from '@/api/wms/basedata/master/mdPbMeasureunit'
|
||||
import { downloadFile } from '@/utils'
|
||||
import crudDevice from '@/api/wms/pdm/device'
|
||||
|
||||
const defaultForm = {
|
||||
struct_id: null,
|
||||
cascader: null,
|
||||
struct_code: null,
|
||||
struct_name: null,
|
||||
simple_name: null,
|
||||
sect_id: null,
|
||||
sect_code: null,
|
||||
sect_name: null,
|
||||
stor_id: null,
|
||||
material_code: null,
|
||||
stor_code: null,
|
||||
stor_name: null,
|
||||
stor_type: null,
|
||||
capacity: null,
|
||||
width: null,
|
||||
height: null,
|
||||
zdepth: null,
|
||||
weight: null,
|
||||
xqty: null,
|
||||
yqty: null,
|
||||
zqty: null,
|
||||
is_tempstruct: '0',
|
||||
create_id: null,
|
||||
create_name: null,
|
||||
create_time: null,
|
||||
update_optid: null,
|
||||
update_optname: null,
|
||||
update_time: null,
|
||||
is_delete: null,
|
||||
back_ground_color: null,
|
||||
front_ground_color: null,
|
||||
back_ground_pic: null,
|
||||
font_direction_scode: null,
|
||||
is_used: true,
|
||||
is_zdepth: null,
|
||||
storagevehicle_id: null,
|
||||
storagevehicle_code: null,
|
||||
storagevehicle_type: null,
|
||||
is_emptyvehicle: null,
|
||||
storagevehicle_qty: null,
|
||||
lock_type: null,
|
||||
material_height_type: null,
|
||||
ext_id: null,
|
||||
remark: null
|
||||
}
|
||||
export default {
|
||||
name: 'WorkGood',
|
||||
dicts: ['product_area'],
|
||||
components: { pagination, crudOperation, rrOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '废品统计',
|
||||
optShow: { add: false, reset: true },
|
||||
url: 'api/scrapRate',
|
||||
idField: 'id',
|
||||
crudMethod: { ...workinggood }
|
||||
})
|
||||
},
|
||||
data() {
|
||||
const numberOne = (rule, value, callback) => {
|
||||
const numReg = /^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/
|
||||
const numRe = new RegExp(numReg)
|
||||
if (value) {
|
||||
if (!numRe.test(value)) {
|
||||
callback(new Error('只能输入数字'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
return {
|
||||
measure_unit: [],
|
||||
sects: [],
|
||||
workList: [],
|
||||
downloadLoading: false,
|
||||
permission: {
|
||||
add: ['admin', 'dept:add'],
|
||||
edit: ['admin', 'dept:edit'],
|
||||
del: ['admin', 'dept:del']
|
||||
},
|
||||
trueorfalse: [{ value: true, label: '是' }, { value: false, label: '否' }]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getWorkprocedure()
|
||||
},
|
||||
methods: {
|
||||
sync() {
|
||||
dailyStructivt.sync(Array.of('st_ivt_structivt_bcp', 'st_ivt_structivt_cp', 'st_ivt_structivt_yl')).then(result => {
|
||||
this.crud.notify('同步成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
}).catch(() => { })
|
||||
},
|
||||
getWorkprocedure() { // 获取工序下拉框
|
||||
crudDevice.getWorkprocedure().then(res => {
|
||||
this.workList = res
|
||||
})
|
||||
},
|
||||
downloadMethod() {
|
||||
this.beforeInit()
|
||||
this.downloadLoading = true
|
||||
download(this.url + '/download', this.params).then(result => {
|
||||
this.downloadFile(result, this.title + '数据', 'xlsx')
|
||||
this.downloadLoading = false
|
||||
}).catch(() => {
|
||||
this.downloadLoading = false
|
||||
})
|
||||
},
|
||||
beforeInit() {
|
||||
return true
|
||||
},
|
||||
sectChange(val) {
|
||||
this.form.sect_id = val[1]
|
||||
},
|
||||
formatUnit(row, column) {
|
||||
const values = this.measure_unit.filter(v => {
|
||||
return v.value === row.qty_unit_id
|
||||
})
|
||||
return values[0].label
|
||||
},
|
||||
sectQueryChange(val) {
|
||||
if (val.length === 1) {
|
||||
this.query.stor_id = val[0]
|
||||
this.query.sect_id = ''
|
||||
}
|
||||
if (val.length === 0) {
|
||||
this.query.sect_id = ''
|
||||
this.query.stor_id = ''
|
||||
}
|
||||
if (val.length === 2) {
|
||||
this.query.stor_id = val[0]
|
||||
this.query.sect_id = val[1]
|
||||
}
|
||||
this.crud.toQuery()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
27
mes/qd/src/views/wms/analysis_manage/scrapRate/scrapRate.js
Normal file
27
mes/qd/src/views/wms/analysis_manage/scrapRate/scrapRate.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/scrapRate',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/scrapRate',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/scrapRate',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
export default { add, edit, del }
|
||||
Reference in New Issue
Block a user