@ -1,7 +1,7 @@
< template >
< div class = "app-container" >
<!-- 搜索表单 -- >
< el -form :model ="queryParams " ref = "queryForm " size = "small" :inline ="true" class = "search-form" >
< el -form ref = "queryForm" :model ="queryParams " size = "small" :inline ="true" class = "search-form" >
< el -form -item label = "设备编号" prop = "deviceCode" >
< el -input v -model = " queryParams.deviceCode " placeholder = "请输入设备编号" clearable @keyup.enter.native ="handleQuery" / >
< / e l - f o r m - i t e m >
@ -19,39 +19,96 @@
< / e l - f o r m - i t e m >
< / e l - f o r m >
< el -card class = "maintenance-card" shadow = "never" >
< div slot = "header" >
< span > PDA订单维护 < / span >
< / div >
<!--
该区域用于模拟 / 承接PDA订单维护链路 :
1. 先按物料关键字查询候选订单
2. 再从下拉框中明确选中一条工单
3. 最后只维护执行状态与完工数量 , 避免一次表单承载过多业务字段
-- >
< el -form :model ="pdaMaintainForm" size = "small" :inline ="true" label -width = " 80px " >
< el -form -item label = "物料关键字" >
< el -input
v - model = "pdaMaintainForm.materialKeyword"
placeholder = "请输入物料编码或名称"
clearable
style = "width: 220px"
@ keyup . enter . native = "handlePdaOrderSearch"
/ >
< / e l - f o r m - i t e m >
< el -form -item >
< el -button type = "primary" icon = "el-icon-search" size = "mini" :loading ="pdaOrderLoading" @click ="handlePdaOrderSearch" > 查 询 订 单 < / el -button >
< / e l - f o r m - i t e m >
< el -form -item label = "订单选择" >
< el -select
v - model = "pdaMaintainForm.objId"
placeholder = "请先查询再选择订单"
filterable
clearable
style = "width: 360px"
@ change = "handlePdaOrderChange"
>
< el -option
v - for = "item in pdaOrderOptions"
: key = "item.objId"
: label = "buildPdaOrderOptionLabel(item)"
: value = "item.objId"
/ >
< / e l - s e l e c t >
< / e l - f o r m - i t e m >
< el -form -item label = "执行状态" >
< el -select v-model ="pdaMaintainForm.executionStatus" placeholder="请选择执行状态" clearable style="width: 140px" >
< el -option label = "待执行" value = "PENDING" / >
< el -option label = "运行中" value = "RUNNING" / >
< el -option label = "已完成" value = "COMPLETED" / >
< el -option label = "已暂停" value = "PAUSED" / >
< / e l - s e l e c t >
< / e l - f o r m - i t e m >
< el -form -item label = "完工数量" >
< el -input -number v -model = " pdaMaintainForm.actualCompleteQty " :min ="0" :precision ="0" style = "width: 140px" / >
< / e l - f o r m - i t e m >
< el -form -item >
< el -button type = "success" icon = "el-icon-check" size = "mini" :loading ="pdaMaintainSubmitting" @click ="submitPdaOrderMaintain" > 更 新 订 单 < / el -button >
< / e l - f o r m - i t e m >
< / e l - f o r m >
< / e l - c a r d >
<!-- 批量操作按钮 -- >
< el -row :gutter ="10" class = "mb8" >
< el -col :span ="1.5" >
< el -button
v - hasPermi = "['base:orderInfo:edit']"
type = "primary"
plain
icon = "el-icon-video-play"
size = "mini"
: disabled = "multiple"
@ click = "handleBatchStart"
v - hasPermi = "['base:orderInfo:edit']"
> 批量开始生产 < / e l - b u t t o n >
< / e l - c o l >
< el -col :span ="1.5" >
< el -button
v - hasPermi = "['base:orderInfo:edit']"
type = "warning"
plain
icon = "el-icon-edit"
size = "mini"
: disabled = "multiple"
@ click = "handleBatchUpdateQty"
v - hasPermi = "['base:orderInfo:edit']"
> 批量更新数量 < / e l - b u t t o n >
< / e l - c o l >
< el -col :span ="1.5" >
< el -button
v - hasPermi = "['base:orderInfo:edit']"
type = "success"
plain
icon = "el-icon-check"
size = "mini"
: disabled = "multiple"
@ click = "handleBatchComplete"
v - hasPermi = "['base:orderInfo:edit']"
> 批量完工提报 < / e l - b u t t o n >
< / e l - c o l >
< / e l - r o w >
@ -263,15 +320,18 @@
< / template >
< script >
import { listOrderInfo , startProduction , completeProduction , updateQuantity , batchStartProduction , batchUpdateQuantity , batchCompleteProduction } from "@/api/base/orderInfo" ;
import { listOrderInfo , startProduction , completeProduction , updateQuantity , batchStartProduction , batchUpdateQuantity , batchCompleteProduction , listPdaOrdersByMaterial , updatePdaOrderStatusAndQty } from '@/api/base/orderInfo'
export default {
name : "OrderExecution" ,
name : 'OrderExecution' ,
data ( ) {
return {
loading : false ,
total : 0 ,
orderList : [ ] ,
pdaOrderOptions : [ ] ,
pdaOrderLoading : false ,
pdaMaintainSubmitting : false ,
selectedIds : [ ] ,
multiple : true ,
queryParams : {
@ -315,68 +375,138 @@ export default {
completeQty : 0 ,
defectQty : 0
} ,
detailOrder : { }
} ;
detailOrder : { } ,
pdaMaintainForm : {
materialKeyword : '' ,
objId : null ,
orderCode : '' ,
executionStatus : 'PENDING' ,
actualCompleteQty : 0
}
}
} ,
created ( ) {
this . getList ( ) ;
this . getList ( )
} ,
methods : {
getList ( ) {
this . loading = true ;
this . loading = true
listOrderInfo ( this . queryParams )
. then ( response => {
const data = response && response . data ? response . data : response ;
const data = response && response . data ? response . data : response
if ( Array . isArray ( data ) ) {
this . orderList = data ;
this . total = data . length ;
this . orderList = data
this . total = data . length
} else {
this . orderList = ( data && data . rows ) ? data . rows : [ ] ;
this . total = ( data && data . total ) ? data . total : this . orderList . length ;
this . orderList = ( data && data . rows ) ? data . rows : [ ]
this . total = ( data && data . total ) ? data . total : this . orderList . length
}
} )
. catch ( ( ) => {
this . orderList = [ ] ;
this . total = 0 ;
this . orderList = [ ]
this . total = 0
} )
. finally ( ( ) => {
this . loading = false ;
} ) ;
this . loading = false
} )
} ,
handleQuery ( ) {
this . queryParams . pageNum = 1 ;
this . getList ( ) ;
this . queryParams . pageNum = 1
this . getList ( )
} ,
resetQuery ( ) {
this . resetForm ( "queryForm" ) ;
this . handleQuery ( ) ;
this . resetForm ( 'queryForm' )
this . handleQuery ( )
} ,
getStatusType ( status ) {
const map = { 'RUNNING' : 'warning' , 'COMPLETED' : 'success' , 'PAUSED' : 'info' , 'PENDING' : '' } ;
return map [ status ] || '' ;
const map = { 'RUNNING' : 'warning' , 'COMPLETED' : 'success' , 'PAUSED' : 'info' , 'PENDING' : '' }
return map [ status ] || ''
} ,
getStatusText ( status ) {
const map = { 'RUNNING' : '运行中' , 'COMPLETED' : '已完成' , 'PAUSED' : '已暂停' , 'PENDING' : '待执行' } ;
return map [ status ] || '待执行' ;
const map = { 'RUNNING' : '运行中' , 'COMPLETED' : '已完成' , 'PAUSED' : '已暂停' , 'PENDING' : '待执行' }
return map [ status ] || '待执行'
} ,
buildPdaOrderOptionLabel ( row ) {
/ / 下 拉 标 签 同 时 展 示 物 料 、 工 单 和 当 前 状 态 , 减 少 现 场 人 员 误 选 相 近 工 单
return ` ${ row . materialName || '-' } / ${ row . orderCode || '-' } / 当前状态: ${ this . getStatusText ( row . executionStatus ) } `
} ,
handlePdaOrderSearch ( ) {
const keyword = this . pdaMaintainForm . materialKeyword && this . pdaMaintainForm . materialKeyword . trim ( )
if ( ! keyword ) {
this . $modal . msgWarning ( '请输入物料关键字' )
return
}
this . pdaOrderLoading = true
listPdaOrdersByMaterial ( keyword ) . then ( response => {
const data = response && response . data ? response . data : response
this . pdaOrderOptions = Array . isArray ( data ) ? data : [ ]
if ( ! this . pdaOrderOptions . length ) {
this . $modal . msgWarning ( '未查询到关联工单' )
this . pdaMaintainForm . objId = null
this . pdaMaintainForm . orderCode = ''
return
}
if ( ! this . pdaMaintainForm . objId && this . pdaOrderOptions . length === 1 ) {
/ / 只 有 一 条 候 选 工 单 时 自 动 回 填 , 减 少 P D A 端 额 外 点 击
this . handlePdaOrderChange ( this . pdaOrderOptions [ 0 ] . objId )
}
} ) . finally ( ( ) => {
this . pdaOrderLoading = false
} )
} ,
handlePdaOrderChange ( objId ) {
const current = this . pdaOrderOptions . find ( item => item . objId === objId )
if ( ! current ) {
this . pdaMaintainForm . orderCode = ''
return
}
/ / 订 单 一 旦 选 中 , 后 续 维 护 都 以 该 条 记 录 当 前 值 为 基 础 , 避 免 覆 盖 成 空 值
this . pdaMaintainForm . orderCode = current . orderCode
this . pdaMaintainForm . executionStatus = current . executionStatus || 'PENDING'
this . pdaMaintainForm . actualCompleteQty = current . actualCompleteQty != null ? current . actualCompleteQty : ( current . completeAmount || 0 )
} ,
submitPdaOrderMaintain ( ) {
if ( ! this . pdaMaintainForm . objId ) {
this . $modal . msgWarning ( '请选择订单' )
return
}
if ( ! this . pdaMaintainForm . executionStatus ) {
this . $modal . msgWarning ( '请选择执行状态' )
return
}
this . pdaMaintainSubmitting = true
updatePdaOrderStatusAndQty ( {
objId : this . pdaMaintainForm . objId ,
orderCode : this . pdaMaintainForm . orderCode ,
executionStatus : this . pdaMaintainForm . executionStatus ,
actualCompleteQty : this . pdaMaintainForm . actualCompleteQty
} ) . then ( ( ) => {
/ / 更 新 成 功 后 同 时 刷 新 执 行 列 表 和 候 选 订 单 , 确 保 页 面 展 示 与 数 据 库 状 态 保 持 一 致
this . $modal . msgSuccess ( '订单维护成功' )
this . getList ( )
this . handlePdaOrderSearch ( )
} ) . finally ( ( ) => {
this . pdaMaintainSubmitting = false
} )
} ,
handleStart ( row ) {
this . startForm = {
orderCode : row . orderCode ,
materialName : row . materialName ,
operator : this . $store . state . user . name || ''
} ;
this . startDialogVisible = true ;
}
this . startDialogVisible = true
} ,
confirmStart ( ) {
if ( ! this . startForm . operator ) {
this . $modal . msgWarning ( "请输入操作员" ) ;
return ;
this . $modal . msgWarning ( '请输入操作员' )
return
}
startProduction ( this . startForm . orderCode , this . startForm . operator ) . then ( response => {
this . $modal . msgSuccess ( "开始生产成功" ) ;
this . startDialogVisible = false ;
this . getList ( ) ;
} ) ;
this . $modal . msgSuccess ( '开始生产成功' )
this . startDialogVisible = false
this . getList ( )
} )
} ,
handleUpdateQty ( row ) {
this . updateForm = {
@ -384,15 +514,15 @@ export default {
planQty : row . orderAmount ,
completeQty : row . actualCompleteQty || 0 ,
defectQty : row . actualDefectQty || 0
} ;
this . updateQtyDialogVisible = true ;
}
this . updateQtyDialogVisible = true
} ,
confirmUpdateQty ( ) {
updateQuantity ( this . updateForm . orderCode , this . updateForm . completeQty , this . updateForm . defectQty ) . then ( response => {
this . $modal . msgSuccess ( "更新数量成功" ) ;
this . updateQtyDialogVisible = false ;
this . getList ( ) ;
} ) ;
this . $modal . msgSuccess ( '更新数量成功' )
this . updateQtyDialogVisible = false
this . getList ( )
} )
} ,
handleComplete ( row ) {
this . completeForm = {
@ -400,84 +530,84 @@ export default {
planQty : row . orderAmount ,
completeQty : row . actualCompleteQty || 0 ,
defectQty : row . actualDefectQty || 0
} ;
this . completeDialogVisible = true ;
}
this . completeDialogVisible = true
} ,
confirmComplete ( ) {
this . $modal . confirm ( '确认完工提报?完工后工单状态将变为已完成' ) . then ( ( ) => {
completeProduction ( this . completeForm . orderCode , this . completeForm . completeQty , this . completeForm . defectQty ) . then ( response => {
this . $modal . msgSuccess ( "完工提报成功" ) ;
this . completeDialogVisible = false ;
this . getList ( ) ;
} ) ;
} ) ;
this . $modal . msgSuccess ( '完工提报成功' )
this . completeDialogVisible = false
this . getList ( )
} )
} )
} ,
handleDetail ( row ) {
this . detailOrder = row ;
this . detailDialogVisible = true ;
this . detailOrder = row
this . detailDialogVisible = true
} ,
handleSelectionChange ( selection ) {
this . selectedIds = selection . map ( item => item . objId ) ;
this . multiple = ! selection . length ;
this . selectedIds = selection . map ( item => item . objId )
this . multiple = ! selection . length
} ,
handleBatchStart ( ) {
if ( this . selectedIds . length === 0 ) {
this . $modal . msgWarning ( "请至少选择一条工单" ) ;
return ;
this . $modal . msgWarning ( '请至少选择一条工单' )
return
}
this . batchStartForm = {
operator : this . $store . state . user . name || ''
} ;
this . batchStartDialogVisible = true ;
}
this . batchStartDialogVisible = true
} ,
confirmBatchStart ( ) {
if ( ! this . batchStartForm . operator ) {
this . $modal . msgWarning ( "请输入操作员" ) ;
return ;
this . $modal . msgWarning ( '请输入操作员' )
return
}
const data = {
objIds : this . selectedIds ,
operator : this . batchStartForm . operator
} ;
}
batchStartProduction ( data ) . then ( response => {
this . $modal . msgSuccess ( "批量开始生产成功" ) ;
this . batchStartDialogVisible = false ;
this . getList ( ) ;
} ) ;
this . $modal . msgSuccess ( '批量开始生产成功' )
this . batchStartDialogVisible = false
this . getList ( )
} )
} ,
handleBatchUpdateQty ( ) {
if ( this . selectedIds . length === 0 ) {
this . $modal . msgWarning ( "请至少选择一条工单" ) ;
return ;
this . $modal . msgWarning ( '请至少选择一条工单' )
return
}
this . batchUpdateForm = {
completeQty : 0 ,
defectQty : 0
} ;
this . batchUpdateQtyDialogVisible = true ;
}
this . batchUpdateQtyDialogVisible = true
} ,
confirmBatchUpdateQty ( ) {
const data = {
objIds : this . selectedIds ,
completeQty : this . batchUpdateForm . completeQty ,
defectQty : this . batchUpdateForm . defectQty
} ;
}
batchUpdateQuantity ( data ) . then ( response => {
this . $modal . msgSuccess ( "批量更新数量成功" ) ;
this . batchUpdateQtyDialogVisible = false ;
this . getList ( ) ;
} ) ;
this . $modal . msgSuccess ( '批量更新数量成功' )
this . batchUpdateQtyDialogVisible = false
this . getList ( )
} )
} ,
handleBatchComplete ( ) {
if ( this . selectedIds . length === 0 ) {
this . $modal . msgWarning ( "请至少选择一条工单" ) ;
return ;
this . $modal . msgWarning ( '请至少选择一条工单' )
return
}
this . batchCompleteForm = {
completeQty : 0 ,
defectQty : 0
} ;
this . batchCompleteDialogVisible = true ;
}
this . batchCompleteDialogVisible = true
} ,
confirmBatchComplete ( ) {
this . $modal . confirm ( '确认批量完工提报?完工后工单状态将变为已完成' ) . then ( ( ) => {
@ -485,20 +615,24 @@ export default {
objIds : this . selectedIds ,
completeQty : this . batchCompleteForm . completeQty ,
defectQty : this . batchCompleteForm . defectQty
} ;
}
batchCompleteProduction ( data ) . then ( response => {
this . $modal . msgSuccess ( "批量完工提报成功" ) ;
this . batchCompleteDialogVisible = false ;
this . getList ( ) ;
} ) ;
} ) ;
this . $modal . msgSuccess ( '批量完工提报成功' )
this . batchCompleteDialogVisible = false
this . getList ( )
} )
} )
}
}
} ;
}
< / script >
< style scoped >
. search - form {
margin - bottom : 15 px ;
}
. maintenance - card {
margin - bottom : 15 px ;
}
< / style >