feat: 更新装配任务和质量报表

This commit is contained in:
meswork764
2026-06-18 17:48:36 +08:00
parent 1a781b02c2
commit ab508369c9
54 changed files with 10788 additions and 102 deletions

View File

@@ -307,9 +307,7 @@ export default {
.replace(/'/g, ''')
},
isOutsourceProcess(process) {
return process.指派对象 === '外协' ||
String(process.工序名称 || '').includes('(外协)') ||
String(process.工序名称 || '').includes('(外协)')
return process.指派对象 === '外协'
},
getProcessStatusNum(status) {
const statusNum = parseInt(status)
@@ -333,8 +331,10 @@ export default {
return statusNum === 6 || statusNum === 3 || countNum > 0
},
isGreenProcess(process) {
console.log(process)
console.log( this.toProcessNumber(process.收料数量), this.toProcessNumber(process.完成数量),this.isOutsourceProcess(process))
return this.isOutsourceProcess(process) &&
this.toProcessNumber(process.收料数量) > this.toProcessNumber(process.收检合格数) + this.toProcessNumber(process.收检不合格数)
this.toProcessNumber(process.收料数量) > this.toProcessNumber(process.完成数量) + this.toProcessNumber(process.收检不合格数)
},
getProcessBaseClass(process) {
if (this.isGreenProcess(process)) {
@@ -375,7 +375,6 @@ export default {
return lineNo === lastLineNo + 1 &&
String(process.外协分组 || '') === String(lastProcess.外协分组 || '')
}
processes.forEach((process, index) => {
if (!this.isOutsourceProcess(process)) {
flushOutsourceRun()
@@ -388,8 +387,9 @@ export default {
lastProcess = process
})
flushOutsourceRun()
console.log(classes)
return classes
},
getProcessClass(process, index, outsourceGroupClasses) {
if (this.isOutsourceProcess(process)) {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -132,7 +132,7 @@
</el-tag>
</template>
</el-table-column>
<el-table-column prop="Progress" label="进度" align="center" width="150">
<!-- <el-table-column prop="Progress" label="进度" align="center" width="150">
<template slot-scope="scope">
<el-progress
:percentage="scope.row.Progress || 0"
@@ -152,7 +152,7 @@
<span>{{ scope.row.Battery }}%</span>
</div>
</template>
</el-table-column>
</el-table-column> -->
<el-table-column prop="Operator" label="操作人" align="center" width="100"/>
<el-table-column prop="UpdateTime" label="更新时间" align="center" width="160"/>
<el-table-column label="操作" align="center" width="200" fixed="right">
@@ -172,14 +172,14 @@
style="color: #E6A23C;"
@click="pauseTask(scope.row)"
:disabled="scope.row.TaskStatus !== 'RUNNING'"
>暂停</el-button>
>暂停</el-button> -->
<el-button
type="text"
icon="el-icon-circle-close"
size="mini"
style="color: #F56C6C;"
@click="cancelTask(scope.row)"
>取消</el-button> -->
>取消</el-button>
</template>
</el-table-column>
</el-table>
@@ -373,6 +373,10 @@
</template>
<script>
import axios from 'axios'
const AGV_MOVE_API = 'http://192.168.2.92:9981/api/zk/call_agv_move_web'
export default {
data() {
return {
@@ -436,7 +440,7 @@ export default {
created() {
this.getLocationPoints()
this.getRealtimeData()
this.startAutoRefresh()
//this.startAutoRefresh()
},
beforeDestroy() {
@@ -513,7 +517,7 @@ export default {
var Data = this.CreateData('12', '生产管理_物料机器人_修改点位', param)
this.ExecDatabase(Data).then(response => {
if (response.data && response.data[0] && response.data[0].result === '1') {
if (response.data && response.data[0] && response.data[0].result === 1) {
this.$message.success('修改点位成功')
this.pointFormVisible = false
this.getLocationPoints()
@@ -536,13 +540,13 @@ export default {
param[5] = ['Y坐标', this.pointForm.YCoordinate]
param[6] = ['描述', this.pointForm.Description || '']
var Data = this.CreateData('12', '生产管理_物料机器人_新增点位', param)
var Data = this.CreateData('11', '生产管理_物料机器人_新增点位', param)
this.ExecDatabase(Data).then(response => {
if (response.data && response.data[0] && response.data[0].result === '1') {
if (response.data && response.data[0] && response.data[0].Result === 1) {
this.$message.success('新增点位成功')
this.pointFormVisible = false
this.getLocationPoints()
} else if (response.data[0].result === '编码重复') {s
} else if (response.data[0].Result === '编码重复') {
this.$message.error('点位编码已存在')
} else {
this.$message.error('新增点位失败')
@@ -564,12 +568,12 @@ export default {
var param = []
param[0] = ['ID', row.ID]
var Data = this.CreateData('12', '生产管理_物料机器人_删除点位', param)
var Data = this.CreateData('11', '生产管理_物料机器人_删除点位', param)
this.ExecDatabase(Data).then(response => {
if (response.data && response.data[0] && response.data[0].result === '1') {
if (response.data && response.data[0] && response.data[0].Result === 1) {
this.$message.success('删除点位成功')
this.getLocationPoints()
} else if (response.data[0].result === '点位使用中') {
} else if (response.data[0].Result === '点位使用中') {
this.$message.error('该点位正在被任务使用,无法删除')
} else {
this.$message.error('删除点位失败')
@@ -712,30 +716,73 @@ export default {
this.$confirm('确认开始该任务?', '提示', {
type: 'info'
}).then(() => {
var param = []
param[0] = ['任务编号', row.TaskNo]
param[1] = ['状态', 'RUNNING']
param[2] = ['进度', row.Progress || 0]
param[3] = ['速度', 0.5]
param[4] = ['电量', 100]
param[5] = ['X坐标', null]
param[6] = ['Y坐标', null]
param[7] = ['方向', '']
var Data = this.CreateData('12', '生产管理_物料机器人_更新任务状态', param)
this.ExecDatabase(Data).then(response => {
if (response.data && response.data[0] && response.data[0].result === '1') {
this.$message.success('任务已开始')
this.getRealtimeData()
} else {
this.$message.error('操作失败')
}
this.callAgvMove(row).then(() => {
return this.updateTaskStatus(row)
}).then(() => {
this.$message.success('任务已开始')
this.getRealtimeData()
}).catch(error => {
console.error('开始任务失败:', error)
this.$message.error('操作失败')
this.$message.error(error.message || '操作失败')
})
}).catch(() => {})
},
// 调用 AGV 搬运接口
callAgvMove(row) {
const fromBin = row.CurrentPoint || row.StartPoint
const toBin = row.TargetPoint || row.EndPoint
if (!row.TaskNo || !fromBin || !toBin) {
return Promise.reject(new Error('任务点位信息不完整无法下发AGV任务'))
}
const data = {
entityName: 'ContainerTransportOrder',
entityValues: [
{
id: row.TaskNo,
kind: 'Luck',
status: 'Building',
priority: 10,
fromBin,
toBin
}
]
}
return axios.post(AGV_MOVE_API, data).then(response => {
const result = response.data || {}
console.log(response)
const isSuccess = Array.isArray(result.ids) && result.ids.indexOf(row.TaskNo) !== -1 && !result.code
if (!isSuccess) {
const message = result.message || result.code || 'AGV任务下发失败'
return Promise.reject(new Error(message))
}
return result
})
},
// 更新 MES 任务状态
updateTaskStatus(row) {
var param = []
param[0] = ['任务编号', row.TaskNo]
param[1] = ['状态', 'RUNNING']
param[2] = ['进度', row.Progress || 0]
param[3] = ['速度', 0.5]
param[4] = ['电量', 100]
param[5] = ['X坐标', null]
param[6] = ['Y坐标', null]
param[7] = ['方向', '']
var Data = this.CreateData('12', '生产管理_物料机器人_更新任务状态', param)
return this.ExecDatabase(Data).then(response => {
if (response.data && response.data[0] && response.data[0].result === '1') {
return response
}
return Promise.reject(new Error('任务状态更新失败'))
})
},
// 暂停任务
// pauseTask(row) {
@@ -767,29 +814,29 @@ export default {
// }).catch(() => {})
// },
// 取消任务
// cancelTask(row) {
// this.$confirm('确认取消该任务?', '提示', {
// type: 'warning'
// }).then(() => {
// var param = []
// param[0] = ['任务编号', row.TaskNo]
// param[1] = ['状态', 'CANCELED']
//取消任务
cancelTask(row) {
this.$confirm('确认取消该任务?', '提示', {
type: 'warning'
}).then(() => {
var param = []
param[0] = ['任务编号', row.TaskNo]
param[1] = ['状态', 'CANCELED']
// var Data = this.CreateData('12', '生产管理_物料机器人_完成任务', param)
// this.ExecDatabase(Data).then(response => {
// if (response.data && response.data[0] && response.data[0].result === '1') {
// this.$message.success('任务已取消')
// this.getRealtimeData()
// } else {
// this.$message.error('操作失败')
// }
// }).catch(error => {
// console.error('取消任务失败:', error)
// this.$message.error('操作失败')
// })
// }).catch(() => {})
// },
var Data = this.CreateData('12', '生产管理_物料机器人_完成任务', param)
this.ExecDatabase(Data).then(response => {
if (response.data && response.data[0] && response.data[0].result === '1') {
this.$message.success('任务已取消')
this.getRealtimeData()
} else {
this.$message.error('操作失败')
}
}).catch(error => {
console.error('取消任务失败:', error)
this.$message.error('操作失败')
})
}).catch(() => {})
},
// ========== 历史记录相关方法 ==========
@@ -1007,4 +1054,4 @@ export default {
}
}
}
</style>
</style>

View File

@@ -43,6 +43,13 @@
clearable
style="width: 150px; margin-right: 10px"
/>
<span class="show-text">物料名称:</span>
<el-input
v-model="productname2"
placeholder="请输入零件名称"
clearable
style="width: 150px; margin-right: 10px"
/>
<!-- <span class="show-text">计划开工:</span>
<el-date-picker
v-model="completionTime"
@@ -1833,6 +1840,7 @@ export default {
salenum:'',
contractNo: "",
productCode2: "",
productname2: "",
process: "",
processList2: [],
nature: "",
@@ -2711,6 +2719,7 @@ getUserId() {
param.push(["TaskAID", this.TaskAID || 0]);
param.push(["订单号", this.orderNo2 || 0]);
param.push(["零件编号", this.productCode2]);
param.push(["零件名称", this.productname2]);
param.push(["计划开工_Start", ""]);
param.push(["计划开工_End", ""]);
param.push(["生产状态", this.productionStatus2 || -1]);

View File

@@ -731,6 +731,40 @@ async uploadToSAP(record, detail) {
// ========== 9. 提交工时单据到SAP ==========
if (params.length > 0) {
try {
await new Promise(resolve => setTimeout(resolve, 500))
const reorderResult = await getB1("/ProductionOrders", {
"$filter": `AbsoluteEntry eq ${record.订单编号}`
})
if (!reorderResult.success || !reorderResult.data?.value?.length) {
return { success: false, error: '重新获取生产订单失败' }
}
const updatedOrder = reorderResult.data.value[0]
const lines = updatedOrder.ProductionOrderLines || []
lines.forEach(line => {
const matched = params.find(param => Number(line.LineNumber) === Number(param.BaseLine))
if (matched) {
line.PlannedQuantity = Number(line.IssuedQuantity) + Number(matched.Quantity)
}
})
const patchResult = await patchB1(`ProductionOrders(${updatedOrder.AbsoluteEntry})`, {
ProductionOrderLines: lines,
ProductionOrdersStages: updatedOrder.ProductionOrdersStages || []
})
if (!patchResult.success) {
this.$message.error(patchResult.message)
return { success: false, error: patchResult.message || '更新生产订单PlannedQuantity失败' }
}
} catch (reorderError) {
console.warn(`重新获取订单数据失败:`, reorderError)
return { success: false, error: reorderError.message || '更新生产订单PlannedQuantity异常' }
}
try {
const startDate = record.开始时间 ? record.开始时间.split(' ')[0] : this.currentdate
const result = await postB1("/InventoryGenExits", {

View File

@@ -215,7 +215,7 @@
</el-input>
</el-form-item>
<el-form-item label="班次标准工时">
<el-input v-model="editForm.班次标准工时" readonly />
<el-input v-model="editForm.当日班次最小标准工时" />
</el-form-item>
<!-- <el-form-item label="工序顺序">
<el-input v-model="editForm.工艺顺序" readonly />
@@ -682,7 +682,7 @@ export default {
加工工时: row.加工工时 || 0,
总时长: row.总时长 || 0,
工艺顺序: row.订单行号 || 0,
当日班次最小标准工时 : row.当日班次最小标准工时 || 0
当日班次最小标准工时 : row.当日班次最小标准工时 || 8
}
this.editDialogVisible = true
},

View File

@@ -285,7 +285,7 @@
width="180"
prop="检测说明"
/>
<el-table-column label="操作" align="center" width="250" fixed="right">
<el-table-column label="操作" align="center" width="350" fixed="right">
<template slot-scope="scope">
<el-button
class="operation-btn"
@@ -299,9 +299,15 @@
type="primary"
size="mini"
@click="getitemdraw(scope.row)"
>图纸</el-button
>零件图纸</el-button
>
<el-button
class="operation-btn"
type="primary"
size="mini"
@click="getitemdraw2(scope.row)"
>工艺图纸</el-button
>
</template>
</el-table-column>
@@ -598,31 +604,23 @@ export default {
this.$message.error('未上传图纸');
}
})
// this.ExecDatabase(Data).then(async (response) => {
// console.log(response);
// if (response.data.length > 0) {
// var pdfSrc = "" + this.downPDF + "" + response.data[0].uid + ".pdf";
// // 1. 先打开对话框
// this.seeVisible = true;
// // 2. 等待对话框完全渲染(使用 $nextTick 确保 DOM 已更新)
// await this.$nextTick();
// // 3. 等待一小段时间确保对话框内的容器完全渲染
// setTimeout(async () => {
// try {
// await seepdf(pdfSrc, 'see');
// } catch (error) {
// console.error('PDF 渲染失败:', error);
// this.$message.error('PDF 渲染失败: ' + error.message);
// }
// }, 300); // 增加延迟确保 DOM 完全渲染
// } else {
// this.$message.error('未上传图纸');
// }
// });
},
getitemdraw2(row) {
var param = [];
param[0] = ['物料编号', row.零件编码];
var Data = this.CreateData('11', '工艺管理_工艺维护_查看图纸', param);
this.ExecDatabase(Data).then(response => {
console.log(response)
if (response.data.length > 0) {
var pdfSrc =""+this.downPDF+""+ response.data[0].uid+".pdf"
window.open(pdfSrc,'_blank')
}else {
this.$message.error('未上传图纸');
}
})
},
Urgent(row){
var param = []

View File

@@ -965,6 +965,7 @@ export default {
return;
}
// 调用存储过程保存数据
this.receiveCheckVisible = false;
this.saveReceiveCheck();
});
},

View File

@@ -0,0 +1,132 @@
<template>
<div class="test-assembly-task">
<el-card>
<div class="search-container">
<span class="show-text">任务类型:</span>
<el-select
v-model="taskType"
placeholder="请选择任务类型"
style="width: 150px; margin-right: 10px"
@change="searchTable"
>
<el-option label="全部" value="全部" />
<el-option label="阀类" value="阀类" />
<el-option label="系统类" value="系统类" />
</el-select>
<span class="show-text">生产订单:</span>
<el-input
v-model="productionOrder"
placeholder="请输入生产订单"
clearable
style="width: 150px; margin-right: 10px"
@keyup.enter.native="searchTable"
/>
<span class="show-text">销售订单:</span>
<el-input
v-model="salesOrder"
placeholder="请输入销售订单"
clearable
style="width: 150px; margin-right: 10px"
@keyup.enter.native="searchTable"
/>
<span class="show-text">物料名称:</span>
<el-input
v-model="materialName"
placeholder="请输入物料名称"
clearable
style="width: 160px; margin-right: 10px"
@keyup.enter.native="searchTable"
/>
<span class="show-text">物料编码:</span>
<el-input
v-model="materialCode"
placeholder="请输入物料编码"
clearable
style="width: 180px; margin-right: 10px"
@keyup.enter.native="searchTable"
/>
<el-button :disabled="loading" icon="el-icon-search" plain type="primary" @click="searchTable">查询</el-button>
</div>
<el-table
v-loading="loading"
:data="tableData"
:height="'72vh'"
border
element-loading-background="rgba(0, 0, 0, 0.2)"
element-loading-spinner="el-icon-loading"
highlight-current-row
size="mini"
style="width: 100%; margin-top: 20px"
tooltip-effect="dark"
>
<el-table-column align="center" label="序号" type="index" width="60" fixed />
<el-table-column align="center" prop="销售订单" label="销售订单" width="120" fixed show-overflow-tooltip />
<el-table-column align="center" prop="生产订单" label="生产订单" width="100" fixed />
<el-table-column align="center" prop="物料名称" label="物料名称" width="170" show-overflow-tooltip />
<el-table-column align="center" prop="物料编码" label="物料编码" width="180" show-overflow-tooltip />
<el-table-column align="center" prop="计划数量" label="计划数量" width="100" />
<el-table-column align="center" prop="完成数量" label="完成数量" width="100" />
<el-table-column align="center" prop="检验数量" label="检验数量" width="100" />
<el-table-column align="center" prop="检验合格数量" label="检验合格数量" width="120" />
<el-table-column align="center" prop="检验不合格数量" label="检验不合格数量" width="130" />
</el-table>
</el-card>
</div>
</template>
<script>
export default {
name: 'TestAssemblyTask',
data() {
return {
taskType: '全部',
productionOrder: '',
salesOrder: '',
materialName: '',
materialCode: '',
loading: false,
tableData: []
}
},
mounted() {
this.searchTable()
},
methods: {
searchTable() {
this.loading = true
const param = []
param.push(['任务类型', this.taskType])
param.push(['生产订单', this.productionOrder])
param.push(['销售订单', this.salesOrder])
param.push(['物料名称', this.materialName])
param.push(['物料编码', this.materialCode])
const data = this.CreateData('11', '质量管理_测试装配任务_查询', param)
this.ExecDatabase(data).then(response => {
this.tableData = response.data || []
}).catch(error => {
this.$message.error('查询失败:' + error.message)
}).finally(() => {
this.loading = false
})
}
}
}
</script>
<style scoped>
.test-assembly-task {
padding: 10px;
}
.search-container {
display: flex;
align-items: center;
flex-wrap: wrap;
}
.show-text {
font-size: 14px;
margin-right: 6px;
}
</style>

View File

@@ -52,6 +52,11 @@
<span type="success">{{ scope.row.roles_function }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="班组" prop="班组" show-overflow-tooltip>
<template slot-scope="scope">
<span type="success">{{ scope.row.班组 }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作" min-width="450">
<template slot-scope="scope">
<el-button icon="el-icon-refresh-right" style="font-family: MiSans Regular,serif;color: #4d77d6"
@@ -111,6 +116,27 @@
<el-form-item label="工号" prop="account">
<el-input v-model="form1.account" placeholder="请输入工号" readonly style="width: 240px;border-radius: 4px" />
</el-form-item>
<el-form-item label="班组" prop="班组">
<el-select
v-model="form1.team"
clearable
placeholder="请选择"
style="width: 150px; margin-right: 10px"
>
<el-option label="装配" value="装配" />
<el-option label="电气" value="电气" />
<el-option label="机加" value="机加" />
<el-option label="质检" value="质检" />
<el-option label="技术" value="技术" />
<el-option label="计划" value="计划" />
<el-option label="库房" value="库房" />
<el-option label="采购" value="采购" />
<el-option label="销售" value="销售" />
<el-option label="售后" value="售后" />
<el-option label="工艺" value="工艺" />
<el-option label="其他" value="其他" />
</el-select>
</el-form-item>
<!-- <el-form-item label="密码" prop="password">-->
<!-- <el-input-->
<!-- v-model="form1.password"-->
@@ -167,7 +193,8 @@ export default {
PersonalName: '',
account: '',
password: '',
PersonalroleValue: ''
PersonalroleValue: '',
team:''
},
rules1: {
PersonalName: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
@@ -179,7 +206,8 @@ export default {
tableData: [],
total: 0, // 总条数
pageSize: 10, // 每页显示条数
pageList: 1 // 后台获取页
pageList: 1, // 后台获取页
team:''
}
},
created() {
@@ -251,7 +279,8 @@ export default {
password: response.data.result[i].password,
roles_number: parseInt(response.data.result[i].Roles_number),
roles_function: response.data.result[i].Roles_Function,
isClient: response.data.result[i].isClient
isClient: response.data.result[i].isClient,
班组:response.data.result[i].班组
})
}
}
@@ -270,6 +299,7 @@ export default {
this.form1.account = row.account
this.form1.password = row.password
this.form1.PersonalroleValue = row.roles_number
this.form1.team = row.班组
this.title1 = '编辑人员'
this.dialogFormVisible1 = true
},
@@ -284,6 +314,7 @@ export default {
param[2] = ['password', this.form1.password]
param[3] = ['Personnel_Name', this.form1.PersonalName]
param[4] = ['Roles_number', this.form1.PersonalroleValue]
param[5] = ['班组', this.form1.team]
if (this.form1.account === '' || this.form1.account === null) {
this.$message.error('请输入工号')
} else if (this.form1.password === '' || this.form1.password === null) {