|
|
@ -35,7 +35,7 @@ |
|
|
|
</view> |
|
|
|
<u-line class='line_color'></u-line> --> |
|
|
|
|
|
|
|
<view class="uni-flex uni-row" style="align-items: center; |
|
|
|
<!--<view class="uni-flex uni-row" style="align-items: center; |
|
|
|
background-color: #fff; |
|
|
|
margin-left: 20rpx; |
|
|
|
margin-right: 20rpx; |
|
|
@ -48,12 +48,12 @@ |
|
|
|
<uni-combox :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请选择库位" |
|
|
|
@confirm="fromLocationUpdate"></uni-combox> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view>--> |
|
|
|
|
|
|
|
<view class=""> |
|
|
|
<view class=""> |
|
|
|
<win-com-scan ref="comscan" placeholder="箱标签" @getResult="onScan" :clearResult="true" |
|
|
|
:headerType="headerType" :isShowHistory="false"> |
|
|
|
headerType="HPQ,HMQ" :isShowHistory="false" :locationCode='locationCode'> |
|
|
|
</win-com-scan> |
|
|
|
|
|
|
|
<view style="width: 100%;"> |
|
|
@ -75,7 +75,7 @@ |
|
|
|
<u-swipe-action ref="swipeAction" :options="scanOptions" |
|
|
|
@click="(...event)=>swipeClick(event,record,index)"> |
|
|
|
<view style="padding: 0px 10px"> |
|
|
|
<balance :dataContent="record" :isShowLocation="false" |
|
|
|
<balance :dataContent="record" :isShowFromLocation="false" |
|
|
|
:isShowStdPack="false"></balance> |
|
|
|
</view> |
|
|
|
</u-swipe-action> |
|
|
@ -93,6 +93,10 @@ |
|
|
|
<balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select> |
|
|
|
<comMessage ref="comMessage"></comMessage> |
|
|
|
<balance-qty-edit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></balance-qty-edit> |
|
|
|
<!-- 模拟扫描功能 --> |
|
|
|
<!-- <win-com-scan v-show="false" ref="comscansimulate" placeholder="箱标签" @getResult="onScan" :clearResult="true" |
|
|
|
headerType="HPQ,HMQ" :isShowHistory="false"> |
|
|
|
</win-com-scan> --> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
@ -109,14 +113,23 @@ import { |
|
|
|
|
|
|
|
import { |
|
|
|
getDirectoryItemArray, |
|
|
|
getListLocationAreaTypeDesc, |
|
|
|
getInventoryStatusDesc |
|
|
|
} from '@/common/directory.js'; |
|
|
|
|
|
|
|
import { |
|
|
|
getLabelInfo |
|
|
|
} from '@/common/label.js'; |
|
|
|
import { |
|
|
|
calc |
|
|
|
} from '@/common/calc.js'; |
|
|
|
import { |
|
|
|
getWorkShopLineStation |
|
|
|
getWorkShopLineStation, |
|
|
|
getBalanceByFilter, |
|
|
|
getBalanceByParams, |
|
|
|
} from '@/api/request2.js'; |
|
|
|
import { |
|
|
|
uniqueArray |
|
|
|
} from '@/common/basic.js'; |
|
|
|
|
|
|
|
import { |
|
|
|
getBalanceByManagementPrecision |
|
|
@ -124,7 +137,17 @@ import { |
|
|
|
|
|
|
|
|
|
|
|
import {ref, onMounted} from 'vue'; |
|
|
|
|
|
|
|
const props = defineProps({ |
|
|
|
title: { |
|
|
|
type: String, |
|
|
|
default: '' |
|
|
|
}, |
|
|
|
locationCode:{ |
|
|
|
type: String, |
|
|
|
default: '' |
|
|
|
} |
|
|
|
}) |
|
|
|
const emit = defineEmits(['closeScan','afterScan']) |
|
|
|
const detailOptions = ref(getDetailOption()); |
|
|
|
const scanOptions = ref(getDetailEditRemoveOption()); |
|
|
|
const issueRecord = ref([]); |
|
|
@ -149,20 +172,35 @@ const toLocationCombox = ref(null) |
|
|
|
const comscan = ref(null) |
|
|
|
const balanceQtyEdit = ref(null) |
|
|
|
const receiptHint = ref(null) |
|
|
|
|
|
|
|
const emit = defineEmits(['closeScan','afterScan']) |
|
|
|
const inputStyleObject = ref({ |
|
|
|
fontSize: "100rpx" |
|
|
|
}) |
|
|
|
const bussinessCode = ref('Issue') |
|
|
|
const toLocationAreaTypeList = ref([]) |
|
|
|
onMounted(() => { |
|
|
|
detailOptions.value = getDetailOption(); |
|
|
|
scanOptions.value = getDetailEditRemoveOption(); |
|
|
|
}); |
|
|
|
|
|
|
|
const openScanPopupForJobSimulate = (content, jobcontent, scanMessage)=> { |
|
|
|
issueRecord.value = []; |
|
|
|
dataContent.value = content; |
|
|
|
jobContent.value = jobcontent; |
|
|
|
initData(); |
|
|
|
getLabelInfo(scanMessage, "HPQ,HMQ", callback => { |
|
|
|
if (callback.success) { |
|
|
|
onScan(callback); |
|
|
|
} else { |
|
|
|
showErrorMessage(callback.message, res => {}) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
const openScanPopup = (content, jobcontent) => { |
|
|
|
issueRecord.value = []; |
|
|
|
dataContent.value = content; |
|
|
|
jobContent.value = jobcontent; |
|
|
|
initData(); |
|
|
|
positionInfo.value = jobContent.value.workShopCode + "-" + jobContent.value.subList[0].productionLineCode + |
|
|
|
"-" + jobContent.value.subList[0].workStationCode; |
|
|
|
// positionInfo.value = jobContent.value.workShopCode + "-" + jobContent.value.subList[0].productionLineCode + |
|
|
|
// "-" + jobContent.value.subList[0].workStationCode; |
|
|
|
show.value = true |
|
|
|
setTimeout(() => { |
|
|
|
getfocus(); |
|
|
@ -183,85 +221,239 @@ const initData = () => { |
|
|
|
fromInventoryStatuses.value = getDirectoryItemArray(jobContent.value.outInventoryStatuses); |
|
|
|
toLocation.value = dataContent.value.subList; |
|
|
|
toLocationCode.value = dataContent.value.subList[0].toLocationCode; |
|
|
|
fromLocationList.value = getFromLocationList(); |
|
|
|
toLocationAreaTypeList.value = getDirectoryItemArray(jobContent.value.toAreaTypes) |
|
|
|
// fromLocationList.value = getFromLocationList(); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
const showBalanceSelect = (items, packageInfoValue) => { |
|
|
|
packageInfo.value = packageInfoValue; |
|
|
|
const showBalanceSelect = (items) => { |
|
|
|
balanceSelect.value.openPopup(items); |
|
|
|
}; |
|
|
|
|
|
|
|
const getFromLocationList = () => { |
|
|
|
let list = []; |
|
|
|
let location = dataContent.value.subList.find(r => r.toLocationCode == toLocationCode.value); |
|
|
|
if (location != undefined) { |
|
|
|
dataContent.value.subList.forEach(item => { |
|
|
|
list.push(item.fromLocationCode); |
|
|
|
}); |
|
|
|
fromLocationCode.value = list[0]; |
|
|
|
return list; |
|
|
|
} else { |
|
|
|
comMessage.value.showErrorMessages('需求库位【' + toLocationCode.value + '】不存在', res => { |
|
|
|
toLocationCode.value = ''; |
|
|
|
}); |
|
|
|
} |
|
|
|
}; |
|
|
|
// const getFromLocationList = () => { |
|
|
|
// let list = []; |
|
|
|
// let location = dataContent.value.subList.find(r => r.toLocationCode == toLocationCode.value); |
|
|
|
// if (location != undefined) { |
|
|
|
// dataContent.value.subList.forEach(item => { |
|
|
|
// list.push(item.fromLocationCode); |
|
|
|
// }); |
|
|
|
// fromLocationCode.value = list[0]; |
|
|
|
// return list; |
|
|
|
// } else { |
|
|
|
// comMessage.value.showErrorMessages('需求库位【' + toLocationCode.value + '】不存在', res => { |
|
|
|
// toLocationCode.value = ''; |
|
|
|
// }); |
|
|
|
// } |
|
|
|
// }; |
|
|
|
|
|
|
|
const fromLocationUpdate = (fromlocation) => { |
|
|
|
let location = fromLocationList.value.find(r => r == fromlocation); |
|
|
|
fromLocationCode.value = fromlocation; |
|
|
|
let location = fromLocationList.value.find(r => r == fromlocation) |
|
|
|
if (location == undefined) { |
|
|
|
fromLocationCode.value = '' |
|
|
|
showErrorMessage('发货库位【' + fromlocation + '】不存在') |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
const onScan = (result) => { |
|
|
|
const queryBalance = (result) => { |
|
|
|
try { |
|
|
|
if (fromLocationCode.value == '') { |
|
|
|
showErrorMessage('请选择来源库位', res => { |
|
|
|
toLocationCombox.value.onFocus(); |
|
|
|
}); |
|
|
|
return; |
|
|
|
} |
|
|
|
// if (fromLocationCode.value == '') { |
|
|
|
// showErrorMessage('请选择来源库位', res => { |
|
|
|
// toLocationCombox.value.onFocus(); |
|
|
|
// }); |
|
|
|
// return; |
|
|
|
// } |
|
|
|
let packageInfoValue = result.package; |
|
|
|
let itemCode = result.label.itemCode; |
|
|
|
let packingCode = result.label.packingNumber; |
|
|
|
let lot = result.label.batch; |
|
|
|
let item = toLocation.value.find(r => r.itemCode == itemCode); |
|
|
|
let item = toLocation.value.Items.find(r => r.itemCode == itemCode); |
|
|
|
if (item == undefined) { |
|
|
|
showErrorMessage('未查找到物料【' + itemCode + '】的发货明细', res => { |
|
|
|
getfocus(); |
|
|
|
}); |
|
|
|
return; |
|
|
|
} else { |
|
|
|
const 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: '加载中', |
|
|
|
title: '查询中', |
|
|
|
mask: true |
|
|
|
}); |
|
|
|
getBalanceByManagementPrecision(result.label, fromLocationCode.value, fromInventoryStatuses.value, |
|
|
|
balanceRes => { |
|
|
|
if (balanceRes.success) { |
|
|
|
if (balanceRes.data.list.length == 0) { |
|
|
|
showErrorMessage('在来源库位[' + fromLocationCode.value + '],未查找到该包装的库存记录', res => { |
|
|
|
packGetFocus(); |
|
|
|
}); |
|
|
|
} else if (balanceRes.data.list.length == 1) { |
|
|
|
let balance = balanceRes.data.list[0]; |
|
|
|
afterGetBalance(result.label, balance, packageInfoValue); |
|
|
|
} else { |
|
|
|
label.value = result.label; |
|
|
|
showBalanceSelect(balanceRes.data.list, packageInfoValue); |
|
|
|
} |
|
|
|
} else { |
|
|
|
showErrorMessage(balanceRes.message.message); |
|
|
|
} |
|
|
|
uni.hideLoading(); |
|
|
|
}); |
|
|
|
getBalanceByParams(params).then(res => { |
|
|
|
if (res.data.length == 0) { |
|
|
|
const status = getInventoryStatusDesc(params.inventoryStatus) |
|
|
|
const areaType = getListLocationAreaTypeDesc(params.areaType) |
|
|
|
const hint = |
|
|
|
"按物料号 [" + params.itemCode + "] \n" + |
|
|
|
"包装号 [" + params.packingNumber + "] \n" + |
|
|
|
"批次 [" + params.batch + "] \n" + |
|
|
|
"状态 [" + status + "] \n" + |
|
|
|
"库区 [" + areaType + "] \n" + |
|
|
|
"未查找到库存余额" |
|
|
|
showErrorMessage(hint, |
|
|
|
res => { |
|
|
|
getfocus(); |
|
|
|
}) |
|
|
|
} else if (res.data.length == 1) { |
|
|
|
result.balance = res.data[0] |
|
|
|
|
|
|
|
if (result.label.packingNumber != result.balance.packingNumber) { |
|
|
|
result.balance.qty = Number(result.label.qty) |
|
|
|
} else { |
|
|
|
result.balance.qty = Number(result.balance.qty) |
|
|
|
} |
|
|
|
afterGetBalance(result.label, result.balance, result.package); |
|
|
|
} else { |
|
|
|
//多条记录 |
|
|
|
balanceSelect.value.openPopup(res.data); |
|
|
|
} |
|
|
|
uni.hideLoading() |
|
|
|
}).catch(error => { |
|
|
|
uni.hideLoading() |
|
|
|
showErrorMessage(error, |
|
|
|
res => { |
|
|
|
getfocus(); |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
showErrorMessage(e.stack); |
|
|
|
showErrorMessage(e.stack,res=>{ |
|
|
|
getfocus() |
|
|
|
}); |
|
|
|
uni.hideLoading(); |
|
|
|
} |
|
|
|
}; |
|
|
|
const getBalance = (label, packageInfo, callback)=> { |
|
|
|
let filters = [] |
|
|
|
if (packageInfo.parentNumber) { |
|
|
|
const 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 (fromInventoryStatuses.value != null && fromInventoryStatuses.value != "") { |
|
|
|
filters.push({ |
|
|
|
column: "inventoryStatus", |
|
|
|
action: "in", |
|
|
|
value: fromInventoryStatuses.value |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
const params = { |
|
|
|
filters: filters, |
|
|
|
pageNo: 1, |
|
|
|
pageSize: 100, |
|
|
|
} |
|
|
|
getBalanceByFilter(params).then(res => { |
|
|
|
callback(res.data) |
|
|
|
}).catch(err => { |
|
|
|
showErrorMessage(err.message); |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
const onScan = (result)=> { |
|
|
|
if (!result.package) { |
|
|
|
showErrorMessage('扫描数据错误[' + result.label.code + "]", |
|
|
|
res => { |
|
|
|
getfocus(); |
|
|
|
} |
|
|
|
) |
|
|
|
return; |
|
|
|
} |
|
|
|
if (toLocation.value) { |
|
|
|
let item = toLocation.value.Items.find(r => r.itemCode == result.package.itemCode); |
|
|
|
if (!item) { |
|
|
|
showErrorMessage('扫描物料代码不属于该任务'); |
|
|
|
return |
|
|
|
} |
|
|
|
getToLocationBalance(result) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//查询到目标库位的库存余额 |
|
|
|
const getToLocationBalance = (result)=> { |
|
|
|
uni.showLoading({ |
|
|
|
title: '查询中', |
|
|
|
mask: true |
|
|
|
}) |
|
|
|
let filters = [] |
|
|
|
if (result.package.parentNumber) { |
|
|
|
const packingNumber = result.package.parentNumber + "," + result.package.number; |
|
|
|
filters.push({ |
|
|
|
column: "packingNumber", |
|
|
|
action: "in", |
|
|
|
value: packingNumber |
|
|
|
}) |
|
|
|
} else { |
|
|
|
filters.push({ |
|
|
|
column: "packingNumber", |
|
|
|
action: "==", |
|
|
|
value: result.package.number |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
filters.push({ |
|
|
|
column: "itemCode", |
|
|
|
action: "==", |
|
|
|
value: result.package.itemCode |
|
|
|
}) |
|
|
|
filters.push({ |
|
|
|
column: "batch", |
|
|
|
action: "==", |
|
|
|
value: result.package.batch |
|
|
|
}) |
|
|
|
|
|
|
|
filters.push({ |
|
|
|
column: "areaType", |
|
|
|
action: "in", |
|
|
|
value: toLocationAreaTypeList.value.join(',') |
|
|
|
}) |
|
|
|
|
|
|
|
const params = { |
|
|
|
filters: filters, |
|
|
|
pageNo: 1, |
|
|
|
pageSize: 100, |
|
|
|
} |
|
|
|
getBalanceByFilter(params).then(res => { |
|
|
|
uni.hideLoading() |
|
|
|
if (res.data.list.length > 0) { |
|
|
|
showErrorMessage("包装在库位【" + res.data.list[0].locationCode + "】已有库存余额"); |
|
|
|
} else { |
|
|
|
queryBalance(result); |
|
|
|
} |
|
|
|
// callback(res.data) |
|
|
|
}).catch(err => { |
|
|
|
uni.hideLoading() |
|
|
|
showErrorMessage(err.message); |
|
|
|
}) |
|
|
|
} |
|
|
|
const selectBalanceItem = (balance) => { |
|
|
|
afterGetBalance(balance, balance, packageInfo.value); |
|
|
|
}; |
|
|
@ -271,55 +463,80 @@ const afterGetBalance = (labelValue, balance, packageInfoValue) => { |
|
|
|
let itemCode = labelValue.itemCode; |
|
|
|
let packingCode = labelValue.packingNumber; |
|
|
|
let lot = labelValue.batch; |
|
|
|
let item = toLocation.value.find(r => r.itemCode == itemCode); |
|
|
|
let fromLocation = toLocation.value.find(l => l.fromLocationCode == fromLocationCode.value); |
|
|
|
if (!fromLocation) { |
|
|
|
fromLocation = { |
|
|
|
Batchs: [{ |
|
|
|
Recommends: [], |
|
|
|
Records: [], |
|
|
|
batch: labelValue.batch, |
|
|
|
detail: { |
|
|
|
...packageInfoValue, |
|
|
|
fromLocationCode: balance.locationCode, |
|
|
|
toLocationCode: toLocationCode.value |
|
|
|
}, |
|
|
|
handleQty: 0, |
|
|
|
packingNumber: null, |
|
|
|
qty: labelValue.qty, |
|
|
|
uom: labelValue.uom |
|
|
|
}], |
|
|
|
toLocationCode: toLocationCode.value, |
|
|
|
fromLocationCode: balance.locationCode, |
|
|
|
handleQty: 0, |
|
|
|
qty: labelValue.qty, |
|
|
|
uom: labelValue.uom |
|
|
|
}; |
|
|
|
item.Locations.push(fromLocation); |
|
|
|
} |
|
|
|
if (fromLocation != undefined) { |
|
|
|
let batch = fromLocation.batch; |
|
|
|
if (batch != undefined) { |
|
|
|
addRecord(item.batch, labelValue, balance, packageInfoValue); |
|
|
|
} else { |
|
|
|
let item = toLocation.value.Items.find(r => r.itemCode == itemCode); |
|
|
|
fromLocationCode.value = balance.locationCode; |
|
|
|
let fromLocation = item.Locations.find(l => l.fromLocationCode == fromLocationCode.value); |
|
|
|
if (fromLocation) { |
|
|
|
let batch = fromLocation.Batchs.find(r => r.batch == lot); |
|
|
|
if(batch != undefined){ |
|
|
|
if (batch.Records == undefined) { |
|
|
|
batch.Records = []; |
|
|
|
} |
|
|
|
let record = batch.Records.find(r => r.packingNumber == packingCode); |
|
|
|
if (record == undefined) { |
|
|
|
//如果有推荐箱码 |
|
|
|
if (batch.Recommends != undefined && batch.Recommends.length > 0) { |
|
|
|
let recommend = batch.Recommends.find(r => r.packingNumber == packingCode); |
|
|
|
if (recommend != undefined) { |
|
|
|
addRecord(batch, label, balance, packageInfo) |
|
|
|
} else { |
|
|
|
//允许修改箱码 |
|
|
|
if (this.jobContent.allowModifyPackingNumber == 'TRUE') { |
|
|
|
addRecord(batch, label, balance, packageInfo); |
|
|
|
} else { |
|
|
|
showErrorMessage('未查找到该箱码【' + packingCode + '】的明细', |
|
|
|
res => { |
|
|
|
getfocus(); |
|
|
|
return; |
|
|
|
} |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
addRecord(batch, label, balance, packageInfo) |
|
|
|
} |
|
|
|
} else { |
|
|
|
addRecord(batch, label, balance, packageInfo) |
|
|
|
} |
|
|
|
}else { |
|
|
|
if (jobContent.value.allowModifyBatch == "TRUE") { |
|
|
|
showQuestionMessage('在【' + fromLocationCode.value + '】库位下,未查找到批次【' + lot + |
|
|
|
'】的发货明细,是否要继续发货?', res => { |
|
|
|
if (res) { |
|
|
|
let batch = createBatchInfo(labelValue, balance, packageInfoValue); |
|
|
|
let batch = createBatchInfo(label, balance, packageInfo); |
|
|
|
//新增加的批次赋值details |
|
|
|
if (fromLocation.Batchs.length > 0) { |
|
|
|
batch.detail = fromLocation.Batchs[0].detail; |
|
|
|
} |
|
|
|
fromLocation.Batchs.unshift(batch); |
|
|
|
getfocus(); |
|
|
|
emit("afterScan"); |
|
|
|
} |
|
|
|
}); |
|
|
|
}) |
|
|
|
} else { |
|
|
|
showErrorMessage('未查找到批次【' + lot + '】的发货明细', res => { |
|
|
|
getfocus(); |
|
|
|
}); |
|
|
|
showErrorMessage('未查找到批次【' + lot + '】的发货明细', |
|
|
|
res => { |
|
|
|
getfocus(); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
showErrorMessage('未查找到推荐库位【' + fromLocationCode.value + '】的发货明细', res => { |
|
|
|
getfocus(); |
|
|
|
}); |
|
|
|
}else { |
|
|
|
//扫描的不在任务列表中,询问是否可以添加, |
|
|
|
if (jobContent.value.allowModifyLocation == "TRUE") { |
|
|
|
showQuestionMessage("扫描物料[" + itemCode + "]的库位【" + fromLocationCode.value + |
|
|
|
"】与推荐的库位不一致,是否要继续发货?", res => { |
|
|
|
if (res) { |
|
|
|
let locaion = createLocationInfo(label, balance, packageInfo); |
|
|
|
item.Locations.push(locaion); |
|
|
|
getfocus(); |
|
|
|
emit("afterScan"); |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
} else { |
|
|
|
showErrorMessage("扫描物料[" + itemCode + "]的库位【" + fromLocationCode.value + |
|
|
|
"】与推荐的库位不一致,不允许继续发货?") |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
showErrorMessage(e.stack, res => { |
|
|
@ -327,28 +544,30 @@ const afterGetBalance = (labelValue, balance, packageInfoValue) => { |
|
|
|
}); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
//增加不是任务中的库位,实际扫描的明细 |
|
|
|
const createLocationInfo = (label, balance, packageInfoValue)=> { |
|
|
|
let location = { |
|
|
|
fromLocationCode: balance.locationCode, |
|
|
|
qty: balance.qty, |
|
|
|
uom: balance.uom, |
|
|
|
handleQty: 0, |
|
|
|
isNewAdd: true, |
|
|
|
Batchs: [] |
|
|
|
} |
|
|
|
let batch = createBatchInfo(label, balance, packageInfoValue); |
|
|
|
batch.detail = balance; |
|
|
|
batch.detail.fromLocationCode = balance.locationCode; |
|
|
|
location.Batchs.push(batch); |
|
|
|
return location; |
|
|
|
} |
|
|
|
const createBatchInfo = (data, balance, packageInfoValue) => { |
|
|
|
let batch = { |
|
|
|
batch: data.lot || data.batch, |
|
|
|
isNewAdd: true, |
|
|
|
batch: data.batch, |
|
|
|
qty: 0, |
|
|
|
uom: data.uom, |
|
|
|
handleQty: Number(data.qty), |
|
|
|
handleQty: Number(balance.qty), |
|
|
|
Records: [], |
|
|
|
detail: { |
|
|
|
fromLocationCode: fromLocationCode.value, //balance.locationCode |
|
|
|
toLocationCode: toLocationCode.value, |
|
|
|
itemCode: data.itemCode, |
|
|
|
handleQty: Number(data.qty), |
|
|
|
packingNumber: data.packingNumber, |
|
|
|
qty: 0, |
|
|
|
uom: data.uom, |
|
|
|
itemName: packageInfoValue.itemName, |
|
|
|
itemDesc1: packageInfoValue.itemDesc1, |
|
|
|
itemDesc2: packageInfoValue.itemDesc2, |
|
|
|
singlePrice: balance.singlePrice, |
|
|
|
amount: balance.amount |
|
|
|
} |
|
|
|
}; |
|
|
|
let record = creatRecord(data, balance, packageInfoValue); |
|
|
|
batch.Records.push(record); |
|
|
@ -366,7 +585,7 @@ const creatRecord = (labelValue, balance, packageInfoValue) => { |
|
|
|
parentPackingNumber: packageInfoValue.parentNumber, |
|
|
|
batch: labelValue.batch, |
|
|
|
qty: Number(balance.qty), |
|
|
|
handleQty: 0, |
|
|
|
handleQty: Number(balance.qty), |
|
|
|
uom: balance.uom, |
|
|
|
inventoryStatus: balance.inventoryStatus, |
|
|
|
balance: balance, |
|
|
@ -374,36 +593,68 @@ const creatRecord = (labelValue, balance, packageInfoValue) => { |
|
|
|
supplierCode: labelValue.supplierCode, |
|
|
|
packUnit: packageInfoValue.packUnit, |
|
|
|
packQty: packageInfoValue.packQty, |
|
|
|
fromLocationCode: balance.locationCode |
|
|
|
}; |
|
|
|
return record; |
|
|
|
}; |
|
|
|
|
|
|
|
const calcBatchHandleQty = (batch, labelValue, balance) => { |
|
|
|
dataContent.value.subList.forEach(item => { |
|
|
|
if (item.itemCode == labelValue.itemCode && item.batch == labelValue.batch) { |
|
|
|
item.handleQty = item.handleQty || 0; |
|
|
|
item.handleQty = calc.add(item.handleQty, labelValue.qty); |
|
|
|
} |
|
|
|
}); |
|
|
|
const calcBatchHandleQty = (batch) => { |
|
|
|
let handleQty = 0; |
|
|
|
batch.Records.forEach(res => { |
|
|
|
handleQty = calc.add(handleQty, res.qty) |
|
|
|
}) |
|
|
|
batch.handleQty = handleQty; |
|
|
|
}; |
|
|
|
|
|
|
|
const addRecord = (batch, labelValue, balance, packageInfoValue) => { |
|
|
|
let checkData = dataContent.value.subList.find(r => { |
|
|
|
if (r.batch == balance.batch) { |
|
|
|
return r; |
|
|
|
if(packageInfoValue.parentNumber){ |
|
|
|
let checkData = batch.Records.find(r => { |
|
|
|
if (r.packingNumber == packageInfoValue.parentNumber && r.batch == balance.batch) { |
|
|
|
return r; |
|
|
|
} |
|
|
|
}); |
|
|
|
if (checkData) { |
|
|
|
showErrorMessage("箱码[" + packageInfoValue.number + "]批次[" + balance.batch + |
|
|
|
"]的父包装已经扫描") |
|
|
|
} else { |
|
|
|
let record = creatRecord(labelValue, balance, packageInfoValue); |
|
|
|
batch.Records.push(record); |
|
|
|
issueRecord.value.unshift(record) |
|
|
|
dataContent.value.subList.push(record); |
|
|
|
calcBatchHandleQty(batch); |
|
|
|
getfocus(); |
|
|
|
emit("afterScan"); |
|
|
|
} |
|
|
|
}else { |
|
|
|
//扫描的是父包装 |
|
|
|
let checkData = batch.Records.find(r => { |
|
|
|
if (r.parentPackingNumber == packageInfoValue.number && |
|
|
|
r.batch == balance.batch) { |
|
|
|
return r; |
|
|
|
} |
|
|
|
}) |
|
|
|
if (checkData) { |
|
|
|
//是否移除 |
|
|
|
comMessage.value.showQuestionMessage("扫描箱码[" + checkData.parentPackingNumber + "]" + "批次[" + |
|
|
|
balance |
|
|
|
.batch + "]是父包装,是否移除子包装", res => { |
|
|
|
if (res) { |
|
|
|
batch.Records = []; |
|
|
|
let record = creatRecord(label, balance, packageInfoValue); |
|
|
|
batch.Records.push(record); |
|
|
|
issueRecord.value.unshift(record) |
|
|
|
calcBatchHandleQty(batch); |
|
|
|
getfocus(); |
|
|
|
emit("afterScan"); |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
let record = creatRecord(label, balance, packageInfoValue); |
|
|
|
batch.Records.push(record); |
|
|
|
issueRecord.value.unshift(record) |
|
|
|
calcBatchHandleQty(batch); |
|
|
|
getfocus(); |
|
|
|
emit("afterScan"); |
|
|
|
} |
|
|
|
}); |
|
|
|
if (checkData) { |
|
|
|
checkData.scaned = true; |
|
|
|
calcBatchHandleQty(batch, labelValue, balance); |
|
|
|
getfocus(); |
|
|
|
} else { |
|
|
|
let record = creatRecord(labelValue, balance, packageInfoValue); |
|
|
|
dataContent.value.subList.push(record); |
|
|
|
calcBatchHandleQty(batch, labelValue, balance); |
|
|
|
getfocus(); |
|
|
|
emit("afterScan"); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
@ -454,8 +705,10 @@ const remove = (record, index) => { |
|
|
|
if (item != undefined) { |
|
|
|
item.Locations.forEach(l => { |
|
|
|
let batch = l.Batchs.find(b => b.packingNumber == record.packingNumber && b.batch == record.batch); |
|
|
|
let rIndex = batch.Records.findIndex(r => r.packingNumber == record.packingNumber && r.batch == record.batch); |
|
|
|
batch.Records.splice(rIndex, 1); |
|
|
|
if (batch && batch.Records && batch.Records.length > 0) { |
|
|
|
let rIndex = batch.Records.findIndex(r => r.packingNumber == record.packingNumber && r.batch == record.batch); |
|
|
|
batch.Records.splice(rIndex, 1); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
emit('updateData', item); |
|
|
@ -464,11 +717,15 @@ const remove = (record, index) => { |
|
|
|
}; |
|
|
|
|
|
|
|
const packGetFocus = () => { |
|
|
|
comscan.value.getfocus(); |
|
|
|
if (comscan.value) { |
|
|
|
comscan.value.getfocus(); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
const packLoseFocus = () => { |
|
|
|
comscan.value.losefocus(); |
|
|
|
if (comscan.value) { |
|
|
|
comscan.value.losefocus(); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
const showMessage = (message, callback) => { |
|
|
@ -517,4 +774,7 @@ button::after { |
|
|
|
max-height: 300rpx; |
|
|
|
padding: 10rpx; |
|
|
|
} |
|
|
|
.my-combox { |
|
|
|
font-size: 50px; |
|
|
|
} |
|
|
|
</style> |
|
|
|