|
@ -66,7 +66,7 @@ import { uniqueArray } from '@/common/basic.js' |
|
|
import { calc } from '@/common/calc.js' |
|
|
import { calc } from '@/common/calc.js' |
|
|
|
|
|
|
|
|
import { getBalanceByManagementPrecision } from '@/common/balance.js' |
|
|
import { getBalanceByManagementPrecision } from '@/common/balance.js' |
|
|
import { getDirectoryItemArray } from '../../../common/directory.js' |
|
|
import { getDirectoryItemArray,getInventoryStatusDesc,getListLocationAreaTypeDesc } from '../../../common/directory.js' |
|
|
import { getLabelInfo } from '@/common/label.js' |
|
|
import { getLabelInfo } from '@/common/label.js' |
|
|
|
|
|
|
|
|
const { proxy } = getCurrentInstance() |
|
|
const { proxy } = getCurrentInstance() |
|
@ -200,7 +200,51 @@ const onScanResult = (result) => { |
|
|
}) |
|
|
}) |
|
|
return |
|
|
return |
|
|
}else { |
|
|
}else { |
|
|
queryBalance(result) |
|
|
let params = { |
|
|
|
|
|
itemCode: result.package.itemCode, |
|
|
|
|
|
batch: result.label.batch, |
|
|
|
|
|
packingNumber: result.label.packingNumber, |
|
|
|
|
|
parentPackingNumber: result.package.parentNumber, |
|
|
|
|
|
inventoryStatus: jobContent.value.outInventoryStatuses.split(','), |
|
|
|
|
|
areaType: jobContent.value.fromAreaTypes.split(','), |
|
|
|
|
|
bussinessCode: jobContent.value.businessType |
|
|
|
|
|
} |
|
|
|
|
|
uni.showLoading({ |
|
|
|
|
|
title: '查询中', |
|
|
|
|
|
mask: true |
|
|
|
|
|
}) |
|
|
|
|
|
getBalanceByParams(params).then(res => { |
|
|
|
|
|
if (res.data.length == 0) { |
|
|
|
|
|
let status = getInventoryStatusDesc(params.inventoryStatus) |
|
|
|
|
|
let areaType = getListLocationAreaTypeDesc(params.areaType) |
|
|
|
|
|
let hint = |
|
|
|
|
|
"按物料号 [" + params.itemCode + "] <br>" + |
|
|
|
|
|
"包装号 [" + params.packingNumber + "] <br>" + |
|
|
|
|
|
"批次 [" + params.batch + "] <br>" + |
|
|
|
|
|
"状态 [" + status + "] <br>" + |
|
|
|
|
|
"库区 [" + areaType + "] <br>" + |
|
|
|
|
|
"未查找到库存余额" |
|
|
|
|
|
showErrorMessage(hint) |
|
|
|
|
|
} else if (res.data.length == 1) { |
|
|
|
|
|
result.balance = res.data[0] |
|
|
|
|
|
|
|
|
|
|
|
if (result.label.packingNumber != result.balance.packingNumber) { |
|
|
|
|
|
result.balance.handleQty = Number(result.label.qty) |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
result.balance.handleQty = Number(result.balance.qty) |
|
|
|
|
|
} |
|
|
|
|
|
afterGetBalance(result.label, result.balance, result.package); |
|
|
|
|
|
} else { |
|
|
|
|
|
//多条记录 |
|
|
|
|
|
balanceSelectRef.value.openPopup(res.data); |
|
|
|
|
|
} |
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
}).catch(error => { |
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
showErrorMessage(error) |
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
// getBalance(result.label, packageInfoParams, (balances) => { |
|
|
// getBalance(result.label, packageInfoParams, (balances) => { |
|
|
// packageInfo.value = packageInfoParams |
|
|
// packageInfo.value = packageInfoParams |
|
@ -266,49 +310,6 @@ const onScanResult = (result) => { |
|
|
uni.hideLoading() |
|
|
uni.hideLoading() |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
const queryBalance = (result)=>{ |
|
|
|
|
|
var params = { |
|
|
|
|
|
itemCode: result.package.itemCode, |
|
|
|
|
|
batch: result.label.batch, |
|
|
|
|
|
packingNumber: result.label.packingNumber, |
|
|
|
|
|
parentPackingNumber: result.package.parentNumber, |
|
|
|
|
|
inventoryStatus: jobContent.value.outInventoryStatuses.split(','), |
|
|
|
|
|
areaType:jobContent.value.fromAreaTypes.split(','), |
|
|
|
|
|
bussinessCode:jobContent.value.businessType |
|
|
|
|
|
} |
|
|
|
|
|
uni.showLoading({ |
|
|
|
|
|
title: '查询中', |
|
|
|
|
|
mask: true |
|
|
|
|
|
}) |
|
|
|
|
|
getBalanceByParams(params).then(res => { |
|
|
|
|
|
if (res.data.length == 0) { |
|
|
|
|
|
var status = getInventoryStatusDesc(params.inventoryStatus) |
|
|
|
|
|
var areaType = getListLocationAreaTypeDesc(params.areaType) |
|
|
|
|
|
var hint = |
|
|
|
|
|
"按物料号 [" + params.itemCode + "] <br>" + |
|
|
|
|
|
"包装号 [" + params.packingNumber + "] <br>" + |
|
|
|
|
|
"批次 [" + params.batch + "] <br>" + |
|
|
|
|
|
"状态 [" + status + "] <br>" + |
|
|
|
|
|
"库区 [" + areaType + "] <br>" + |
|
|
|
|
|
"未查找到库存余额" |
|
|
|
|
|
this.showErrorMessage(hint) |
|
|
|
|
|
} else if (res.data.length == 1) { |
|
|
|
|
|
|
|
|
|
|
|
result.balance = res.data[0] |
|
|
|
|
|
if (result.label.packingNumber != result.balance.packingNumber) { |
|
|
|
|
|
result.balance.lableQty = Number(result.label.qty) |
|
|
|
|
|
} |
|
|
|
|
|
this.afterGetBalance(result.label, result.balance, result.package); |
|
|
|
|
|
} else { |
|
|
|
|
|
//多条记录 |
|
|
|
|
|
this.$refs.balanceSelect.openPopup(res.data); |
|
|
|
|
|
} |
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
}).catch(error => { |
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
this.showErrorMessage(error) |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
const getBalance = (label, packageInfoParams, callback) => { |
|
|
const getBalance = (label, packageInfoParams, callback) => { |
|
|
const filters = [] |
|
|
const filters = [] |
|
|
|
|
|
|
|
@ -450,7 +451,7 @@ const afterGetBalance = (label, balance, packageInfo) => { |
|
|
const record = batch.Records.find((r) => r.packingNumber == packingCode) |
|
|
const record = batch.Records.find((r) => r.packingNumber == packingCode) |
|
|
if (record == undefined) { |
|
|
if (record == undefined) { |
|
|
// 如果有推荐箱码 |
|
|
// 如果有推荐箱码 |
|
|
if (batch.Recommends.length > 0) { |
|
|
if (batch.Recommends != undefined &&batch.Recommends.length > 0) { |
|
|
const recommend = batch.Recommends.find((r) => r.packingNumber == packingCode) |
|
|
const recommend = batch.Recommends.find((r) => r.packingNumber == packingCode) |
|
|
if (recommend != undefined) { |
|
|
if (recommend != undefined) { |
|
|
addRecord(batch, label, balance, packageInfo) |
|
|
addRecord(batch, label, balance, packageInfo) |
|
@ -507,7 +508,7 @@ const createBatchInfo = (data, balance, packageInfo) => { |
|
|
batch: data.batch, |
|
|
batch: data.batch, |
|
|
qty: 0, |
|
|
qty: 0, |
|
|
uom: data.uom, |
|
|
uom: data.uom, |
|
|
handleQty: Number(data.qty), |
|
|
handleQty: Number(balance.handleQty), |
|
|
Records: [] |
|
|
Records: [] |
|
|
} |
|
|
} |
|
|
const record = creatRecord(data, balance, packageInfo) |
|
|
const record = creatRecord(data, balance, packageInfo) |
|
@ -526,7 +527,8 @@ const creatRecord = (label, balance, packageInfo) => { |
|
|
batch: label.batch, |
|
|
batch: label.batch, |
|
|
// qty: Number(balance.qty), |
|
|
// qty: Number(balance.qty), |
|
|
// qty: Number(label.qty) > Number(balance.qty) ? Number(balance.qty) : Number(label.qty), |
|
|
// qty: Number(label.qty) > Number(balance.qty) ? Number(balance.qty) : Number(label.qty), |
|
|
qty: balance.qty ?? Number(label.qty), |
|
|
qty: balance.handleQty, |
|
|
|
|
|
handleQty:balance.handleQty, |
|
|
uom: balance.uom, |
|
|
uom: balance.uom, |
|
|
inventoryStatus: balance.inventoryStatus, |
|
|
inventoryStatus: balance.inventoryStatus, |
|
|
balance, |
|
|
balance, |
|
|