@@ -36,6 +36,7 @@
< / view >
< view class = "btn-grid quick-grid" >
< button class = "type-btn ship-btn" @click ="handleShip" > 发货 < / button >
< button class = "type-btn cancelship-btn" @click ="handleCancelShip" > 撤回发货 < / button >
< button class = "type-btn move-btn" @click ="handleTranfer" > 移库 < / button >
< button class = "type-btn see-btn" @click ="handleSee" > 查看存储钢卷 < / button >
< button class = "type-btn packing-btn" @click ="handlePack" > 打包 < / button >
@@ -108,6 +109,58 @@
<!-- < klp-scaner > < / klp-scaner > -- >
< qs-scanlistener ref = 'pda' > < / qs-scanlistener >
< uni-popup ref = "shipPopup" type = "bottom" >
< view style = "background-color: white; padding: 20rpx;" >
< view class = "info-card" v-if = "coilDetail.coilId" >
< view class = "info-grid" >
< view class = "info-item" >
< text class = "item-label" > 入场钢卷号 < / text >
< text class = "item-value" > { { coilDetail . enterCoilNo || '-' } } < / text >
< / view >
< view class = "info-item" >
< text class = "item-label" > 当前钢卷号 < / text >
< text class = "item-value" > { { coilDetail . currentCoilNo || '-' } } < / text >
< / view >
< view class = "info-item" >
< text class = "item-label" > 重量 < / text >
< text class = "item-value" > { { coilDetail . netWeight || '-' } } < / text >
< / view >
< view class = "info-item" >
< text class = "item-label" > 厂家 < / text >
< text class = "item-value" > { { coilDetail . product && coilDetail . product . manufacturer || '-' } } < / text >
< / view >
< view class = "info-item" >
< text class = "item-label" > 材质 < / text >
< text class = "item-value" > { { coilDetail . product && coilDetail . product . material || '-' } } < / text >
< / view >
< view class = "info-item" >
< text class = "item-label" > 规格 < / text >
< text class = "item-value" > { { coilDetail . product && coilDetail . product . specification || '-' } } < / text >
< / view >
< view class = "info-item" >
< text class = "item-label" > 品名 < / text >
< text class = "item-value" > { { coilDetail . product && coilDetail . product . productName || '-' } } < / text >
< / view >
< / view >
< / view >
< button
v-if = "currentAction == 'withdrawShip'"
:disabled = "buttonLoading"
:loading = "buttonLoading"
@click ="handleCancelShipSubmit" >
撤回发货
< / button >
< button
v-if = "currentAction == 'ship'"
:disabled = "buttonLoading"
:loading = "buttonLoading"
@click ="handleShipSubmit" >
发货
< / button >
< / view >
< / uni -popup >
< / view >
< / template >
@@ -123,7 +176,8 @@
updateMaterialCoilSimple ,
listMaterialCoil ,
updateMaterialCoil ,
exportCoil
exportCoil ,
cancelExportCoil
} from '@/api/wms/coil.js'
import {
addPendingAction
@@ -141,7 +195,9 @@
form : { } ,
targetWarehouse : null , // 存储选中的目标库区信息
bomDialogShow : false , // BOM参数弹窗控制( 原有功能补充) ,
mode : 'pda' // pda或camera
mode : 'pda' , // pda或camera
currentAction : '' ,
buttonLoading : false ,
}
} ,
computed : {
@@ -169,6 +225,54 @@
} )
} ,
async handleCancelShip ( ) {
// 撤回发货
this . currentAction = 'withdrawShip' ;
const content = await this . getQRCodeContent ( )
let coilId = content . current _coil _id && content . current _coil _id !== 'null' ? content
. current _coil _id : null ;
if ( ! coilId ) {
uni . showToast ( {
title : '二维码异常' ,
icon : 'none'
} )
return ;
}
const coilRes = await getMaterialCoil ( coilId ) ;
if ( coilRes . data . status == 0 ) {
uni . showToast ( {
title : '钢卷还未发货' ,
icon : 'error'
} )
return ;
}
this . coilDetail = coilRes . data ;
this . $refs . shipPopup . open ( 'bottom' ) ;
} ,
async handleCancelShipSubmit ( ) {
if ( ! this . coilDetail . coilId ) {
uni . showToast ( {
title : '钢卷标识缺失' ,
icon : 'none'
} )
}
const res = await cancelExportCoil ( this . coilDetail . coilId )
console . log ( res )
if ( res . code != 200 ) {
uni . showToast ( {
icon : 'error' ,
title : res . message || '撤回失败请重试'
} )
return ;
}
uni . showToast ( {
icon : 'success' ,
title : this . coilDetail . currentCoilNo + '发货已撤回'
} )
this . $refs . shipPopup . close ( )
} ,
scan ( mode = 'camera' ) {
return new Promise ( ( resolve , reject ) => {
if ( mode == 'camera' ) {
@@ -393,68 +497,121 @@
} )
return ;
}
this . $refs . shipPopup . open ( 'bottom' ) ;
this . currentAction = 'ship' ;
this . coilDetail = coilRes . data
uni . showModal( {
cancelText: '取消' ,
confirmText: '确认' ,
title : '确定要将钢卷号为:' + coilRes . data . currentCoilNo + '发货吗?',
showCancel: true ,
success: async ( res ) => {
console. log ( res )
if ( res . cancel ) {
uni. showToast( {
title: '已取消发货',
icon: 'none'
} )
return;
}
try {
// 判断钢卷的质量状态, 必须是A+, A, A-, B+其中之一
if ( ! [ 'A+' , 'A' , 'A-' , 'B+' ] . includes( coilRes. data . qualityStatus) ) {
uni. showToast( {
title: '只能发货B+以上品质的钢卷',
icon: 'none'
} ) ;
return;
}
// 1. 更新钢卷状态为已发货
await exportCoil( coilRes. data . coilId ) ;
// uni. showModal({
// cancelText: '取消',
// confirmText: '确认',
// title: '确定要将钢卷号为:' + coilRes.data. currentCoilNo + '发货吗?',
// showCancel: true,
// success: async (res) => {
// console.log(res)
// if (res.cancel) {
// uni. showToast({
// title: '已取消发货',
// icon: 'none'
// })
// return;
// }
// try {
// // 判断钢卷的质量状态, 必须是A+, A, A-, B+其中之一
// if (!['A+', 'A', 'A-', 'B+']. includes( coilRes.data. qualityStatus)) {
// uni. showToast({
// title: '只能发货B+以上品质的钢卷',
// icon: 'none'
// });
// return;
// }
// // 1. 更新钢卷状态为已发货
// await exportCoil( coilRes.data.coilId);
// 2. 插入一条已完成的待操作记录
await addPendingAction( {
coilId: coilRes. data . coilId,
currentCoilNo: coilRes. data . currentCoilNo,
actionType: 402 , // 402=发货
actionStatus: 2 , // 直接标记为完成状态
scanTime: new Date ( ) ,
scanDevice: this . getDeviceInfo( ) ,
priority: 0 , // 0=普通
sourceType: 'scan',
warehouseId: coilRes. data . warehouseId,
processTime: new Date ( ) ,
completeTime: new Date ( )
} ) ;
// // 2. 插入一条已完成的待操作记录
// await addPendingAction({
// coilId: coilRes.data. coilId,
// currentCoilNo: coilRes.data. currentCoilNo,
// actionType: 402, // 402=发货
// actionStatus: 2, // 直接标记为完成状态
// scanTime: new Date(),
// scanDevice: this. getDeviceInfo(),
// priority: 0, // 0=普通
// sourceType: 'scan',
// warehouseId: coilRes.data. warehouseId,
// processTime: new Date(),
// completeTime: new Date()
// });
uni. showToast( {
title: '发货成功',
icon: 'none'
} ) ;
} catch ( error ) {
console. error ( '发货失败:' , error ) ;
uni. showToast( {
title: error ? . message || '发货失败',
icon: 'none'
} ) ;
}
} ,
fail ( ) {
// uni. showToast({
// title: '发货成功',
// icon: 'none'
// });
// } catch (error) {
// console.error('发货失败:', error);
// uni. showToast({
// title: error?.message || '发货失败',
// icon: 'none'
// });
// }
// },
// fail() {
// uni.showToast({
// title: '已取消发货',
// icon: 'none'
// })
// }
// });
// uni.hideLoading();
} ,
async handleShipSubmit ( ) {
try {
// 判断钢卷的质量状态, 必须是A+, A, A-, B+其中之一
if ( ! [ 'A+' , 'A' , 'A-' , 'B+' ] . includes ( this . coilDetail . qualityStatus ) ) {
uni . showToast ( {
title : '已取消发货 ' ,
title : '只能发货B+以上品质的钢卷 ' ,
icon : 'none'
} )
} ) ;
return ;
}
} ) ;
uni . hideLoading ( ) ;
// 1. 更新钢卷状态为已发货
const res = await exportCoil ( this . coilDetail . coilId ) ;
// 2. 插入一条已完成的待操作记录
await addPendingAction ( {
coilId : this . coilDetail . coilId ,
currentCoilNo : this . coilDetail . currentCoilNo ,
actionType : 402 , // 402=发货
actionStatus : 2 , // 直接标记为完成状态
scanTime : new Date ( ) ,
scanDevice : this . getDeviceInfo ( ) ,
priority : 0 , // 0=普通
sourceType : 'scan' ,
warehouseId : this . coilDetail . warehouseId ,
processTime : new Date ( ) ,
completeTime : new Date ( )
} ) ;
if ( res . code != 200 ) {
uni . showToast ( {
icon : 'error' ,
title : res . message || '发货失败请重试'
} )
return ;
}
uni . showToast ( {
title : '发货成功' ,
icon : 'success'
} ) ;
this . $refs . shipPopup . close ( )
} catch ( error ) {
console . error ( '发货失败:' , error ) ;
uni . showToast ( {
title : error ? . message || '发货失败' ,
icon : 'none'
} ) ;
}
} ,
// 移库操作:第一步 - 扫描钢卷,打开移库弹窗(原有方法优化)