jevononlie 5 months ago
commit c1ea0cd687

@ -0,0 +1,24 @@
package com.chanko.yunxi.mes.module.biz.enums;
import lombok.Getter;
/**
*
* @author chenxi
* @date 2024-02-26 11:25
*/
@Getter
public enum UnqualifiedNotificationAuditOpinionEnum {
REPAIR(1, "返修"),
CONCESSION(2, "让步接收"),
SCRAP(3, "报废");
private int code;
private String description;
UnqualifiedNotificationAuditOpinionEnum(int code, String description) {
this.code = code;
this.description = description;
}
}

@ -3,7 +3,7 @@ package com.chanko.yunxi.mes.module.biz.enums;
import lombok.Getter;
/**
*
*
* @author chenxi
* @date 2024-02-26 11:25
*/

@ -158,4 +158,10 @@ public class ProjectOrderSubDO extends BaseDO {
@TableField(exist = false)
private String productionDate;
@TableField(exist = false)
private Integer qualifiedQuantity;
@TableField(exist = false)
private Integer unqualifiedQuantity;
}

@ -31,7 +31,7 @@ public interface ScEquipmentMapper extends BaseMapperX<ScEquipmentDO> {
.betweenIfPresent(ScEquipmentDO::getShutdownTime, reqVO.getShutdownTime())
.eqIfPresent(ScEquipmentDO::getNum, reqVO.getNum())
.eqIfPresent(ScEquipmentDO::getStatuss, reqVO.getStatuss())
.orderByDesc(ScEquipmentDO::getId));
.orderByAsc(ScEquipmentDO::getId));
}
@Select("CALL Down_Time(#{id}, #{startTime}, #{endTime})")

