|
@ -8,7 +8,7 @@ |
|
|
<text class="fr" @click="closeScanPopup()">关闭</text> |
|
|
<text class="fr" @click="closeScanPopup()">关闭</text> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
<view class="uni-flex uni-row" style="align-items: center; |
|
|
<!-- <view class="uni-flex uni-row" style="align-items: center; |
|
|
background-color: #fff; |
|
|
background-color: #fff; |
|
|
margin-left: 20rpx; |
|
|
margin-left: 20rpx; |
|
|
margin-right: 20rpx; |
|
|
margin-right: 20rpx; |
|
@ -21,7 +21,7 @@ |
|
|
<uni-combox :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请选择库位" |
|
|
<uni-combox :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请选择库位" |
|
|
@confirm="fromLocationUpdate"></uni-combox> |
|
|
@confirm="fromLocationUpdate"></uni-combox> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> --> |
|
|
|
|
|
|
|
|
<view class=""> |
|
|
<view class=""> |
|
|
<view class=""> |
|
|
<view class=""> |
|
@ -83,7 +83,8 @@ |
|
|
} from '@/common/array.js'; |
|
|
} from '@/common/array.js'; |
|
|
import { |
|
|
import { |
|
|
getWorkShopLineStation, |
|
|
getWorkShopLineStation, |
|
|
getBalanceByFilter |
|
|
getBalanceByFilter, |
|
|
|
|
|
getBalanceByParams |
|
|
} from '@/api/request2.js'; |
|
|
} from '@/api/request2.js'; |
|
|
|
|
|
|
|
|
import { |
|
|
import { |
|
@ -163,7 +164,7 @@ |
|
|
}, 500) |
|
|
}, 500) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
openScanPopupForJobSimulate(content, jobcontent,scanMessage) { |
|
|
openScanPopupForJobSimulate(content, jobcontent, scanMessage) { |
|
|
this.issueRecord = []; |
|
|
this.issueRecord = []; |
|
|
this.dataContent = content; |
|
|
this.dataContent = content; |
|
|
this.jobContent = jobcontent; |
|
|
this.jobContent = jobcontent; |
|
@ -192,7 +193,7 @@ |
|
|
that.fromInventoryStatuses = this.jobContent.outInventoryStatuses |
|
|
that.fromInventoryStatuses = this.jobContent.outInventoryStatuses |
|
|
that.toLocation = that.dataContent[0]; |
|
|
that.toLocation = that.dataContent[0]; |
|
|
that.toLocationCode = that.dataContent[0].toLocationCode; |
|
|
that.toLocationCode = that.dataContent[0].toLocationCode; |
|
|
that.fromLocationList = that.getFromLocationList(); |
|
|
// that.fromLocationList = that.getFromLocationList(); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
@ -200,26 +201,26 @@ |
|
|
this.$refs.balanceSelect.openPopup(items); |
|
|
this.$refs.balanceSelect.openPopup(items); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
getFromLocationList() { |
|
|
// getFromLocationList() { |
|
|
let list = []; |
|
|
// let list = []; |
|
|
let location = this.dataContent.find(r => r.toLocationCode == this.toLocationCode); |
|
|
// let location = this.dataContent.find(r => r.toLocationCode == this.toLocationCode); |
|
|
if (location != undefined) { |
|
|
// if (location != undefined) { |
|
|
location.Items.forEach(item => { |
|
|
// location.Items.forEach(item => { |
|
|
item.Locations.forEach(f => { |
|
|
// item.Locations.forEach(f => { |
|
|
list.push(f.fromLocationCode) |
|
|
// list.push(f.fromLocationCode) |
|
|
}) |
|
|
// }) |
|
|
}) |
|
|
// }) |
|
|
//去掉重复库位 |
|
|
// //去掉重复库位 |
|
|
list = uniqueArray(list); |
|
|
// list = uniqueArray(list); |
|
|
this.fromLocationCode = list[0]; |
|
|
// this.fromLocationCode = list[0]; |
|
|
|
|
|
|
|
|
return list; |
|
|
// return list; |
|
|
} else { |
|
|
// } else { |
|
|
this.$refs.comMessage.showErrorMessages('需求库位【' + this.toLocationCode + '】不存在', res => { |
|
|
// this.$refs.comMessage.showErrorMessages('需求库位【' + this.toLocationCode + '】不存在', res => { |
|
|
this.toLocationCode = ''; |
|
|
// this.toLocationCode = ''; |
|
|
}); |
|
|
// }); |
|
|
} |
|
|
// } |
|
|
}, |
|
|
// }, |
|
|
|
|
|
|
|
|
fromLocationUpdate(fromlocation) { |
|
|
fromLocationUpdate(fromlocation) { |
|
|
let location = this.fromLocationList.find(r => r == fromlocation) |
|
|
let location = this.fromLocationList.find(r => r == fromlocation) |
|
@ -228,15 +229,44 @@ |
|
|
this.showErrorMessage('发料库位【' + fromlocation + '】不存在') |
|
|
this.showErrorMessage('发料库位【' + fromlocation + '】不存在') |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
onScan(result) { |
|
|
onScan(result) { |
|
|
try { |
|
|
if (!result.package) { |
|
|
let that = this; |
|
|
this.showErrorMessage('扫描数据错误[' + result.label.code + "]", |
|
|
if (that.fromLocationCode == '') { |
|
|
res => { |
|
|
that.showErrorMessage('请选择来源库位', res => { |
|
|
this.getfocus(); |
|
|
that.$refs.toLocationCombox.onFocus(); |
|
|
} |
|
|
}); |
|
|
) |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
if (this.toLocation && result.package.packUnit) { |
|
|
|
|
|
let item = this.toLocation.Items.find(r => r.itemCode == result.package.itemCode); |
|
|
|
|
|
if (!item) { |
|
|
|
|
|
this.showErrorMessage('扫描物料代码不属于该任务'); |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
if (result.package.packUnit !== item.packUnit) { |
|
|
|
|
|
this.$refs.comMessage.showQuestionMessage( |
|
|
|
|
|
`扫描物料包装【${result.package.packUnit}】与任务推荐包装规格【${item.packUnit}】不一致.是否要继续发料?`, res => { |
|
|
|
|
|
if (res) { |
|
|
|
|
|
this.onScanResult(result) |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} else { |
|
|
|
|
|
this.onScanResult(result) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
onScanResult(result) { |
|
|
|
|
|
try { |
|
|
|
|
|
let that = this; |
|
|
|
|
|
// if (that.fromLocationCode == '') { |
|
|
|
|
|
// that.showErrorMessage('请选择来源库位', res => { |
|
|
|
|
|
// that.$refs.toLocationCombox.onFocus(); |
|
|
|
|
|
// }); |
|
|
|
|
|
// return; |
|
|
|
|
|
// } |
|
|
let packageInfo = result.package; |
|
|
let packageInfo = result.package; |
|
|
let itemCode = result.label.itemCode; |
|
|
let itemCode = result.label.itemCode; |
|
|
let packingCode = result.label.packingNumber; |
|
|
let packingCode = result.label.packingNumber; |
|
@ -250,115 +280,50 @@ |
|
|
) |
|
|
) |
|
|
return; |
|
|
return; |
|
|
} else { |
|
|
} else { |
|
|
//查找库存信息 |
|
|
|
|
|
|
|
|
var params = { |
|
|
|
|
|
itemCode: result.package.itemCode, |
|
|
|
|
|
batch: result.label.batch, |
|
|
|
|
|
packingNumber: result.label.packingNumber, |
|
|
|
|
|
parentPackingNumber: result.package.parentNumber, |
|
|
|
|
|
inventoryStatus: this.jobContent.outInventoryStatuses.split(','), |
|
|
|
|
|
areaType: this.jobContent.fromAreaTypes.split(','), |
|
|
|
|
|
bussinessCode: this.jobContent.businessType |
|
|
|
|
|
} |
|
|
uni.showLoading({ |
|
|
uni.showLoading({ |
|
|
title: '加载中', |
|
|
title: '查询中', |
|
|
mask: true |
|
|
mask: true |
|
|
}) |
|
|
}) |
|
|
|
|
|
getBalanceByParams(params).then(res => { |
|
|
this.getBalance(result.label, packageInfo, balances => { |
|
|
if (res.data.length == 0) { |
|
|
this.packageInfo = packageInfo; |
|
|
var status = getInventoryStatusDesc(params.inventoryStatus) |
|
|
//扫描的是外包装 |
|
|
var areaType = getListLocationAreaTypeDesc(params.areaType) |
|
|
let s = ''; |
|
|
var hint = |
|
|
if (!result.package.parentNumber) { |
|
|
"按物料号 [" + params.itemCode + "] <br>" + |
|
|
if (balances.list.length == 0) { |
|
|
"包装号 [" + params.packingNumber + "] <br>" + |
|
|
this.showErrorMessage('未查找到该包装的库存信息,请重新扫描') |
|
|
"批次 [" + params.batch + "] <br>" + |
|
|
} else { |
|
|
"状态 [" + status + "] <br>" + |
|
|
let newBalances = balances.list.filter(b => b.locationCode == that |
|
|
"库区 [" + areaType + "] <br>" + |
|
|
.fromLocationCode); |
|
|
"未查找到库存余额" |
|
|
if (newBalances.length == 0) { |
|
|
this.showErrorMessage(hint) |
|
|
this.showErrorMessage('未查找到该包装的库存信息,请重新扫描') |
|
|
} else if (res.data.length == 1) { |
|
|
} else if (newBalances.length == 1) { |
|
|
result.balance = res.data[0] |
|
|
let balance = newBalances[0]; |
|
|
|
|
|
this.afterGetBalance(result.label, balance, packageInfo); |
|
|
if (result.label.packingNumber != result.balance.packingNumber) { |
|
|
|
|
|
result.balance.handleQty = Number(result.label.qty) |
|
|
} else { |
|
|
} else { |
|
|
this.showBalanceSelect(newBalances); |
|
|
result.balance.handleQty = Number(result.balance.qty) |
|
|
} |
|
|
} |
|
|
} |
|
|
this.afterGetBalance(result.label, result.balance, result.package); |
|
|
} else { |
|
|
|
|
|
//扫描的是小包装 |
|
|
|
|
|
if (balances.list.length == 0) { |
|
|
|
|
|
this.showErrorMessage('未查找到该包装的库存信息,请重新扫描') |
|
|
|
|
|
} else { |
|
|
|
|
|
//小包装库存 |
|
|
|
|
|
let subPackitems = balances.list.filter(r => r.packingNumber == packageInfo |
|
|
|
|
|
.number) |
|
|
|
|
|
//外包装库存 |
|
|
|
|
|
let subParentPackitems = balances.list.filter(r => r.packingNumber == |
|
|
|
|
|
packageInfo |
|
|
|
|
|
.parentNumber && r.locationCode == this.fromLocationCode) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//小包装没有库存, |
|
|
|
|
|
if (subPackitems.length == 0) { |
|
|
|
|
|
//外包装有库存,出库后剩余库存未转换为出库包装规格 |
|
|
|
|
|
|
|
|
|
|
|
if (subParentPackitems.length > 0) { |
|
|
|
|
|
if (subParentPackitems.length == 1) { |
|
|
|
|
|
let balance = subParentPackitems[0]; |
|
|
|
|
|
balance.qty = packageInfo.qty; |
|
|
|
|
|
this.afterGetBalance(result.label, balance, packageInfo); |
|
|
|
|
|
} else { |
|
|
|
|
|
this.showBalanceSelect(subParentPackitems); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
this.showErrorMessage('按外包装【' + packageInfo.parentNumber + '】和子包装【' + |
|
|
//多条记录 |
|
|
packageInfo.number + '】都未查找到库存余额') |
|
|
this.$refs.balanceSelect.openPopup(res.data); |
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
var locationCode = this.fromLocationCode |
|
|
|
|
|
if (balances.list == 1) { |
|
|
|
|
|
locationCode = balances.list[0].locationCode |
|
|
|
|
|
} else { |
|
|
|
|
|
var manyBlances = balances.list.filter(r => r.locationCode != this |
|
|
|
|
|
.fromLocationCode) |
|
|
|
|
|
if (manyBlances.length > 0) { |
|
|
|
|
|
locationCode = manyBlances[0].locationCode; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
this.showErrorMessage('该包装【' + packageInfo.number + '】在库位【' + |
|
|
|
|
|
locationCode + |
|
|
|
|
|
'】已经有库存余额,请重新扫描') |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
}).catch(error => { |
|
|
|
|
|
uni.hideLoading() |
|
|
// //小包装没有库存,外包装有库存 |
|
|
this.showErrorMessage(error) |
|
|
// if (subitems.length == 0 && subParentPackitems.length > 0) { |
|
|
}) |
|
|
// this.afterGetBalance(result.label, null, packageInfo); |
|
|
|
|
|
// } else if (subitems.length > 0 && subParentPackitems.length == 0) { |
|
|
|
|
|
// //小包装没有库存,外包装没有有库存 |
|
|
|
|
|
// this.showErrorMessage('该包装在库位【' + balances.list[0].locationCode + |
|
|
|
|
|
// '】已经有库存余额,请重新扫描') |
|
|
|
|
|
// } else { |
|
|
|
|
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
uni.hideLoading(); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// getBalanceByManagementPrecision(result.label, that.fromLocationCode, that.fromInventoryStatuses, |
|
|
|
|
|
// balanceRes => { |
|
|
|
|
|
// if (balanceRes.success) { |
|
|
|
|
|
// let s = ''; |
|
|
|
|
|
// if (balanceRes.data.list.length == 0) { |
|
|
|
|
|
// 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); |
|
|
|
|
|
// } else { |
|
|
|
|
|
// this.showBalanceSelect(balanceRes.data.list); |
|
|
|
|
|
// } |
|
|
|
|
|
// } else { |
|
|
|
|
|
// this.showErrorMessage(balanceRes.message.message); |
|
|
|
|
|
// } |
|
|
|
|
|
// uni.hideLoading(); |
|
|
|
|
|
// }); |
|
|
|
|
|
} |
|
|
} |
|
|
} catch (e) { |
|
|
} catch (e) { |
|
|
this.showErrorMessage(e.stack) |
|
|
this.showErrorMessage(e.stack) |
|
@ -366,55 +331,6 @@ |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
getBalance(label, packageInfo, callback) { |
|
|
|
|
|
var filters = [] |
|
|
|
|
|
|
|
|
|
|
|
if (packageInfo.parentNumber) { |
|
|
|
|
|
var packingNumber = packageInfo.parentNumber + "," + label.packingNumber; |
|
|
|
|
|
filters.push({ |
|
|
|
|
|
column: "packingNumber", |
|
|
|
|
|
action: "in", |
|
|
|
|
|
value: packingNumber |
|
|
|
|
|
}) |
|
|
|
|
|
} else { |
|
|
|
|
|
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) { |
|
|
selectBalanceItem(balance) { |
|
|
this.afterGetBalance(this.label, balance, this.packageInfo); |
|
|
this.afterGetBalance(this.label, balance, this.packageInfo); |
|
|
}, |
|
|
}, |
|
@ -426,7 +342,10 @@ |
|
|
let packingCode = label.packingNumber; |
|
|
let packingCode = label.packingNumber; |
|
|
let lot = label.batch; |
|
|
let lot = label.batch; |
|
|
let item = that.toLocation.Items.find(r => r.itemCode == itemCode); |
|
|
let item = that.toLocation.Items.find(r => r.itemCode == itemCode); |
|
|
|
|
|
|
|
|
|
|
|
that.fromLocationCode = balance.locationCode; |
|
|
let fromLocation = item.Locations.find(l => l.fromLocationCode == that.fromLocationCode); |
|
|
let fromLocation = item.Locations.find(l => l.fromLocationCode == that.fromLocationCode); |
|
|
|
|
|
//如果库存余额中的库位与任务推荐的不一致 |
|
|
if (fromLocation != undefined) { |
|
|
if (fromLocation != undefined) { |
|
|
let batch = fromLocation.Batchs.find(r => r.batch == lot); |
|
|
let batch = fromLocation.Batchs.find(r => r.batch == lot); |
|
|
if (batch != undefined) { |
|
|
if (batch != undefined) { |
|
@ -483,11 +402,8 @@ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
that.showErrorMessage('未查找到推荐库位【' + that.fromLocationCode + '】的发料明细', |
|
|
let locaion = that.createLocationInfo(label, balance, packageInfo); |
|
|
res => { |
|
|
item.Locations.push(locaion); |
|
|
that.getfocus(); |
|
|
|
|
|
} |
|
|
|
|
|
) |
|
|
|
|
|
} |
|
|
} |
|
|
} catch (e) { |
|
|
} catch (e) { |
|
|
this.showErrorMessage(e.stack, |
|
|
this.showErrorMessage(e.stack, |
|
@ -498,20 +414,34 @@ |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//增加实际扫描的明细 |
|
|
|
|
|
createLocationInfo(label, balance, packageInfo) { |
|
|
|
|
|
let location = { |
|
|
|
|
|
fromLocationCode: balance.locationCode, |
|
|
|
|
|
qty: balance.qty, |
|
|
|
|
|
uom: balance.uom, |
|
|
|
|
|
handleQty: 0, |
|
|
|
|
|
Batchs: [] |
|
|
|
|
|
} |
|
|
|
|
|
let batch = this.createBatchInfo(label, balance, packageInfo); |
|
|
|
|
|
batch.detail = balance; |
|
|
|
|
|
location.Batchs.push(batch); |
|
|
|
|
|
return location; |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
createBatchInfo(label, balance, packageInfo) { |
|
|
createBatchInfo(label, balance, packageInfo) { |
|
|
let batch = { |
|
|
let batch = { |
|
|
batch: label.batch, |
|
|
batch: label.batch, |
|
|
qty: 0, |
|
|
qty: 0, |
|
|
uom: label.uom, |
|
|
uom: label.uom, |
|
|
|
|
|
|
|
|
Records: [] |
|
|
Records: [] |
|
|
} |
|
|
} |
|
|
let record = {} |
|
|
let record = {} |
|
|
if (balance == null) { |
|
|
if (balance != null) { |
|
|
record = this.creatRecordByBalance(label, packageInfo); |
|
|
record = this.creatRecordByBalance(balance, packageInfo); |
|
|
batch.handleQty = Number(label.qty) |
|
|
batch.handleQty = Number(label.qty) |
|
|
} else { |
|
|
} else { |
|
|
record = this.creatRecordByLabel(balance, packageInfo); |
|
|
record = this.creatRecordByLabel(label, packageInfo); |
|
|
batch.handleQty = Number(balance.qty) |
|
|
batch.handleQty = Number(balance.qty) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -535,7 +465,7 @@ |
|
|
toLocationCode: this.toLocationCode, |
|
|
toLocationCode: this.toLocationCode, |
|
|
supplierCode: label.supplierCode, |
|
|
supplierCode: label.supplierCode, |
|
|
packUnit: packageInfo.packUnit, |
|
|
packUnit: packageInfo.packUnit, |
|
|
packQty: packageInfo.packQty |
|
|
packQty: packageInfo.packQty, |
|
|
} |
|
|
} |
|
|
return record; |
|
|
return record; |
|
|
}, |
|
|
}, |
|
@ -659,13 +589,13 @@ |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
packGetFocus() { |
|
|
packGetFocus() { |
|
|
if(this.$refs.comscan){ |
|
|
if (this.$refs.comscan) { |
|
|
this.$refs.comscan.getfocus(); |
|
|
this.$refs.comscan.getfocus(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
packLoseFocus() { |
|
|
packLoseFocus() { |
|
|
if(this.$refs.comscan){ |
|
|
if (this.$refs.comscan) { |
|
|
this.$refs.comscan.losefocus(); |
|
|
this.$refs.comscan.losefocus(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|