|
|
@ -69,8 +69,8 @@ |
|
|
|
<uni-swipe-action-item @click="swipeClick($event,record,index)" |
|
|
|
:right-options="scanOptions"> |
|
|
|
<view style="padding: 0px 10px"> |
|
|
|
<balance :dataContent="record" :isShowFromLocation="false" :isShowStatus='true' |
|
|
|
:isShowStdPack="false"></balance> |
|
|
|
<balance :dataContent="record" :isShowFromLocation="false" |
|
|
|
:isShowStatus='true' :isShowStdPack="false"></balance> |
|
|
|
</view> |
|
|
|
</uni-swipe-action-item> |
|
|
|
</uni-swipe-action> |
|
|
@ -102,7 +102,8 @@ |
|
|
|
getDetailEditRemoveOption |
|
|
|
} from '@/common/array.js'; |
|
|
|
import { |
|
|
|
getWorkShopLineStation |
|
|
|
getWorkShopLineStation, |
|
|
|
getBalanceByFilter |
|
|
|
} from '@/api/request2.js'; |
|
|
|
|
|
|
|
import { |
|
|
@ -222,7 +223,6 @@ |
|
|
|
onScan(result) { |
|
|
|
try { |
|
|
|
let that = this; |
|
|
|
|
|
|
|
if (that.fromLocationCode == '') { |
|
|
|
that.showErrorMessage('请选择来源库位', res => { |
|
|
|
that.$refs.toLocationCombox.onFocus(); |
|
|
@ -242,22 +242,48 @@ |
|
|
|
) |
|
|
|
return; |
|
|
|
} else { |
|
|
|
//查找库存信息 |
|
|
|
uni.showLoading({ |
|
|
|
title: '加载中', |
|
|
|
mask: true |
|
|
|
}) |
|
|
|
|
|
|
|
this.getBalance(result.label, balances => { |
|
|
|
//扫描的是外包装 |
|
|
|
let s = ''; |
|
|
|
if (result.package.parentNumber == null || result.package.parentNumber == '') { |
|
|
|
if (balances.list.length == 0) { |
|
|
|
this.showErrorMessage('未查找到该包装的库存信息,请重新扫描') |
|
|
|
} else { |
|
|
|
let newBalances = balances.list.filter(b => b.locationCode ==that.fromLocationCode); |
|
|
|
if (newBalances.length == 0) { |
|
|
|
this.showErrorMessage('未查找到该包装的库存信息,请重新扫描') |
|
|
|
} else if (newBalances.length == 1) { |
|
|
|
let balance = newBalances[0]; |
|
|
|
this.afterGetBalance(result.label, balance, packageInfo); |
|
|
|
} else { |
|
|
|
this.showBalanceSelect(newBalances); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
//扫描的是小包装 |
|
|
|
if (balances.list.length == 0) { |
|
|
|
this.afterGetBalance(result.label, null, packageInfo); |
|
|
|
} else { |
|
|
|
this.showErrorMessage('该包装在库位【' + balances.list[0].locationCode + |
|
|
|
'】已经有库存余额,请重新扫描') |
|
|
|
} |
|
|
|
} |
|
|
|
uni.hideLoading(); |
|
|
|
}); |
|
|
|
|
|
|
|
this.afterGetBalance(result.label, result.label, packageInfo); |
|
|
|
|
|
|
|
// //查找库存信息 |
|
|
|
// uni.showLoading({ |
|
|
|
// title: '加载中', |
|
|
|
// mask: true |
|
|
|
// }) |
|
|
|
// getBalanceByManagementPrecision(result.label, that.fromLocationCode, that.fromInventoryStatuses, |
|
|
|
// balanceRes => { |
|
|
|
// if (balanceRes.success) { |
|
|
|
// let s = ''; |
|
|
|
// if (balanceRes.data.list.length == 0) { |
|
|
|
// this.showErrorMessage('在来源库位[' + this.fromLocationCode + '],未查找到该包装的库存记录', |
|
|
|
// res => { |
|
|
|
// this.packGetFocus(); |
|
|
|
// }) |
|
|
|
// this.afterGetBalance(result.label, null, packageInfo); |
|
|
|
// } else if (balanceRes.data.list.length == 1) { |
|
|
|
// let balance = balanceRes.data.list[0]; |
|
|
|
// this.afterGetBalance(result.label, balance, packageInfo); |
|
|
@ -275,6 +301,45 @@ |
|
|
|
uni.hideLoading(); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
getBalance(label, callback) { |
|
|
|
var filters = [] |
|
|
|
filters.push({ |
|
|
|
column: "packingNumber", |
|
|
|
action: "==", |
|
|
|
value: label.packingNumber |
|
|
|
}) |
|
|
|
filters.push({ |
|
|
|
column: "itemCode", |
|
|
|
action: "==", |
|
|
|
value: label.itemCode |
|
|
|
}) |
|
|
|
filters.push({ |
|
|
|
column: "batch", |
|
|
|
action: "==", |
|
|
|
value: label.batch |
|
|
|
}) |
|
|
|
|
|
|
|
if (this.fromInventoryStatuses != null && this.fromInventoryStatuses != "") { |
|
|
|
filters.push({ |
|
|
|
column: "inventoryStatus", |
|
|
|
action: "in", |
|
|
|
value: this.fromInventoryStatuses |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
var params = { |
|
|
|
filters: filters, |
|
|
|
pageNo: 1, |
|
|
|
pageSize: 100, |
|
|
|
} |
|
|
|
getBalanceByFilter(params).then(res => { |
|
|
|
callback(res.data) |
|
|
|
}).catch(err => { |
|
|
|
this.showErrorMessage(err.message); |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
selectBalanceItem(balance) { |
|
|
|
this.afterGetBalance(this.label, balance); |
|
|
|
}, |
|
|
@ -297,14 +362,14 @@ |
|
|
|
let record = batch.Records.find(r => r.packingNumber == packingCode); |
|
|
|
if (record == undefined) { |
|
|
|
//如果有推荐箱码 |
|
|
|
if (batch.Recommends!=undefined && batch.Recommends.length > 0) { |
|
|
|
if (batch.Recommends != undefined && batch.Recommends.length > 0) { |
|
|
|
let recommend = batch.Recommends.find(r => r.packingNumber == packingCode); |
|
|
|
if (recommend != undefined) { |
|
|
|
that.addRecord(batch, label, packageInfo) |
|
|
|
that.addRecord(batch, label, balance, packageInfo) |
|
|
|
} else { |
|
|
|
//允许修改箱码 |
|
|
|
if (this.jobContent.allowModifyPackingNumber == 'TRUE') { |
|
|
|
that.addRecord(batch, label, packageInfo); |
|
|
|
that.addRecord(batch, label, balance, packageInfo); |
|
|
|
} else { |
|
|
|
that.showErrorMessage('未查找到该箱码【' + packingCode + '】的明细', |
|
|
|
res => { |
|
|
@ -314,7 +379,7 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
that.addRecord(batch, label, packageInfo) |
|
|
|
that.addRecord(batch, label, balance, packageInfo) |
|
|
|
} |
|
|
|
} else { |
|
|
|
that.showErrorMessage('箱码【' + packingCode + '】已经扫描,请继续扫描下一箱', |
|
|
@ -325,7 +390,6 @@ |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (this.jobContent.allowModifyBatch == "TRUE") { |
|
|
|
|
|
|
|
this.showQuestionMessage('在【' + that.fromLocationCode + '】库位下,批次【' + lot + |
|
|
|
'】不是推荐批次,是否要继续发料?', res => { |
|
|
|
if (res) { |
|
|
@ -351,29 +415,37 @@ |
|
|
|
) |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
that.showErrorMessage(e.stack, |
|
|
|
this.showErrorMessage(e.stack, |
|
|
|
res => { |
|
|
|
that.getfocus(); |
|
|
|
this.getfocus(); |
|
|
|
} |
|
|
|
) |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
createBatchInfo(data, balance, packageInfo) { |
|
|
|
createBatchInfo(label, balance, packageInfo) { |
|
|
|
let batch = { |
|
|
|
batch: data.batch, |
|
|
|
batch: label.batch, |
|
|
|
qty: 0, |
|
|
|
uom: data.uom, |
|
|
|
handleQty: Number(data.qty), |
|
|
|
uom: label.uom, |
|
|
|
|
|
|
|
Records: [] |
|
|
|
} |
|
|
|
let record = this.creatRecord(data, packageInfo); |
|
|
|
let record = {} |
|
|
|
if (balance == null) { |
|
|
|
record = this.creatRecordByBalance(label, packageInfo); |
|
|
|
batch.handleQty = Number(label.qty) |
|
|
|
} else { |
|
|
|
record = this.creatRecordByLabel(balance, packageInfo); |
|
|
|
batch.handleQty = Number(balance.qty) |
|
|
|
} |
|
|
|
|
|
|
|
batch.Records.push(record); |
|
|
|
this.issueRecord.unshift(record) |
|
|
|
return batch; |
|
|
|
}, |
|
|
|
|
|
|
|
creatRecord(label, packageInfo) { |
|
|
|
creatRecordByLabel(label, packageInfo) { |
|
|
|
let record = { |
|
|
|
scaned: true, |
|
|
|
itemCode: label.itemCode, |
|
|
@ -387,32 +459,30 @@ |
|
|
|
balance: null, |
|
|
|
toLocationCode: this.toLocationCode, |
|
|
|
supplierCode: label.supplierCode, |
|
|
|
packUnit:packageInfo.packUnit, |
|
|
|
packQty:packageInfo.packQty |
|
|
|
packUnit: packageInfo.packUnit, |
|
|
|
packQty: packageInfo.packQty |
|
|
|
} |
|
|
|
return record; |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// creatRecord(label, balance, packageInfo) { |
|
|
|
// balance.packQty = packageInfo.packQty |
|
|
|
// balance.packUnit = packageInfo.packUnit |
|
|
|
// let record = { |
|
|
|
// scaned: true, |
|
|
|
// itemCode: label.itemCode, |
|
|
|
// packingNumber: label.packingNumber, |
|
|
|
// batch: label.batch, |
|
|
|
// qty: Number(balance.qty), |
|
|
|
// // qty: Number(label.qty)>Number(balance.qty)?Number(balance.qty):Number(label.qty), |
|
|
|
// uom: balance.uom, |
|
|
|
// inventoryStatus: balance.inventoryStatus, |
|
|
|
// balance: balance, |
|
|
|
// toLocationCode: this.toLocationCode, |
|
|
|
// supplierCode: label.supplierCode |
|
|
|
// } |
|
|
|
// return record; |
|
|
|
// }, |
|
|
|
creatRecordByBalance(balance, packageInfo) { |
|
|
|
balance.packQty = packageInfo.packQty |
|
|
|
balance.packUnit = packageInfo.packUnit |
|
|
|
let record = { |
|
|
|
scaned: true, |
|
|
|
itemCode: balance.itemCode, |
|
|
|
packingNumber: balance.packingNumber, |
|
|
|
batch: balance.batch, |
|
|
|
qty: Number(balance.qty), |
|
|
|
// qty: Number(label.qty)>Number(balance.qty)?Number(balance.qty):Number(label.qty), |
|
|
|
uom: balance.uom, |
|
|
|
inventoryStatus: balance.inventoryStatus, |
|
|
|
balance: balance, |
|
|
|
toLocationCode: this.toLocationCode, |
|
|
|
supplierCode: balance.supplierCode |
|
|
|
} |
|
|
|
return record; |
|
|
|
}, |
|
|
|
|
|
|
|
calcBatchHandleQty(batch) { |
|
|
|
let handleQty = 0; |
|
|
@ -436,8 +506,13 @@ |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
addRecord(batch, label, packageInfo) { |
|
|
|
let record = this.creatRecord(label, packageInfo); |
|
|
|
addRecord(batch, label, balance, packageInfo) { |
|
|
|
let record = {}; |
|
|
|
if (balance == null) { |
|
|
|
record = this.creatRecordByLabel(label, packageInfo); |
|
|
|
} else { |
|
|
|
record = this.creatRecordByBalance(balance, packageInfo); |
|
|
|
} |
|
|
|
batch.Records.push(record); |
|
|
|
this.issueRecord.unshift(record) |
|
|
|
this.calcBatchHandleQty(batch); |
|
|
|