@ -115,13 +115,14 @@
< el -table -column align = "center" label = "派工标准工时(小时)" prop = "productionTime" width = "180" >
< el -table -column align = "center" label = "派工标准工时(小时)" prop = "productionTime" width = "180" >
< template slot -scope = " scope " >
< template slot -scope = " scope " >
< el -input -number style = "width:150px;" :min ="0" v -model = " scope.row.productionTime " : disabled = "scope.row.children != null && scope.row.children !== undefined" / >
< el -input -number style = "width:150px;" :min ="0" v -model = " scope.row.productionTime "
: disabled = "scope.row.processType === PROCESS_TYPE.MANUAL && scope.row.children != null && scope.row.children !== undefined" / >
< / template >
< / template >
< / e l - t a b l e - c o l u m n >
< / e l - t a b l e - c o l u m n >
< el -table -column align = "center" label = "计划开始时间" prop = "planBeginTime" width = "230" >
< el -table -column align = "center" label = "计划开始时间" prop = "planBeginTime" width = "230" >
< template slot -scope = " scope " >
< template slot -scope = " scope " >
< el -date -picker v -model = " scope.row.planBeginTime " style = "width:200px;"
< el -date -picker v -model = " scope.row.planBeginTime " style = "width:200px;"
: disabled = "scope.row. children != null && scope.row.children !== undefined"
: disabled = "scope.row. processType === PROCESS_TYPE.MANUAL && scope.row. children != null && scope.row.children !== undefined"
clearable
clearable
placeholder = "请选择计划开始时间"
placeholder = "请选择计划开始时间"
type = "datetime" value - format = "yyyy-MM-dd HH:mm:ss"
type = "datetime" value - format = "yyyy-MM-dd HH:mm:ss"
@ -131,7 +132,7 @@
< el -table -column align = "center" label = "计划完成时间" prop = "planEndTime" width = "230" >
< el -table -column align = "center" label = "计划完成时间" prop = "planEndTime" width = "230" >
< template slot -scope = " scope " >
< template slot -scope = " scope " >
< el -date -picker v -model = " scope.row.planEndTime " style = "width:200px;"
< el -date -picker v -model = " scope.row.planEndTime " style = "width:200px;"
: disabled = "scope.row. children != null && scope.row.children !== undefined"
: disabled = "scope.row. processType === PROCESS_TYPE.MANUAL && scope.row. children != null && scope.row.children !== undefined"
clearable
clearable
placeholder = "请选择计划完成时间"
placeholder = "请选择计划完成时间"
type = "datetime" value - format = "yyyy-MM-dd HH:mm:ss" / >
type = "datetime" value - format = "yyyy-MM-dd HH:mm:ss" / >
@ -159,7 +160,7 @@
size = "mini"
size = "mini"
type = "primary"
type = "primary"
@ click = "handleDrawing(scope.row)"
@ click = "handleDrawing(scope.row)"
v - if = "scope.row. children != null && scope.row.children !== undefined"
v - if = "scope.row. processType !== PROCESS_TYPE.AUTO && scope.row. children != null && scope.row.children !== undefined"
> 图纸
> 图纸
< / e l - b u t t o n >
< / e l - b u t t o n >
< el -button
< el -button
@ -167,7 +168,7 @@
size = "mini"
size = "mini"
type = "success"
type = "success"
@ click = "handleSOP(scope.row)"
@ click = "handleSOP(scope.row)"
v - if = "scope.row. children != null && scope.row.children !== undefined"
v - if = "scope.row. processType !== PROCESS_TYPE.AUTO && scope.row. children != null && scope.row.children !== undefined"
> SOP
> SOP
< / e l - b u t t o n >
< / e l - b u t t o n >
@ -185,7 +186,6 @@
< / e l - t a b l e - c o l u m n >
< / e l - t a b l e - c o l u m n >
< / e l - t a b l e >
< / e l - t a b l e >
< / e l - f o r m >
< / e l - f o r m >
< el -form label -width = " 100px " >
< el -form label -width = " 100px " >
@ -271,7 +271,7 @@
: limit = "limit"
: limit = "limit"
: headers = "headers"
: headers = "headers"
: before - upload = "handleBeforeUpload"
: before - upload = "handleBeforeUpload"
: http - request = "http Request"
: http - request = "http Sop Request"
: on - exceed = "handleExceed"
: on - exceed = "handleExceed"
: file - list = "fileList"
: file - list = "fileList"
>
>
@ -455,8 +455,18 @@ export default {
} ,
} ,
/ / 文 件 列 表
/ / 文 件 列 表
fileList : [ ] ,
fileList : [ ] ,
/ / 上 传 文 件 回 调 列 表
/ / 根 据 工 序 和 派 工 单 号 分 组 S o p 文 件
uploadList : [ ] ,
groupSopFile : { } ,
/ / 根 据 工 序 和 派 工 单 号 分 组 S o p 文 件 列 表
groupSopFileList : [ ] ,
/ / 根 据 工 序 和 派 工 单 号 分 组 图 纸 文 件
groupAttachFile : { } ,
/ / 根 据 工 序 和 派 工 单 号 分 组 图 纸 文 件 列 表
groupAttachFileList : [ ] ,
/ / 上 传 图 纸 文 件 回 调 列 表
uploadAttachList : [ ] ,
/ / 上 传 S O P 文 件 回 调 列 表
uploadSopList : [ ] ,
/ / 文 件 上 传 - 生 产 派 工 对 象
/ / 文 件 上 传 - 生 产 派 工 对 象
addProductPlanObject : { } ,
addProductPlanObject : { } ,
headers : {
headers : {
@ -542,16 +552,19 @@ export default {
obj . deleteFlag = "1" ;
obj . deleteFlag = "1" ;
}
}
obj . id = this . id
obj . id = this . id
this . id = this . id + 1 ;
this . id = this . id + 1 ;
let i = 0 ;
let i = 0 ;
let processType ;
productPlansByDispatch . forEach ( groupedProductPlan => {
productPlansByDispatch . forEach ( groupedProductPlan => {
processType = groupedProductPlan . processType ;
groupedProductPlan . id = this . id ;
groupedProductPlan . id = this . id ;
groupedProductPlan . productionTime = groupedProductPlan . productionTime / 60 / 60 ;
this . id = this . id + 1 ;
this . id = this . id + 1 ;
groupedProductPlan . productionTime = groupedProductPlan . productionTime / 60 / 60 ;
obj . sopId = groupedProductPlan . sopId ;
obj . attachId = groupedProductPlan . attachId ;
if ( i === 0 ) {
if ( i === 0 || groupedProductPlan . processType !== this . PROCESS _TYPE . MANUAL ) {
obj . dispatchCode = groupedProductPlan . dispatchCode ;
obj . dispatchCode = groupedProductPlan . dispatchCode ;
obj . dispatchAmount = groupedProductPlan . dispatchAmount ;
obj . dispatchAmount = groupedProductPlan . dispatchAmount ;
obj . processId = groupedProductPlan . processId ;
obj . processId = groupedProductPlan . processId ;
@ -572,16 +585,25 @@ export default {
obj . saleorderCode = this . form . saleorderCode ;
obj . saleorderCode = this . form . saleorderCode ;
/ / 新 添 加 列 标 识 f a l s e = 新 添 加 , t r u e = 历 史 行
/ / 新 添 加 列 标 识 f a l s e = 新 添 加 , t r u e = 历 史 行
obj . oldRowFlag = true ;
obj . oldRowFlag = true ;
if ( groupedProductPlan . processType !== this . PROCESS _TYPE . MANUAL ) {
let cloneObj = deepClone ( obj ) ;
cloneObj . id = this . id
cloneObj . planId = groupedProductPlan . planId ;
cloneObj . productionTime = groupedProductPlan . productionTime / 60 / 60 ;
this . id = this . id + 1 ;
cloneObj . children = [ ] ;
this . mesProductPlanList . push ( cloneObj ) ;
}
i ++ ;
i ++ ;
}
}
} ) ;
} ) ;
if ( processType === this . PROCESS _TYPE . MANUAL ) {
obj . children = productPlansByDispatch ;
obj . children = productPlansByDispatch ;
this . mesProductPlanList . push ( obj ) ;
this . mesProductPlanList . push ( obj ) ;
}
}
}
/ / c o n s o l e . l o g ( J S O N . s t r i n g i f y ( t h i s . m e s P r o d u c t P l a n L i s t ) )
this . getId ( this . mesProductPlanList ) ;
this . getId ( this . mesProductPlanList ) ;
@ -633,10 +655,11 @@ export default {
/** 提交按钮 */
/** 提交按钮 */
submitForm ( ) {
submitForm ( ) {
/ / l e t d a t a L i s t = t h i s . m e s P r o d u c t P l a n L i s t . f i l t e r ( p l a n = > ! p l a n . o l d R o w F l a g ) ;
/ / l e t d a t a L i s t = t h i s . m e s P r o d u c t P l a n L i s t . f i l t e r ( p l a n = > ! p l a n . o l d R o w F l a g ) ;
/ / i f ( d a t a L i s t . l e n g t h = = = 0 ) {
if ( this . mesProductPlanList . length === 0 ) {
/ / t h i s . c l o s e ( ) ;
this . $modal . msgError ( "无派工信息提交" ) ;
/ / r e t u r n ;
return ;
/ / }
}
let dataList = this . mesProductPlanList ;
let dataList = this . mesProductPlanList ;
let toUpdatedProductPlans = [ ] ;
let toUpdatedProductPlans = [ ] ;
let undispathDesc ;
let undispathDesc ;
@ -645,11 +668,13 @@ export default {
let dispatchFlag = false ;
let dispatchFlag = false ;
undispathDesc = "派工单号为[" + e . dispatchCode + "],工序为[" + e . processName + "],请选择用户派工" ;
undispathDesc = "派工单号为[" + e . dispatchCode + "],工序为[" + e . processName + "],请选择用户派工" ;
if ( ! e . children || e . children . length <= 0 ) {
if ( e . processType !== this . PROCESS _TYPE . AUTO ) {
if ( ! e . children || e . children . length <= 0 ) { / / 不 是 自 动 话 产 线 需 要 派 工 到 人
this . $modal . msgError ( undispathDesc ) ;
this . $modal . msgError ( undispathDesc ) ;
return ;
return ;
}
}
for ( let j = 0 ; j < e . children . length ; j ++ ) {
for ( let j = 0 ; j < e . children . length ; j ++ ) {
let processUser = e . children [ j ] ;
let processUser = e . children [ j ] ;
let toUpdatedProductPlan = deepClone ( e ) ;
let toUpdatedProductPlan = deepClone ( e ) ;
@ -658,6 +683,8 @@ export default {
toUpdatedProductPlan . planBeginTime = processUser . planBeginTime ;
toUpdatedProductPlan . planBeginTime = processUser . planBeginTime ;
toUpdatedProductPlan . planEndTime = processUser . planEndTime ;
toUpdatedProductPlan . planEndTime = processUser . planEndTime ;
toUpdatedProductPlan . planId = processUser . planId ;
toUpdatedProductPlan . planId = processUser . planId ;
toUpdatedProductPlan . attachId = e . attachId ;
toUpdatedProductPlan . sopId = e . sopId ;
toUpdatedProductPlan . children = null ;
toUpdatedProductPlan . children = null ;
let productionTimeHour = processUser . productionTime ;
let productionTimeHour = processUser . productionTime ;
@ -671,6 +698,8 @@ export default {
return ;
return ;
}
}
}
}
} else {
toUpdatedProductPlans . push ( e ) ;
}
}
if ( toUpdatedProductPlans . length <= 0 ) {
if ( toUpdatedProductPlans . length <= 0 ) {
@ -678,6 +707,8 @@ export default {
return ;
return ;
}
}
}
/ / 校 验 派 工 数 量 ( 已 派 工 数 量 + 派 工 数 量 < = 计 划 数 量 )
/ / 校 验 派 工 数 量 ( 已 派 工 数 量 + 派 工 数 量 < = 计 划 数 量 )
/ / 按 照 p r o c e s s I d 分 组 , 所 有 分 组 的 p l a n A m o u n t 之 和 是 否 相 等 , 相 等 后 输 出 p l a n A m o u n t 之 和 的 值
/ / 按 照 p r o c e s s I d 分 组 , 所 有 分 组 的 p l a n A m o u n t 之 和 是 否 相 等 , 相 等 后 输 出 p l a n A m o u n t 之 和 的 值
let dispatchAmountErrorMsg = "" ;
let dispatchAmountErrorMsg = "" ;
@ -728,7 +759,12 @@ export default {
orderAddMesProductPlanList (
orderAddMesProductPlanList (
{ productOrderId : this . form . productOrderId , dispatchAmount : currentDispatchAmount , mesProductPlanList : toUpdatedProductPlans , toDeletedPlanIds : this . toDeletedPlanIds } )
{
productOrderId : this . form . productOrderId ,
dispatchAmount : currentDispatchAmount ,
mesProductPlanList : toUpdatedProductPlans ,
toDeletedPlanIds : this . toDeletedPlanIds
} )
. then ( res => {
. then ( res => {
this . $modal . msgSuccess ( res . msg ) ;
this . $modal . msgSuccess ( res . msg ) ;
this . close ( ) ;
this . close ( ) ;
@ -762,7 +798,11 @@ export default {
return item . planId ;
return item . planId ;
} ) ;
} ) ;
deleteProductPlansByDispatchCode ( { productOrderId : this . form . productOrderId , dispatchCode : dispatchCode , dispatchAmount : dispatchSum } ) . then ( res => {
deleteProductPlansByDispatchCode ( {
productOrderId : this . form . productOrderId ,
dispatchCode : dispatchCode ,
dispatchAmount : dispatchSum
} ) . then ( res => {
this . mesProductPlanList = this . mesProductPlanList . filter ( function ( item ) {
this . mesProductPlanList = this . mesProductPlanList . filter ( function ( item ) {
return dispatchCode !== item . dispatchCode
return dispatchCode !== item . dispatchCode
} ) ;
} ) ;
@ -793,45 +833,7 @@ export default {
const obj = { path : "/mes/plan/productOrder" , query : { t : Date . now ( ) , queryParams : this . $route . query . queryParams } } ;
const obj = { path : "/mes/plan/productOrder" , query : { t : Date . now ( ) , queryParams : this . $route . query . queryParams } } ;
this . $tab . closeOpenPage ( obj ) ;
this . $tab . closeOpenPage ( obj ) ;
} ,
} ,
/** 查看图纸 */
handleDrawing ( row ) {
this . fileList = [ ] ;
this . uploadList = [ ] ;
if ( row . planId != null ) {
getDispatchDrawingList ( row . planId ) . then ( res => {
let attachList = res . data ;
attachList . forEach ( e => {
let previewFile = { } ;
previewFile . url = e . attachPath ;
previewFile . name = e . attachName ;
this . fileList . push ( previewFile ) ;
this . uploadList . push ( e . attachId ) ;
} )
} )
}
this . addProductPlanObject = row ;
this . blueprintModel = true ;
} ,
/** 查看SOP附件 */
handleSOP ( row ) {
this . fileList = [ ] ;
this . uploadList = [ ] ;
if ( row . planId != null ) {
getDispatchSOPAttachList ( row . planId ) . then ( res => {
let attachList = res . data ;
attachList . forEach ( e => {
let previewFile = { } ;
previewFile . url = e . attachPath ;
previewFile . name = e . attachName ;
this . fileList . push ( previewFile ) ;
this . uploadList . push ( e . attachId ) ;
} )
} )
}
this . addProductPlanObject = row ;
this . sopViewModel = true ;
} ,
/** 生产计划添加按钮操作 */
/** 生产计划添加按钮操作 */
handleAddMesProductPlan ( ) {
handleAddMesProductPlan ( ) {
@ -847,7 +849,7 @@ export default {
res . data . forEach ( ( e , index ) => {
res . data . forEach ( ( e , index ) => {
let obj = { } ;
let obj = { } ;
if ( i === 0 ) {
if ( i === 0 ) {
obj . deleteFlag = "1" ;
obj . deleteFlag = "1" ; / / 设 置 第 一 条 记 录 删 除 标 识 , 代 表 只 能 此 派 工 单 号 只 有 第 一 条 记 录 上 有 删 除 按 钮 , 删 除 时 同 意 删 除 此 派 工 单 号 的 派 工
i ++ ;
i ++ ;
}
}
obj . id = this . id
obj . id = this . id
@ -880,11 +882,16 @@ export default {
/ / t h i s . i d = t h i s . i d + 1 ;
/ / t h i s . i d = t h i s . i d + 1 ;
/ / } ) ;
/ / } ) ;
if ( e . processType === this . PROCESS _TYPE . AUTO ) {
obj . children = [ ] ;
} else {
obj . children = [ {
obj . children = [ {
id : this . id ,
id : this . id ,
processId : obj . processId ,
processId : obj . processId ,
planStatus : this . PLAN _STATUS . DISPATCHED
planStatus : this . PLAN _STATUS . DISPATCHED
} ]
} ]
}
this . id += 1 ;
this . id += 1 ;
@ -921,53 +928,98 @@ export default {
handleDownload ( file ) {
handleDownload ( file ) {
window . open ( file . url ) ;
window . open ( file . url ) ;
} ,
} ,
/** 查看图纸 */
handleDrawing ( row ) {
this . fileList = [ ] ;
this . uploadAttachList = [ ] ;
if ( row . oldRowFlag ) {
getDispatchDrawingList ( row . dispatchCode , row . processId ) . then ( res => {
let attachList = res . data ;
attachList . forEach ( e => {
let previewFile = { } ;
previewFile . url = e . attachPath ;
previewFile . name = e . attachName ;
this . fileList . push ( previewFile ) ;
this . uploadAttachList . push ( e . attachId ) ;
} )
} )
}
this . groupAttachFileList . forEach ( e => {
if ( e . dispatchCode === row . dispatchCode && e . processId === row . processId ) {
let previewFile = { } ;
previewFile . url = e . attachPath ;
previewFile . name = e . attachName ;
this . fileList . push ( previewFile ) ;
this . uploadAttachList . push ( e . attachId ) ;
}
} )
this . addProductPlanObject = row ;
this . blueprintModel = true ;
} ,
/** 查看SOP附件 */
handleSOP ( row ) {
this . fileList = [ ] ;
this . uploadSopList = [ ] ;
if ( row . oldRowFlag ) {
getDispatchSOPAttachList ( row . dispatchCode , row . processId ) . then ( res => {
let attachList = res . data ;
attachList . forEach ( e => {
let previewFile = { } ;
previewFile . url = e . attachPath ;
previewFile . name = e . attachName ;
this . fileList . push ( previewFile ) ;
this . uploadSopList . push ( e . attachId ) ;
} )
} )
}
this . groupSopFileList . forEach ( e => {
if ( e . dispatchCode === row . dispatchCode && e . processId === row . processId ) {
let previewFile = { } ;
previewFile . url = e . attachPath ;
previewFile . name = e . attachName ;
this . fileList . push ( previewFile ) ;
this . uploadSopList . push ( e . attachId ) ;
}
} )
this . addProductPlanObject = row ;
this . sopViewModel = true ;
} ,
/ / 添 加 图 纸 提 交
/ / 添 加 图 纸 提 交
drawingFileUploadSubmit ( ) {
drawingFileUploadSubmit ( ) {
/ / 新 添 加 列 标 识 f a l s e = 新 添 加 , t r u e = 历 史 行
if ( this . addProductPlanObject . oldRowFlag ) {
updateProductplan ( {
planId : this . addProductPlanObject . planId ,
attachId : this . uploadList . join ( "," ) ,
} ) . then ( res => {
this . $modal . msgSuccess ( "上传图纸成功!" ) ;
}
)
} else {
for ( let i = 0 ; i < this . mesProductPlanList . length ; i ++ ) {
for ( let i = 0 ; i < this . mesProductPlanList . length ; i ++ ) {
if ( this . mesProductPlanList [ i ] . index === this . addProductPlanObject . index ) {
let mesProductPlan = this . mesProductPlanList [ i ] ;
this . mesProductPlanList [ i ] . attachId = this . uploadList . join ( "," ) ;
if ( mesProductPlan . dispatchCode === this . addProductPlanObject . dispatchCode
&& mesProductPlan . processId === this . addProductPlanObject . processId ) {
this . mesProductPlanList [ i ] . attachId = this . uploadAttachList . join ( "," ) ;
}
}
}
}
}
this . uploadAttachList = [ ] ;
this . uploadList = [ ] ;
this . addProductPlanObject = null ;
this . addProductPlanObject = null ;
this . blueprintModel = false ;
this . blueprintModel = false ;
} ,
} ,
/ / 添 加 S O P 附 件 提 交
/ / 添 加 S O P 附 件 提 交
sopFileUploadSubmit ( ) {
sopFileUploadSubmit ( ) {
/ / 新 添 加 列 标 识 f a l s e = 新 添 加 , t r u e = 历 史 行
if ( this . addProductPlanObject . oldRowFlag ) {
updateProductplan ( {
planId : this . addProductPlanObject . planId ,
sopId : this . uploadList . join ( "," ) ,
} ) . then ( res => {
this . $modal . msgSuccess ( "上传SOP附件成功! " ) ;
}
)
} else {
for ( let i = 0 ; i < this . mesProductPlanList . length ; i ++ ) {
for ( let i = 0 ; i < this . mesProductPlanList . length ; i ++ ) {
if ( this . mesProductPlanList [ i ] . index === this . addProductPlanObject . index ) {
let mesProductPlan = this . mesProductPlanList [ i ] ;
this . mesProductPlanList [ i ] . sopId = this . uploadList . join ( "," ) ;
if ( mesProductPlan . dispatchCode === this . addProductPlanObject . dispatchCode
&& mesProductPlan . processId === this . addProductPlanObject . processId ) {
this . mesProductPlanList [ i ] . sopId = this . uploadSopList . join ( "," ) ;
}
}
}
}
}
this . uploadList = [ ] ;
this . uploadSopList = [ ] ;
this . addProductPlanObject = null ;
this . addProductPlanObject = null ;
this . sopViewModel = false ;
this . sopViewModel = false ;
} ,
} ,
/ / 图 片 上 传
/ / 图 纸图 片上 传
httpRequest ( file ) {
httpRequest ( file ) {
/ / 文 件 信 息
/ / 文 件 信 息
const fileData = file . file ;
const fileData = file . file ;
@ -978,13 +1030,48 @@ export default {
uploadFile ( formData ) . then (
uploadFile ( formData ) . then (
( res ) => {
( res ) => {
/ / 存 储 附 件 信 息 主 键
/ / 存 储 附 件 信 息 主 键
this . uploadList . push ( res . attachId ) ;
let groupAttachFile = { } ;
groupAttachFile . dispatchCode = this . addProductPlanObject . dispatchCode ;
groupAttachFile . processId = this . addProductPlanObject . processId ;
groupAttachFile . attachId = res . attachId ;
groupAttachFile . attachPath = res . imgUrl ;
groupAttachFile . attachName = res . fileName ;
this . groupAttachFileList . push ( groupAttachFile ) ;
this . uploadAttachList . push ( res . attachId ) ;
} , ( err ) => {
} , ( err ) => {
this . $refs . drawingUpload . clearFiles ( ) ; / / 上 传 失 败 后 清 除 当 前 上 传 的 图 片
this . $refs . drawingUpload . clearFiles ( ) ; / / 上 传 失 败 后 清 除 当 前 上 传 的 图 片
this . $modal . closeLoading ( ) ;
this . $modal . closeLoading ( ) ;
}
}
) ;
) ;
} ,
} ,
/ / S O P 图 片 上 传
httpSopRequest ( file ) {
/ / 文 件 信 息
const fileData = file . file ;
const formData = new FormData ( ) ;
formData . append ( "file" , fileData ) ;
formData . append ( "processId" , this . addProductPlanObject . processId ) ;
formData . append ( "attachType" , "1" ) ;
uploadFile ( formData ) . then (
( res ) => {
/ / 存 储 附 件 信 息 主 键
let groupSopFile = { } ;
groupSopFile . dispatchCode = this . addProductPlanObject . dispatchCode ;
groupSopFile . processId = this . addProductPlanObject . processId ;
groupSopFile . attachId = res . attachId ;
groupSopFile . attachPath = res . imgUrl ;
groupSopFile . attachName = res . fileName ;
this . groupSopFileList . push ( groupSopFile ) ;
this . uploadSopList . push ( res . attachId ) ;
} , ( err ) => {
this . $refs . drawingUpload . clearFiles ( ) ; / / 上 传 失 败 后 清 除 当 前 上 传 的 图 片
this . $modal . closeLoading ( ) ;
}
) ;
} ,
/ / 上 传 结 束 处 理
/ / 上 传 结 束 处 理
uploadedSuccessfully ( ) {
uploadedSuccessfully ( ) {
if ( this . number > 0 && this . uploadList . length === this . number ) {
if ( this . number > 0 && this . uploadList . length === this . number ) {