logwire-wms-ui-test
Version:
运匠科技wms-PDA基础组件库
208 lines (176 loc) • 4.94 kB
JavaScript
/*
* 出库交接 - 执行 - 混入
* @author: 张文
* @date 2022-07-14
* */
import {
projectWmsOutboundGetHandoverBoxData,
projectWmsOutboundGetValueGroupCustomerHandoverData,
projectWmsOutboundGetValueGroupHandoverData,
projectWmsOutboundHandoverSubmit
} from "../../../../api/outbound/handover/mixin";
export const action = {
data(){
return {
// tab激活项
tabActive: 'ing',
// 路由传参数据
routeQuery:{},
// 线路信息
lineData:{},
// 店铺列表数据
customer:{
list:[],
pageTotal: 0,
pageNum: 1
},
// 捆包箱号
box:{
value: '',
focus: true
},
// 当前扫描数据
nowScanData:{},
// 是否显示呼吸动画
showMove: false,
// 已交接捆包箱列表
boxList:[],
// 查看线路交接箱信息弹框
boxDataPopup:{
show: false,
showCom: false,
tabActive:'wait',
}
}
},
mounted(){
const query = this.$route.query
this.routeQuery = {
tabGroupKey: query.lwTabGroupKey,
valueGroupKey: query.lwValueGroupKey
}
this.init()
},
methods:{
// 初始化
init(){
this.getLineData()
this.customer.pageNum = 1
this.getCustomerData({
pageNum: this.customer.pageNum,
pageSize: this.customer.pageSize
})
// 判断是否是托盘交接
if (this.isLpnHandover) {
this.lpnList.pageNum = 1
this.getLpnList()
}
this.clearScanData()
},
// 获取线路数据
getLineData(){
projectWmsOutboundGetValueGroupHandoverData(this.routeQuery).then(res=>{
this.lineData = res || {}
})
},
// 获取客户数据
getCustomerData(page) {
projectWmsOutboundGetValueGroupCustomerHandoverData({
...this.routeQuery,
...page
}).then(res=>{
this.customer.pageTotal = res.total
this.customer.list = res.datas
})
},
// 捆包箱号确认
boxConfirm(){
this.showMove = false
const boxNo = this.box.value
if (!boxNo){
this.box.focus = true
this.$lwShowErrorMsg(
this.$lwLanguage.get('wms_project.pda.components.page.outbound.handover.mixin.boxNull','捆包箱号不能为空')
)
return
}
if (this.boxList.filter(item=>item.boxNo===boxNo).length){
this.box.focus = true
this.$lwShowErrorMsg(
this.$lwLanguage.get('wms_project.pda.components.page.outbound.handover.mixin.boxErr','当前箱已在交接列表中')
)
this.box.value = ''
return
}
projectWmsOutboundGetHandoverBoxData({
...this.routeQuery,
boxNo,
customerCode: this.nowScanData.customerCode,
customerName: this.nowScanData.customerName,
handoverType: this.handoverType
}).then(res=>{
this.checkBlock(res)
})
},
// 校验是否被拦截
checkBlock(res){
// 没有被拦截
if (res.blockStatus === 0){
this.nowScanData = res
this.showMove = true
this.boxList.unshift(res)
this.box.focus = true
this.box.value = ''
return
}
this.$refs.pageBox.blockType(res)
},
// 重新扫描按钮被点击
repeatScanBtn(){
this.clearScanData()
this.$lwToast.success(
this.$lwLanguage.get('wms_project.pda.components.page.outbound.handover.mixin.success','操作成功')
)
},
// 确认交接 - 提交数据
handoverSubmit(loc) {
let boxList = []
if (this.isLpnHandover){
this.boxList.forEach(item=>{
boxList = boxList.concat(item.boxList)
})
}else {
boxList = this.boxList
}
console.log(boxList,'boxList')
projectWmsOutboundHandoverSubmit({
...this.routeQuery,
actualCollectLocation: loc,
boxList
}).then(()=>{
this.$lwToast.success(
this.$lwLanguage.get('wms_project.pda.components.page.outbound.handover.mixin.handover','交接成功')
)
this.$refs.pageBox.handoverPopup.show = false
this.init()
})
},
// 清空已扫描数据
clearScanData(){
this.box.focus = true
this.showMove = false
this.nowScanData = {}
this.boxList = []
},
// 店铺列表 - 店铺点击
showBoxNoPopup(item){
console.log(item,112233)
this.boxDataPopup.query = {
...this.routeQuery,
customerCode: item.customerCode
}
this.boxDataPopup.showCom = true
this.boxDataPopup.show = true
}
}
}