|
|
@ -60,7 +60,7 @@ import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue' |
|
|
|
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' |
|
|
|
|
|
|
|
import { getDetailOption, getDetailEditRemoveOption } from '@/common/array.js' |
|
|
|
import { getWorkShopLineStation, getBalanceByFilter } from '@/api/request2.js' |
|
|
|
import { getWorkShopLineStation, getBalanceByFilter,getBalanceByParams } from '@/api/request2.js' |
|
|
|
import { uniqueArray } from '@/common/basic.js' |
|
|
|
|
|
|
|
import { calc } from '@/common/calc.js' |
|
|
@ -99,6 +99,7 @@ const label = ref({}) |
|
|
|
const inputStyleObject = ref({ |
|
|
|
fontSize: '100rpx' |
|
|
|
}) |
|
|
|
const bussinessCode = ref('Issue') |
|
|
|
const toLocationCombox = ref() |
|
|
|
const comscansimulate = ref() |
|
|
|
const comMessageRef = ref() |
|
|
@ -155,7 +156,7 @@ const showBalanceSelect = (items) => { |
|
|
|
} |
|
|
|
|
|
|
|
const getFromLocationList = () => { |
|
|
|
const list = [] |
|
|
|
let list = [] |
|
|
|
dataContent.value.forEach((location) => { |
|
|
|
location.Items.forEach((item) => { |
|
|
|
item.Locations.forEach((f) => { |
|
|
@ -198,78 +199,116 @@ const onScanResult = (result) => { |
|
|
|
getfocus() |
|
|
|
}) |
|
|
|
return |
|
|
|
}else { |
|
|
|
queryBalance(result) |
|
|
|
} |
|
|
|
// 查找库存信息 |
|
|
|
uni.showLoading({ |
|
|
|
title: '加载中', |
|
|
|
mask: true |
|
|
|
}) |
|
|
|
|
|
|
|
getBalance(result.label, packageInfoParams, (balances) => { |
|
|
|
packageInfo.value = packageInfoParams |
|
|
|
// 扫描的是外包装 |
|
|
|
const s = '' |
|
|
|
if (!result.package.parentNumber) { |
|
|
|
if (balances.list.length == 0) { |
|
|
|
showErrorMessage('未查找到该包装的库存信息,请重新扫描') |
|
|
|
} else { |
|
|
|
const newBalances = balances.list.filter((b) => b.locationCode == fromLocationCode.value) |
|
|
|
if (newBalances.length == 0) { |
|
|
|
showErrorMessage('未查找到该包装的库存信息,请重新扫描') |
|
|
|
} else if (newBalances.length == 1) { |
|
|
|
const balance = newBalances[0] |
|
|
|
afterGetBalance(result.label, balance, packageInfoParams) |
|
|
|
} else { |
|
|
|
showBalanceSelect(newBalances) |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 扫描的是小包装 |
|
|
|
if (balances.list.length == 0) { |
|
|
|
showErrorMessage('未查找到该包装的库存信息,请重新扫描') |
|
|
|
} else { |
|
|
|
// 小包装库存 |
|
|
|
const subPackitems = balances.list.filter((r) => r.packingNumber == packageInfoParams.number) |
|
|
|
// 外包装库存 |
|
|
|
const subParentPackitems = balances.list.filter((r) => r.packingNumber == packageInfoParams.parentNumber && r.locationCode == fromLocationCode.value) |
|
|
|
|
|
|
|
// 小包装没有库存, |
|
|
|
if (subPackitems.length == 0) { |
|
|
|
// 外包装有库存,出库后剩余库存未转换为出库包装规格 |
|
|
|
|
|
|
|
if (subParentPackitems.length > 0) { |
|
|
|
if (subParentPackitems.length == 1) { |
|
|
|
const balance = subParentPackitems[0] |
|
|
|
balance.qty = packageInfoParams.qty |
|
|
|
afterGetBalance(result.label, balance, packageInfo) |
|
|
|
} else { |
|
|
|
showBalanceSelect(subParentPackitems) |
|
|
|
} |
|
|
|
} else { |
|
|
|
showErrorMessage(`按外包装【${packageInfoParams.parentNumber}】和子包装【${packageInfoParams.number}】都未查找到库存余额`) |
|
|
|
} |
|
|
|
} else { |
|
|
|
let locationCode = fromLocationCode.value |
|
|
|
if (balances.list == 1) { |
|
|
|
locationCode = balances.list[0].locationCode |
|
|
|
} else { |
|
|
|
const manyBlances = balances.list.filter((r) => r.locationCode != fromLocationCode.value) |
|
|
|
if (manyBlances.length > 0) { |
|
|
|
locationCode = manyBlances[0].locationCode |
|
|
|
} |
|
|
|
} |
|
|
|
showErrorMessage(`该包装【${packageInfoParams.number}】在库位【${locationCode}】已经有库存余额,请重新扫描`) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
uni.hideLoading() |
|
|
|
}) |
|
|
|
// getBalance(result.label, packageInfoParams, (balances) => { |
|
|
|
// packageInfo.value = packageInfoParams |
|
|
|
// // 扫描的是外包装 |
|
|
|
// const s = '' |
|
|
|
// if (!result.package.parentNumber) { |
|
|
|
// if (balances.list.length == 0) { |
|
|
|
// showErrorMessage('未查找到该包装的库存信息,请重新扫描') |
|
|
|
// } else { |
|
|
|
// const newBalances = balances.list.filter((b) => b.locationCode == fromLocationCode.value) |
|
|
|
// if (newBalances.length == 0) { |
|
|
|
// showErrorMessage('未查找到该包装的库存信息,请重新扫描') |
|
|
|
// } else if (newBalances.length == 1) { |
|
|
|
// const balance = newBalances[0] |
|
|
|
// afterGetBalance(result.label, balance, packageInfoParams) |
|
|
|
// } else { |
|
|
|
// showBalanceSelect(newBalances) |
|
|
|
// } |
|
|
|
// } |
|
|
|
// } else { |
|
|
|
// // 扫描的是小包装 |
|
|
|
// if (balances.list.length == 0) { |
|
|
|
// showErrorMessage('未查找到该包装的库存信息,请重新扫描') |
|
|
|
// } else { |
|
|
|
// // 小包装库存 |
|
|
|
// const subPackitems = balances.list.filter((r) => r.packingNumber == packageInfoParams.number) |
|
|
|
// // 外包装库存 |
|
|
|
// const subParentPackitems = balances.list.filter((r) => r.packingNumber == packageInfoParams.parentNumber && r.locationCode == fromLocationCode.value) |
|
|
|
// |
|
|
|
// // 小包装没有库存, |
|
|
|
// if (subPackitems.length == 0) { |
|
|
|
// // 外包装有库存,出库后剩余库存未转换为出库包装规格 |
|
|
|
// |
|
|
|
// if (subParentPackitems.length > 0) { |
|
|
|
// if (subParentPackitems.length == 1) { |
|
|
|
// const balance = subParentPackitems[0] |
|
|
|
// balance.qty = packageInfoParams.qty |
|
|
|
// afterGetBalance(result.label, balance, packageInfo) |
|
|
|
// } else { |
|
|
|
// showBalanceSelect(subParentPackitems) |
|
|
|
// } |
|
|
|
// } else { |
|
|
|
// showErrorMessage(`按外包装【${packageInfoParams.parentNumber}】和子包装【${packageInfoParams.number}】都未查找到库存余额`) |
|
|
|
// } |
|
|
|
// } else { |
|
|
|
// let locationCode = fromLocationCode.value |
|
|
|
// if (balances.list == 1) { |
|
|
|
// locationCode = balances.list[0].locationCode |
|
|
|
// } else { |
|
|
|
// const manyBlances = balances.list.filter((r) => r.locationCode != fromLocationCode.value) |
|
|
|
// if (manyBlances.length > 0) { |
|
|
|
// locationCode = manyBlances[0].locationCode |
|
|
|
// } |
|
|
|
// } |
|
|
|
// showErrorMessage(`该包装【${packageInfoParams.number}】在库位【${locationCode}】已经有库存余额,请重新扫描`) |
|
|
|
// } |
|
|
|
// } |
|
|
|
// } |
|
|
|
// uni.hideLoading() |
|
|
|
// }) |
|
|
|
} catch (e) { |
|
|
|
showErrorMessage(e.stack) |
|
|
|
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 = 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 filters = [] |
|
|
|
|
|
|
|