@ -15,6 +15,7 @@ import com.chanko.yunxi.mes.module.biz.dal.dataobject.plansub.PlanSubDO;
import com.chanko.yunxi.mes.module.biz.dal.dataobject.processdesign.ProcessDesignDO;
import com.chanko.yunxi.mes.module.biz.dal.dataobject.projectorder.ProjectOrderDO;
import com.chanko.yunxi.mes.module.biz.dal.dataobject.projectorder.ProjectOrderSubDO;
import com.chanko.yunxi.mes.module.biz.dal.dataobject.scequipment.ScEquipmentDO;
import com.chanko.yunxi.mes.module.biz.dal.dataobject.screen.ScreenDO;
import com.chanko.yunxi.mes.module.biz.dal.dataobject.taskdispatch.TaskDispatchDO;
import com.chanko.yunxi.mes.module.biz.dal.dataobject.taskdispatch.TaskDispatchDetailDO;
@ -24,6 +25,7 @@ import com.chanko.yunxi.mes.module.biz.dal.mysql.plansub.PlanSubMapper;
import com.chanko.yunxi.mes.module.biz.dal.mysql.processdesign.ProcessDesignMapper;
import com.chanko.yunxi.mes.module.biz.dal.mysql.projectorder.ProjectOrderMapper;
import com.chanko.yunxi.mes.module.biz.dal.mysql.projectorder.ProjectOrderSubMapper;
import com.chanko.yunxi.mes.module.biz.dal.mysql.scequipment.ScEquipmentMapper;
import com.chanko.yunxi.mes.module.biz.dal.mysql.screen.ScreenMapper;
import com.chanko.yunxi.mes.module.biz.dal.mysql.taskdispatch.TaskDispatchDetailMapper;
import com.chanko.yunxi.mes.module.biz.dal.mysql.taskdispatch.TaskDispatchMapper;
@ -47,6 +49,7 @@ import java.util.stream.Collectors;
import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.chanko.yunxi.mes.module.biz.enums.ErrorCodeConstants.SCREEN_NOT_EXISTS;
import static com.chanko.yunxi.mes.module.biz.enums.ScreenTypeEnum.ProductionOrderState;
import static com.chanko.yunxi.mes.module.biz.enums.ScreenTypeEnum.QualifiedRateOfEachProduct;
/**
* Service
@ -79,6 +82,8 @@ public class ScreenServiceImpl implements ScreenService {
private ProcessDesignMapper processDesignMapper;
@Resource
private PlanSubMapper planSubMapper;
@Resource
private ScEquipmentMapper scEquipmentMapper;
@Override
public Long createScreen(ScreenSaveReqVO createReqVO) {
@ -170,16 +175,24 @@ public class ScreenServiceImpl implements ScreenService {
}
ScreenDO productionOrderState = todayDataList.stream().filter(screenDO -> ProductionOrderState.name().equals(screenDO.getType())).findFirst().get();
ScreenDO qualifiedRateOfEachProduct = todayDataList.stream().filter(screenDO -> QualifiedRateOfEachProduct.name().equals(screenDO.getType())).findFirst().get();
// 设置今天数据
todayDataList.forEach(screenDO -> {
switch (ScreenTypeEnum.valueOf(screenDO.getType())){
case ProductionStateList:
// 同时设置 生产订单状态
buildProductionStateList(screenDO, productionOrderState);
// 同时设置 各产品合格率
buildProductionStateList(screenDO, productionOrderState, qualifiedRateOfEachProduct);
break;
case QuantityOfEachProductProduced:
buildQuantityOfEachProductProduced(screenDO);
break;
case UtilizationRateOfEquipment:
buildUtilizationRateOfEquipment(screenDO);
break;
case EquipmentOperationState:
buildEquipmentOperationState(screenDO);
break;
}
});
@ -193,6 +206,85 @@ public class ScreenServiceImpl implements ScreenService {
return todayDataList;
}
/**
*
*
* "2D": ["equipmentNo","qualifiedQuantity","qualifiedRate","overallEquipmentEffectiveness","shutdownTimes","operationState"]
* [["1#",22,33.33,44,0,"NORMAL"],["2#","门扇",44,55.55,66,2,"MALFUNCTION"],["3#","横头",66,77.77,77,4,"SHUTDOWN"]]
*
* @param screenDO
*/
private void buildEquipmentOperationState(ScreenDO screenDO) {
LinkedList<LinkedList> resultData = new LinkedList<>();
List<ScEquipmentDO> scEquipmentDOList = scEquipmentMapper.selectList(new LambdaQueryWrapper<ScEquipmentDO>(){{
orderByAsc(ScEquipmentDO::getId);
}});
for (ScEquipmentDO scEquipmentDO : scEquipmentDOList) {
resultData.add(new LinkedList(){{
add(scEquipmentDO.getNmae());
add(scEquipmentDO.getNum());
add(scEquipmentDO.getQualificationRate().multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_CEILING));
add(scEquipmentDO.getOee());
add(scEquipmentDO.getShutdownTime());
add(scEquipmentDO.getUtilizationRate().multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_CEILING));
}});
}
screenDO.setData(JSON.toJSONString(resultData));
}
/**
*
*
* "1D": ["product","qualifiedRate"]
* [["门套","门扇"],[95,98]]
*
* @param screenDO
* @param doList
*/
private void buildQualifiedRateOfEachProduct(ScreenDO screenDO, List<ProjectOrderSubDO> doList) {
LinkedList<LinkedList> resultData = new LinkedList<>();
LinkedList<String> productList = new LinkedList<>();
LinkedList<BigDecimal> rateList = new LinkedList<>();
resultData.add(productList);
resultData.add(rateList);
for (ProjectOrderSubDO subDO : doList) {
productList.add(subDO.getProjectSubName());
rateList.add(new BigDecimal(100)
.subtract(new BigDecimal(subDO.getUnqualifiedQuantity()*100).divide(new BigDecimal(subDO.getAmount())))
.setScale(2, BigDecimal.ROUND_CEILING));
}
screenDO.setData(JSON.toJSONString(resultData));
}
/**
*
* "1D": ["equipmentNo","utilizationRate"]
* [["1#","2#","3#"],[45,35,60]]
*
* @param screenDO
*/
private void buildUtilizationRateOfEquipment(ScreenDO screenDO) {
LinkedList<LinkedList> resultData = new LinkedList<>();
LinkedList<String> equipmentNo = new LinkedList<>();
LinkedList<BigDecimal> utilizationRate = new LinkedList<>();
resultData.add(equipmentNo);
resultData.add(utilizationRate);
List<ScEquipmentDO> scEquipmentDOList = scEquipmentMapper.selectList(new LambdaQueryWrapper<ScEquipmentDO>(){{
orderByAsc(ScEquipmentDO::getId);
}});
for (ScEquipmentDO scEquipmentDO : scEquipmentDOList) {
equipmentNo.add(scEquipmentDO.getNmae());
utilizationRate.add(scEquipmentDO.getUtilizationRate());
}
screenDO.setData(JSON.toJSONString(resultData));
}
/**
*
* "1D": ["product","sixDaysAgo","fiveDaysAgo","fourDaysAgo","threeDaysAgo","twoDaysAgo","oneDayAgo","today"]
@ -274,18 +366,18 @@ public class ScreenServiceImpl implements ScreenService {
*
* @param screenDO
* @param productionOrderState
* @param qualifiedRateOfEachProduct
*/
private void buildProductionStateList(ScreenDO screenDO, ScreenDO productionOrderState) {
private void buildProductionStateList(ScreenDO screenDO, ScreenDO productionOrderState, ScreenDO qualifiedRateOfEachProduct) {
ArrayList<LinkedList> resultData = new ArrayList<>(16);
MPJLambdaWrapper<TaskDispatchDO> query = new MPJLambdaWrapper<>();
query.selectAll(TaskDispatchDO.class)
MPJLambdaWrapper<ProjectOrderSubDO> query = new MPJLambdaWrapper<>();
query.selectAll(ProjectOrderSubDO.class)
.select("c.code as projectCode", "DateDiff(c.project_end_time,CURRENT_DATE) as restDays")
.select("d.name as projectSubName", "d.code as projectSubCode")
.select("b.amount", "d.unit")
.select("d.name as projectSubName", "d.code as projectSubCode", "d.unit")
.select("COALESCE(sum(e.amount),0) as qualifiedQuantity")
.select("COALESCE(sum(f.amount),0) as unqualifiedQuantity")
.leftJoin(PlanDO.class, "a", PlanDO::getId, TaskDispatchDO::getPlanId)
.leftJoin(ProjectOrderSubDO.class, "b", ProjectOrderSubDO::getId, TaskDispatchDO::getProjectSubId)
.leftJoin(TaskDispatchDO.class, "b", TaskDispatchDO::getProjectSubId, ProjectOrderSubDO::getId)
.leftJoin(ProjectOrderDO.class, "c", ProjectOrderDO::getId, ProcessDesignDO::getProjectId)
.leftJoin(MaterialDO.class, "d", MaterialDO::getId, ProjectOrderSubDO::getMaterialId)
.leftJoin(TaskReportDO.class, "e", Wrapper -> Wrapper.eq(TaskReportDO::getDispatchId, TaskDispatchDO::getId)
@ -293,34 +385,36 @@ public class ScreenServiceImpl implements ScreenService {
.eq(TaskReportDO::getHasReport, YesOrNoEnum.Y.getCode())
)
.leftJoin(UnqualifiedNotificationDO.class, "f", Wrapper -> Wrapper.eq(UnqualifiedNotificationDO::getProjectSubId, TaskDispatchDO::getProjectSubId)
.eq(UnqualifiedNotificationDO::getNotificationStatus, UnqualifiedNotificationStatusEnum.AUDIT.getCode()))
.eq(UnqualifiedNotificationDO::getNotificationStatus, UnqualifiedNotificationStatusEnum.AUDIT.getCode())
.eq(UnqualifiedNotificationDO::getAuditOpinion, UnqualifiedNotificationAuditOpinionEnum.SCRAP.getCode())
)
.notIn(PlanDO::getStatus, Arrays.asList(ProjectPlanStatusEnum.COMPLETE.getCode(), ProjectPlanStatusEnum.TERMINATE.getCode()))
.orderByDesc(TaskDispatchDO::getId)
.groupBy(TaskDispatchDO::getId)
.orderByDesc(ProjectOrderSubDO::getId)
.groupBy(ProjectOrderSubDO::getId)
.disableSubLogicDel();
BigDecimal sumProductionProgress = new BigDecimal(0);
List<TaskDispatchDO> taskDispatchDOList = taskDispatchMapper.selectList(query);
taskDispatchDOList.forEach(taskDispatchDO -> {
BigDecimal productionProgress = new BigDecimal(taskDispatchDO.getQualifiedQuantity() * 100).divide(new BigDecimal(taskDispatchDO.getAmount()), 2, BigDecimal.ROUND_CEILING);
List<ProjectOrderSubDO> doList = projectOrderSubMapper.selectList(query);
for (ProjectOrderSubDO aDo : doList) {
BigDecimal productionProgress = new BigDecimal(aDo.getQualifiedQuantity() * 100).divide(new BigDecimal(aDo.getAmount()), 2, BigDecimal.ROUND_CEILING);
resultData.add(new LinkedList<Object>(){{
add(taskDispatchDO.getProjectSubCode());
add(taskDispatchDO.getProjectSubName());
add(taskDispatchDO.getAmount());
add(taskDispatchDO.getQualifiedQuantity());
add(taskDispatchDO.getRestDays());
add(aDo.getProjectSubCode());
add(aDo.getProjectSubName());
add(aDo.getAmount());
add(aDo.getQualifiedQuantity());
add(aDo.getRestDays());
add(productionProgress);
}});
sumProductionProgress.add(sumProductionProgress);
});
}
screenDO.setData(JSON.toJSONString(resultData));
BigDecimal completionRate = sumProductionProgress.divide(new BigDecimal(taskDispatchDOList.size()), 2, BigDecimal.ROUND_CEILING);
BigDecimal completionRate = sumProductionProgress.divide(new BigDecimal(doList.size()), 2, BigDecimal.ROUND_CEILING);
BigDecimal deliveryRate = null;
buildProductionOrderState(productionOrderState, completionRate, deliveryRate);
buildQualifiedRateOfEachProduct(qualifiedRateOfEachProduct, doList);
}

@ -121,7 +121,7 @@ const getEwms = async () => {
// DOM
const qrCodeElement = document.getElementById('qrCodeContainer')
if (qrCodeElement) {
qrCodeElement.innerHTML = `<img src="${qrCodeData}" alt="Download APK QR Code">`
qrCodeElement.innerHTML = `<img src="${qrCodeData}" style="width: 100%; height: 100%;" alt="Download APK QR Code">`
}
}
})

