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