@ -0,0 +1,137 @@
<template>
<!-- 故障分析 设备 选择 -->
<el-select
v-model="valueName"
v-if="status1 == false"
placeholder="请输入设备"
:remote-method="remoteMethod"
remote-show-suffix
remote
clearable
reserve-keyword
filterable
:loading="Loading"
@change="onSelectChange"
@visible-change="onVisibleChange"
>
<el-option
v-for="item in procedureSelectList"
:key="item.id"
:label="item.nmae"
:value="item.id"
/>
</el-select>
</template>
<script lang="ts" setup>
import { ref, onMounted, toRefs } from 'vue'
import * as ScequipmentApi from '@/api/biz/scequipment'
//
const props = defineProps({
modelValue: {
type: [Number, String],
required: true // true
}
})
const queryParams = {
pageNo: 1,
pageSize: 10,
id: undefined,
nmae: undefined,
oee: undefined,
utilizationRate: undefined,
qualificationRate: undefined,
shutdownTime: undefined,
num: undefined,
statuss: undefined
}
const valueName: any = ref() //
const valueNameObject: any = ref() //
const emit = defineEmits(['update:newValue'])
const procedureList = ref<ScequipmentApi.ScEquipmentVO[]>([]) //
const procedureSelectList = ref<ScequipmentApi.ScEquipmentVO[]>([])
const loading = ref(false)
const SelectLoading = ref(false)
const propsmodelValue = toRefs(props).modelValue // props modelValue
const initialValue: any = ref(null) // ID
const status1 = ref(false)
const getlist = async () => {
const data = await ScequipmentApi.getScEquipmentPage(queryParams)
procedureList.value = []
procedureSelectList.value = []
procedureList.value = [...procedureList.value, ...data.list]
//
if (propsmodelValue.value) {
valueName.value = Number(propsmodelValue.value)
const initialUser = await ScequipmentApi.getScEquipment(valueName.value)
// procedureList
let foundInitialUserInList = false
for (const eqyip of procedureList.value) {
if (eqyip.id === initialUser.id) {
foundInitialUserInList = true
break
}
}
//
if (!foundInitialUserInList) {
procedureList.value.unshift(initialUser)
}
// loading.value = false
}
procedureSelectList.value = procedureList.value
loading.value = false
}
const remoteMethod = async (query: any) => {
loading.value = true
procedureSelectList.value = []
try {
if (query) {
queryParams.nmae = query
const data = await ScequipmentApi.getScEquipmentPage(queryParams)
procedureList.value = data.list
procedureSelectList.value = data.list
} else {
getlist()
}
} catch (error) {
console.error(error)
} finally {
loading.value = false
}
}
//
onMounted(async () => {
try {
await getlist()
} catch (error) {
console.error(error)
}
})
watch(valueName, (newValue: any) => {
if (newValue) {
onSelectChange(newValue)
procedureList.value = []
getlist()
}
})
const onVisibleChange = (isVisible: boolean) => {
if (!isVisible) {
//
queryParams.nmae = undefined
procedureList.value = []
procedureSelectList.value = []
} else {
getlist()
}
}
const onSelectChange = (newValue: any) => {
valueNameObject.value = procedureList.value.find((eqyip) => eqyip.id === newValue) //
emit('update:newValue', valueNameObject.value)
}
</script>

@ -97,7 +97,7 @@
<el-col :span="24" style="padding: 0px 10px; margin-top: 30px;">
<el-table :data="list" ref="scrollableTable" :style="{width: '100%',height:isFullscreen?'590px':'620px'}" :row-class-name="tableRowClassName">
<el-table-column type="index" label="序号" align="center" width="80" />
<!-- <el-table-column prop="date" label="保修时间" align="center" min-width="150" /> -->
<el-table-column prop="submitTime" label="上报日期" :formatter="dateFormatter2" align="center" min-width="150" />
<el-table-column prop="code" label="卡片编码" align="center" min-width="150" />
<el-table-column label="卡片名称" align="center" prop="name" min-width="120">
<template #default="scope">
@ -105,6 +105,8 @@
</template>
</el-table-column>
<!-- <el-table-column prop="line" align="center" label="产线" min-width="120" /> -->
<el-table-column prop="equipName" align="center" label="设备名称" min-width="150" />
<el-table-column prop="workshopName" align="center" label="所属车间" min-width="150" />
<el-table-column prop="ownerName" align="center" label="维修人" min-width="150" />
<el-table-column prop="description" align="center" label="故障描述" min-width="200" />
<el-table-column fixed="right" label="维保进度" align="center" prop="progress" min-width="120">
@ -126,6 +128,7 @@ import * as echarts from 'echarts'
import { ref, onMounted, onUnmounted } from 'vue'
import * as EquipMaintenanceRecordApi from '@/api/biz/equipmaintenancerecord'
import { getStrDictOptions, DICT_TYPE, getDictLabel, getIntDictOptions } from '@/utils/dict'
import { dateFormatter, dateFormatter2, formatDate } from '@/utils/formatTime'
//
var now = new Date()
@ -382,7 +385,6 @@ const tableRowClassName = ({ rowIndex }) => {
#spectacularsbox {
width: 100%;
height: 780px;
// background-color: aqua;
background: url('@/assets/imgs/BG.png') no-repeat center;
}
::v-deep .el-table,
@ -401,7 +403,6 @@ const tableRowClassName = ({ rowIndex }) => {
--el-table-header-text-color: rgb(54, 143, 165);
--el-table-text-color: #fff;
}
.chart-container {
border-radius: 10px;
position: relative;

File diff suppressed because one or more lines are too long

@ -43,7 +43,7 @@
<el-button link type="danger" @click="handleDelete(scope.row.id)" v-hasPermi="['infra:config:delete']">
删除
</el-button>
<el-button link type="primary" @click="downloadAttachment(scope.row.businessId,scope.row.url)">
<el-button link type="primary" @click="downloadAttachment(scope.row.name,scope.row.url)">
下载
</el-button>
</template>
@ -134,6 +134,7 @@ const handleDelete = async (id: number) => {
//
const downloadAttachment = async (name,url) => {
console.log(url);
const data = await FileApi.downloadFile(url)
download.any(data, name)
}

Loading…
Cancel
Save