6 changed files with 482 additions and 408 deletions
@ -1,465 +1,519 @@ |
|||||
<template> |
<template> |
||||
<view class="page-wraper"> |
<view class="page-wraper"> |
||||
<view class=""> |
<view class=""> |
||||
<com-blank-view @goScan="showRequestPopup" v-if="detailSource.length == 0"></com-blank-view> |
<com-blank-view @goScan="getBusinessType" v-if="recommendList.length == 0"></com-blank-view> |
||||
|
</view> |
||||
|
<view class="page-wraper" v-if="recommendList.length > 0"> |
||||
|
<view class="page-header"> |
||||
|
<view class="header_item" style="font-size: 35rpx; padding: 10rpx"> |
||||
|
<uni-collapse ref="collapse"> |
||||
|
<uni-collapse-item :open="true"> |
||||
|
<template v-slot:title> |
||||
|
<view class="card_itemName" style="padding: 3px 5px; font-size: 28rpx"> 先进先出推荐信息 </view> |
||||
|
</template> |
||||
|
<view class="detail-list" v-for="(recommend, index) in recommendList" :key="recommend.id"> |
||||
|
<view class="card_view"> |
||||
|
<text class="card_item_code">物料代码</text> |
||||
|
<text class="card_content">{{ recommend.itemCode }}</text> |
||||
|
</view> |
||||
|
<balance :dataContent="recommend" :isShowStatus="false"></balance> |
||||
|
</view> |
||||
|
</uni-collapse-item> |
||||
|
</uni-collapse> |
||||
|
</view> |
||||
</view> |
</view> |
||||
<view class="page-wraper" v-if="detailSource.length > 0"> |
|
||||
<view class="page-main"> |
<view class="page-main"> |
||||
<scroll-view scroll-y="true" class="page-main-scroll"> |
<scroll-view scroll-y="true" class="page-main-scroll"> |
||||
<view class="" v-for="(toLocation, index) in detailSource" :key="index"> |
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
||||
<view class="u-p-t-20" style="background: white"> |
<view class=""> |
||||
<view class="page-header" style="background-color: #f5f5f5 !important; margin: 0px 20rpx"> |
<record-com-detail-card :dataContent="item" :index="index" :settingParam="dataContent" :isShowFromLocation="true" @removeItem="removeItem(index, item)" :isShowToLocation="false" @updateData="updateData" @removePack="removePack"> </record-com-detail-card> |
||||
<view class="text_lightblue fontsize-16">目标库位:{{ toLocation.toLocationCode }}</view> |
|
||||
</view> |
|
||||
<com-issue-detail-card ref="comRepleinshDetailCard" :dataContent="toLocation" @updateData="updateData"> </com-issue-detail-card> |
|
||||
</view> |
</view> |
||||
<!-- <view class='split_line'></view> --> |
|
||||
</view> |
</view> |
||||
</scroll-view> |
</scroll-view> |
||||
</view> |
</view> |
||||
|
|
||||
<view class="page-footer"> |
<view class="page-footer"> |
||||
<view class="uni-flex u-col-center space-between padding_20" style="background-color: ghostwhite; width: 100%"> |
<view class="uni-flex u-col-center space-between padding_10" style="background-color: ghostwhite; width: 100%"> |
||||
<button class="btn_single_commit" style="flex: 1" hover-class="btn_commit_after" @click="submit">提交</button> |
<view class=""> |
||||
|
<requiredLocation v-if="showToLoaction" title="目标库位" :locationCode="toLocationCode" @getLocation="getToLocationCode" :locationAreaTypeList="toLocationAreaTypeList"> </requiredLocation> |
||||
|
</view> |
||||
|
<view class="uni-flex uni-row"> |
||||
|
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button> |
||||
|
</view> |
||||
</view> |
</view> |
||||
</view> |
</view> |
||||
<win-scan-button @goScan="openScanPopup"></win-scan-button> |
<win-scan-button @goScan="openScanPopup"></win-scan-button> |
||||
</view> |
</view> |
||||
<com-repleinsh-request-popup ref="comRepleinshRequestPopupRef" :toLocationAreaTypeList="toLocationAreaTypeList" @confirm="requestConfirm" :itemCodeTypeList="itemCodeTypeList"> </com-repleinsh-request-popup> |
<winComScanBalance ref="scanPopup" @getBalance="getScanResult" :bussinessCode="businessTypeCode"> </winComScanBalance> |
||||
<win-scan-button v-if="detailSource.length > 0" @goScan="openScanDetailPopup"></win-scan-button> |
<comMessage ref="comMessage"></comMessage> |
||||
<com-scan-issue-pack ref="comScanIssuePackRef" @closeScan="closeScan" @updateData="updateData"> </com-scan-issue-pack> |
|
||||
<com-message ref="comMessageRef" /> |
|
||||
</view> |
</view> |
||||
</template> |
</template> |
||||
|
|
||||
<script setup lang="ts"> |
<script> |
||||
import { ref, getCurrentInstance, nextTick } from 'vue' |
import { repleinshRecordSubmit, validateItemAndLocation, getPutawayRecommendLocation, getBalanceByFilter, getBalanceByBatchOffShelf } from '@/api/request2.js' |
||||
import { onLoad, onNavigationBarButtonTap, onReady, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app' |
|
||||
import { repleinshRecordSubmit, getBalanceByBatchOffShelf } from '@/api/request2.js' |
|
||||
|
|
||||
import { calc } from '@/common/calc.js' |
import { goHome, updateTitle, getCurrDateTime, getPackingNumberAndBatchByList, deepCopyData } from '@/common/basic.js' |
||||
|
|
||||
import { goHome, getCurrDateTime, getPackingNumberAndBatch } from '@/common/basic.js' |
import { calc } from '@/common/calc.js' |
||||
|
|
||||
import { getInventoryStatusDesc, getDirectoryItemArray } from '@/common/directory.js' |
import { getInventoryStatusDesc, getDirectoryItemArray } from '@/common/directory.js' |
||||
|
|
||||
import { getDetailOption, getDetailRemoveOption, getDetailEditRemoveOption } from '@/common/array.js' |
import { getBusinessType, createItemInfo, createDetailInfo, calcHandleQty } from '@/common/record.js' |
||||
|
|
||||
import { getBusinessType, calcHandleQty } from '@/common/record.js' |
|
||||
|
|
||||
import { getDataSource } from '@/pages/issue/js/issue.js' |
|
||||
|
|
||||
import { getManagementPrecisions } from '@/common/balance.js' |
import { getManagementPrecisions, getPrecisionStrategyList, getPrecisionStrategyParams } from '@/common/balance.js' |
||||
|
|
||||
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
||||
import winScanPack from '@/mycomponents/scan/winScanPack.vue' |
import winScanPack from '@/mycomponents/scan/winScanPack.vue' |
||||
|
import requiredLocation from '@/mycomponents/location/requiredLocation.vue' |
||||
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
||||
|
import winScanLocation from '@/mycomponents/scan/winScanLocation.vue' |
||||
import winScanPackAndLocation from '@/mycomponents/scan/winScanPackAndLocation.vue' |
import winScanPackAndLocation from '@/mycomponents/scan/winScanPackAndLocation.vue' |
||||
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' |
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' |
||||
import comRepleinshRequestPopup from '@/pages/repleinsh/coms/comRepleinshRequestPopup.vue' |
import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue' |
||||
import comIssueDetailCard from '@/pages/issue/coms/comIssueDetailCard.vue' |
import balance from '@/mycomponents/balance/balance.vue' |
||||
import comScanIssuePack from '@/pages/issue/coms/comScanIssuePack.vue' |
|
||||
import { useCountStore } from '@/store' |
export default { |
||||
// 获取自定义的store |
components: { |
||||
const store = useCountStore() |
winScanButton, |
||||
const { proxy } = getCurrentInstance() |
winScanPack, |
||||
const id = ref('') |
requiredLocation, |
||||
const receiptJob = ref({}) |
comBlankView, |
||||
const subList = ref([]) // 接口返回的任务subList |
winScanLocation, |
||||
const detailSource = ref([]) // 绑定在页面上的数据源 |
winScanPackAndLocation, |
||||
const businessTypeInfo = ref({}) |
recordComDetailCard, |
||||
const fromLocationCode = ref('') |
winComScanBalance, |
||||
const toLocationCode = ref('') |
balance |
||||
const toLocationAreaTypeList = ref([]) |
}, |
||||
const allowModifyLocation = ref(false) |
data() { |
||||
const businessType = ref({}) |
return { |
||||
const requestList = ref([]) |
id: '', |
||||
const managementList = ref([]) |
dataContent: {}, // 内容 |
||||
const dataContent = ref({}) |
detailSource: [], // 绑定在页面上的数据源 |
||||
const itemCodeTypeList = ref([]) |
fromLocationCode: '', |
||||
const comRepleinshDetailCard = ref() |
fromLocationAreaTypeList: [], |
||||
const comRepleinshRequestPopupRef = ref() |
toLocationAreaTypeList: [], |
||||
const comScanIssuePackRef = ref() |
inInventoryStatus: '', // 目标入库库存状态 |
||||
const comMessageRef = ref() |
outInventoryStatus: '', // 来源出库库存状态 |
||||
onLoad((option) => { |
businessType: {}, |
||||
const typeCode = 'Repleinment' |
showToLoaction: true, |
||||
getBusinessType(typeCode, (res) => { |
recommendLocationList: [], // 推荐库位列表 |
||||
|
fromWarehouseCode: '', // 来源仓库 |
||||
|
businessTypeCode: 'Repleinment', |
||||
|
toLocationCode: '', |
||||
|
resultData: {}, |
||||
|
itemCode: '', |
||||
|
recommendList: [] |
||||
|
} |
||||
|
}, |
||||
|
onLoad(option) { |
||||
|
uni.setNavigationBarTitle({ |
||||
|
title: option.title |
||||
|
}) |
||||
|
this.clear() |
||||
|
this.getBusinessType() |
||||
|
}, |
||||
|
// 返回首页 |
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
goHome() |
||||
|
} |
||||
|
}, |
||||
|
// 拦截返回按钮事件 |
||||
|
onBackPress(e) {}, |
||||
|
|
||||
|
onPullDownRefresh() {}, |
||||
|
|
||||
|
mounted() {}, |
||||
|
|
||||
|
methods: { |
||||
|
getBusinessType() { |
||||
|
getBusinessType(this.businessTypeCode, (res) => { |
||||
if (res.success) { |
if (res.success) { |
||||
businessType.value = res.businessType |
this.businessType = res.businessType |
||||
itemCodeTypeList.value = res.itemCodeTypeList |
this.fromInventoryStatuses = getDirectoryItemArray(res.fromInventoryStatuses) |
||||
toLocationAreaTypeList.value = res.toLocationAreaTypeList |
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList |
||||
showRequestPopup() |
this.openScanPopup() |
||||
} else { |
} else { |
||||
showErrorMessage(res.message) |
this.showErrorMessage(res.message) |
||||
} |
} |
||||
}) |
}) |
||||
|
}, |
||||
|
getBalance(label, packageInfo, callback) { |
||||
|
const filters = [] |
||||
|
|
||||
|
if (packageInfo.parentNumber) { |
||||
|
const packingNumber = `${packageInfo.parentNumber},${label.packingNumber}` |
||||
|
filters.push({ |
||||
|
column: 'packingNumber', |
||||
|
action: 'in', |
||||
|
value: packingNumber |
||||
}) |
}) |
||||
onNavigationBarButtonTap((e) => { |
} else { |
||||
if (e.index === 0) { |
filters.push({ |
||||
goHome() |
column: 'packingNumber', |
||||
} |
action: '==', |
||||
|
value: label.packingNumber |
||||
}) |
}) |
||||
const closeScan = () => { |
|
||||
resizeCollapse() |
|
||||
} |
} |
||||
const resizeCollapse = () => { |
|
||||
nextTick((r) => { |
filters.push({ |
||||
comRepleinshDetailCard.value.forEach((r) => { |
column: 'itemCode', |
||||
r.resizeCollapse() |
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 |
||||
}) |
}) |
||||
} |
} |
||||
const showRequestPopup = () => { |
|
||||
comRepleinshRequestPopupRef.value.openRequestPopup() |
const params = { |
||||
|
filters, |
||||
|
pageNo: 1, |
||||
|
pageSize: 100 |
||||
} |
} |
||||
// 确定需求信息 |
getBalanceByFilter(params) |
||||
const requestConfirm = (action, item) => { |
.then((res) => { |
||||
if (item.itemCode == '' || item.itemCode == null) return |
callback(res.data) |
||||
const request = requestList.value.find((r) => r.itemCode == item.itemCode) |
|
||||
if (request == undefined) { |
|
||||
requestList.value.push(item) |
|
||||
getRecommendInfo(item) |
|
||||
} else { |
|
||||
comMessageRef.value.showQuestionMessage(`已经存在物料[${item.itemCode}]的需求信息,是否要修改?`, (res) => { |
|
||||
if (type == 'itemCode') { |
|
||||
request.qty = item.qty |
|
||||
detailSource.value.forEach((detail) => { |
|
||||
const index = detail.Items.findIndex((r) => { |
|
||||
r.itemCode == item.itemCode |
|
||||
}) |
}) |
||||
detail.Items.splice(index, 1) |
.catch((err) => { |
||||
|
this.showErrorMessage(err.message) |
||||
}) |
}) |
||||
getRecommendInfo(item) |
}, |
||||
|
|
||||
|
getScanResult(result) { |
||||
|
const that = this |
||||
|
const pack = result.package |
||||
|
if (that.recommendList.length > 0) { |
||||
|
const recommend = that.recommendList.filter((r) => r.itemCode == pack.itemCode) |
||||
|
if (recommend.length == 0) { |
||||
|
this.showErrorMessage(`物料代码【${pack.itemCode}】不在推荐列表中`) |
||||
|
} else { |
||||
|
const batch = recommend.find((r) => r.batch == pack.batch) |
||||
|
if (batch == undefined) { |
||||
|
that.showErrorMessage(`扫描的批次【${pack.batch}】,不是系统推荐的批次,不满足系统的先进先出规则,请重新扫描物料`) |
||||
|
} else { |
||||
|
this.setData(result) |
||||
} |
} |
||||
}) |
|
||||
} |
} |
||||
|
} else { |
||||
|
this.getRecommendInfo(result) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
getRecommendInfo(result) { |
||||
|
const that = this |
||||
|
uni.showLoading({ |
||||
|
title: '加载中...', |
||||
|
mask: true |
||||
|
}) |
||||
|
const item = { |
||||
|
itemCode: result.package.itemCode, |
||||
|
qty: result.package.qty |
||||
} |
} |
||||
const getRecommendInfo = (item) => { |
|
||||
proxy.$modal.loading('加载中...') |
|
||||
getBalanceByBatchOffShelf(item.itemCode, item.qty) |
getBalanceByBatchOffShelf(item.itemCode, item.qty) |
||||
.then((res) => { |
.then((res) => { |
||||
if (res.data == null) { |
if (res.data == null) { |
||||
showMessage('未获取到推荐信息') |
that.showErrorMessage('未获取到推荐信息') |
||||
} else { |
} else { |
||||
if (res.data.length > 0) { |
if (res.data.length > 0) { |
||||
res.data.forEach((r) => { |
that.recommendList = res.data |
||||
r.toLocationCode = item.toLocation.code |
that.recommendList.forEach((r) => (r.locationCode = r.fromLocationCode)) |
||||
r.itemName = item.itemName |
const recommendInfo = res.data[0] |
||||
r.uom = item.uom |
if (recommendInfo.batch != result.package.batch) { |
||||
subList.value.push(r) |
that.showErrorMessage(`扫描的批次【${result.package.batch}】,不是系统推荐的批次【${recommendInfo.batch}】,不满足系统的先进先出规则,请重新扫描`) |
||||
}) |
} else { |
||||
|
this.setData(result) |
||||
detailSource.value = getDataSource(detailSource.value, subList.value) |
} |
||||
// 要修改一下数量 |
|
||||
detailSource.value.forEach((detail) => { |
|
||||
detail.Items.forEach((i) => { |
|
||||
const request = requestList.value.find((r) => r.itemCode == i.itemCode) |
|
||||
i.qty = request.qty |
|
||||
}) |
|
||||
}) |
|
||||
// that.resizeCollapse(); |
|
||||
} else { |
} else { |
||||
showMessage('列表数据为0') |
that.showErrorMessage('未查找到物料的推荐信息') |
||||
} |
} |
||||
uni.hideLoading() |
uni.hideLoading() |
||||
} |
} |
||||
}) |
}) |
||||
.catch((error) => { |
.catch((error) => { |
||||
uni.hideLoading() |
uni.hideLoading() |
||||
showErrorMessage(error) |
that.showErrorMessage(error) |
||||
}) |
}) |
||||
|
}, |
||||
|
|
||||
|
setData(result) { |
||||
|
const { balance } = result |
||||
|
const { label } = result |
||||
|
const pack = result.package |
||||
|
if (this.fromLocationCode && this.fromLocationCode != balance.locationCode) { |
||||
|
this.showErrorMessage(`箱码[${balance.packingNumber}批次[${balance.batch}]在库位[${this.fromLocationCode}]没有库存余额`) |
||||
|
return |
||||
} |
} |
||||
|
|
||||
const caclcQty = () => { |
const item = this.detailSource.find((res) => { |
||||
const totalQty = 0 |
if (res.itemCode == balance.itemCode) { |
||||
detailSource.value.subList.forEach((res) => { |
return res |
||||
totalQty.value = calc.add(totalQty, res.qty) |
|
||||
}) |
|
||||
detailSource.value.totalQty = totalQty |
|
||||
} |
|
||||
|
|
||||
const openScanDetailPopup = () => { |
|
||||
const datacontent = {} |
|
||||
// 克隆对象,深度克隆,防止双向绑定同一个变量 |
|
||||
// Object.assign(datacontent, this.detailSource); |
|
||||
const dataContent1 = { |
|
||||
allowModifyPackingNumber: 'FALSE', |
|
||||
outInventoryStatuses: fromInventoryStatuses.value |
|
||||
} |
|
||||
comScanIssuePackRef.value.openScanPopup(detailSource.value, dataContent1) |
|
||||
} |
|
||||
|
|
||||
const updateData = (record) => { |
|
||||
const requestLocation = detailSource.value.find((r) => r.toLocationCode == record.toLocationCode) |
|
||||
const item = requestLocation.Items.find((r) => r.itemCode == record.itemCode) |
|
||||
let itemHandleQty = 0 |
|
||||
if (item != undefined) { |
|
||||
item.Locations.forEach((l) => { |
|
||||
const batch = l.Batchs.find((b) => (b.packingNumber == record.packingNumber || b.packingNumber == null || b.packingNumber == '') && b.batch == record.batch) |
|
||||
let handleQty = 0 |
|
||||
if (batch != undefined) { |
|
||||
batch.Records.forEach((res) => { |
|
||||
handleQty = calc.add(handleQty, res.qty) |
|
||||
}) |
|
||||
batch.handleQty = handleQty |
|
||||
itemHandleQty = calc.add(itemHandleQty, handleQty) |
|
||||
} |
} |
||||
}) |
}) |
||||
|
if (item == undefined) { |
||||
|
if (this.itemCode != '' && this.itemCode != balance.itemCode) { |
||||
|
this.showErrorMessage(`请扫描物料为【${this.itemCode}】的箱码`) |
||||
|
return |
||||
} |
} |
||||
resizeCollapse() |
if (this.fromWarehouseCode == '') { |
||||
// item.handleQty=itemHandleQty; |
this.fromWarehouseCode = balance.warehouseCode |
||||
// this.closeScan(); |
} |
||||
|
const itemp = createItemInfo(balance, pack) |
||||
|
const newDetail = createDetailInfo(balance, pack) // |
||||
|
newDetail.parentNumber = pack.parentNumber |
||||
|
newDetail.packingNumber = pack.number |
||||
|
newDetail.packUnit = pack.packUnit |
||||
|
newDetail.packQty = pack.packQty |
||||
|
if (balance.lableQty) { |
||||
|
newDetail.handleQty = balance.lableQty |
||||
|
} |
||||
|
itemp.subList.push(newDetail) |
||||
|
this.detailSource.push(itemp) |
||||
|
this.itemCode = balance.itemCode |
||||
|
this.fromLocationCode = balance.locationCode |
||||
|
this.scanPopupGetFocus() |
||||
|
} else { |
||||
|
const detail = item.subList.find((r) => { |
||||
|
if (r.packingNumber == pack.number && r.batch == balance.batch && r.locationCode == balance.locationCode && r.inventoryStatus == balance.inventoryStatus) { |
||||
|
return r |
||||
} |
} |
||||
|
}) |
||||
const calcHandleQty = () => { |
if (detail == undefined) { |
||||
for (const item of detailSource.value) { |
const newDetail = createDetailInfo(balance, pack) |
||||
item.qty = 0 |
newDetail.parentNumber = pack.parentNumber |
||||
for (const detail of item.subList) { |
newDetail.packingNumber = pack.number |
||||
if (detail != undefined) { |
newDetail.packUnit = pack.packUnit |
||||
item.qty = calc.add(item.qty, detail.qty) |
newDetail.packQty = pack.packQty |
||||
|
if (balance.lableQty) { |
||||
|
newDetail.handleQty = balance.lableQty |
||||
} |
} |
||||
|
item.subList.push(newDetail) |
||||
|
this.scanPopupGetFocus() |
||||
|
} else if (detail.scaned == true) { |
||||
|
this.showErrorMessage(`箱码[${detail.packingNumber}批次[${balance.batch}]已经在列表中`) |
||||
} |
} |
||||
} |
} |
||||
|
calcHandleQty(this.detailSource) |
||||
|
}, |
||||
|
|
||||
|
showErrorMessage(message) { |
||||
|
this.$refs.comMessage.showErrorMessage(message, (res) => { |
||||
|
if (res) { |
||||
|
this.scanPopupGetFocus() |
||||
} |
} |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
const removeItem = (index, item) => { |
updateData() { |
||||
detailSource.value.splice(index, 1) |
calcHandleQty(this.detailSource) |
||||
|
for (let i = 0; i < this.detailSource.length; i++) { |
||||
|
const item = this.detailSource[i] |
||||
|
if (item.qty == 0) { |
||||
|
this.detailSource.splice(i, 1) |
||||
} |
} |
||||
const removePack = () => { |
|
||||
for (let i = 0; i < detailSource.value.length; i++) { |
|
||||
const item = detailSource.value[i] |
|
||||
if (item.subList.length == 0) { |
|
||||
detailSource.value.splice(i, 1) |
|
||||
} |
} |
||||
|
this.$forceUpdate() |
||||
|
}, |
||||
|
|
||||
|
removeItem(index, item) { |
||||
|
this.detailSource.splice(index, 1) |
||||
|
this.updateData() |
||||
|
}, |
||||
|
|
||||
|
removePack() { |
||||
|
for (let i = 0; i < this.detailSource.length; i++) { |
||||
|
const item = this.detailSource[i] |
||||
|
if (item.subList.length == 0) { |
||||
|
this.detailSource.splice(i, 1) |
||||
} |
} |
||||
updateData() |
|
||||
} |
} |
||||
|
this.updateData() |
||||
|
}, |
||||
|
|
||||
const openScanPopup = () => { |
openScanPopup() { |
||||
scanPopup.value.openScanPopupForType(fromLocationCode.value, businessType.value) |
if (this.businessType) { |
||||
|
this.$refs.scanPopup.openScanPopup(this.businessType) |
||||
|
} else { |
||||
|
this.getBusinessType() |
||||
} |
} |
||||
|
}, |
||||
|
|
||||
const showFromLocationPopup = () => { |
closeScanPopup() { |
||||
nextTick(() => { |
if (this.$refs.scanPopup) { |
||||
scanLocationCode.value.openScanPopup() |
this.$refs.scanPopup.closeScanPopup() |
||||
}) |
|
||||
} |
} |
||||
|
}, |
||||
|
|
||||
const closeScanPopup = () => { |
scanPopupGetFocus() { |
||||
if (scanPopup.value != undefined) { |
if (this.$refs.scanPopup) { |
||||
scanPopup.value.closeScanPopup() |
this.$refs.scanPopup.getfocus() |
||||
} |
|
||||
} |
} |
||||
|
}, |
||||
|
|
||||
const scanPopupGetFocus = () => { |
scanLocationCode(location, code) { |
||||
if (scanPopup.value != undefined) { |
this.toLocationCode = code |
||||
scanPopup.value.getfocus() |
}, |
||||
} |
|
||||
|
commit() { |
||||
|
if (this.toLocationCode == '') { |
||||
|
this.showMessage('请输入目标库位') |
||||
|
return |
||||
} |
} |
||||
|
|
||||
const submit = () => { |
if (this.detailSource.length == 0) { |
||||
if (getScanCount()) { |
this.showMessage('请扫描要发货的物料') |
||||
showErrorMessage('当前扫描数为0,请先扫描在提交') |
|
||||
return |
return |
||||
} |
} |
||||
|
|
||||
|
this.detailSource.forEach((item) => { |
||||
|
item.subList.forEach((detail) => { |
||||
|
detail.toLocationCode = this.toLocationCode |
||||
|
detail.fromLocation = this.fromLocationCode |
||||
|
}) |
||||
|
}) |
||||
|
|
||||
uni.showLoading({ |
uni.showLoading({ |
||||
title: '提交中....', |
title: '提交中....', |
||||
mask: true |
mask: true |
||||
}) |
}) |
||||
|
|
||||
// 目前任务只到一个库位 |
// 记录有目标库位,需要查询管理模式 |
||||
const itemCodes = [] |
const precisionStrategyParams = getPrecisionStrategyParams(this.detailSource) |
||||
const locationCode = detailSource.value[0].toLocationCode |
// 2:获取管理模式,封装参数 |
||||
detailSource.value.forEach((toLocation) => { |
getPrecisionStrategyList(precisionStrategyParams, (res) => { |
||||
toLocation.Items.forEach((item) => { |
|
||||
itemCodes.push(item.itemCode) |
|
||||
}) |
|
||||
}) |
|
||||
|
|
||||
// 获取管理模式,封装参数 |
|
||||
getManagementPrecisions(itemCodes, locationCode, (res) => { |
|
||||
if (res.success) { |
if (res.success) { |
||||
managementList.value = res.list |
this.managementList = res.list |
||||
submitJob() |
const params = this.setRecordParams() |
||||
} else { |
console.log('提交参数', JSON.stringify(params)) |
||||
uni.hideLoading() |
|
||||
showErrorMessage(res.message) |
|
||||
} |
|
||||
}) |
|
||||
} |
|
||||
|
|
||||
const submitJob = () => { |
|
||||
const params = setParams() |
|
||||
repleinshRecordSubmit(params) |
repleinshRecordSubmit(params) |
||||
.then((res) => { |
.then((res) => { |
||||
uni.hideLoading() |
uni.hideLoading() |
||||
if (res.data) { |
if (res.data) { |
||||
showCommitSuccessMessage(`提交成功<br>生成补料记录<br>${res.data}`) |
this.showCommitSuccessMessage(`提交成功<br>生成直接补料记录<br>${res.data}`) |
||||
} else { |
} else { |
||||
showErrorMessage(`提交失败[${res.msg}]`) |
this.showErrorMessage(`提交失败[${res.msg}]`) |
||||
} |
} |
||||
}) |
}) |
||||
.catch((error) => { |
.catch((error) => { |
||||
uni.hideLoading() |
uni.hideLoading() |
||||
showErrorMessage(error) |
this.showErrorMessage(error) |
||||
}) |
}) |
||||
|
} else { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(res.message) |
||||
} |
} |
||||
const setParams = () => { |
|
||||
const subList = [] |
|
||||
const createTime = getCurrDateTime() |
|
||||
const creator = store.id |
|
||||
detailSource.value.forEach((toLocationCode) => { |
|
||||
toLocationCode.Items.forEach((item) => { |
|
||||
item.Locations.forEach((fromLocation) => { |
|
||||
fromLocation.Batchs.forEach((batch) => { |
|
||||
const subItem = batch.detail |
|
||||
subItem.recordList = [] |
|
||||
|
|
||||
if (batch.Records.length > 0) { |
|
||||
batch.Records.forEach((r) => { |
|
||||
const record = {} |
|
||||
record.handleQty = r.qty |
|
||||
|
|
||||
record.fromPackingNumber = r.packingNumber |
|
||||
record.fromBatch = r.batch |
|
||||
record.fromContainerNumber = r.ContainerNumber |
|
||||
|
|
||||
record.toContainerNumber = r.ContainerNumber |
|
||||
record.toInventoryStatus = r.inventoryStatus |
|
||||
record.toLocationCode = subItem.toLocationCode |
|
||||
record.fromLocationCode = fromLocation.fromLocationCode |
|
||||
record.supplierCode = r.supplierCode |
|
||||
|
|
||||
// 使用在途库不改变管理模式 |
|
||||
const info = getPackingNumberAndBatch(this.managementList, r.itemCode, r.packingNumber, r.batch) |
|
||||
record.toPackingNumber = info.packingNumber |
|
||||
record.toBatch = info.batch |
|
||||
subItem.recordList.push(record) |
|
||||
}) |
|
||||
subList.push(subItem) |
|
||||
} |
|
||||
}) |
|
||||
}) |
}) |
||||
}) |
}, |
||||
}) |
|
||||
|
|
||||
dataContent.value.subList = subList |
|
||||
dataContent.value.createTime = createTime |
|
||||
dataContent.value.creator = creator |
|
||||
return dataContent.value |
|
||||
} |
|
||||
|
|
||||
const getScanCount = () => { |
setRecordParams() { |
||||
let scanCount = 0 |
|
||||
const subList = [] |
const subList = [] |
||||
detailSource.value.forEach((toLocationCode) => { |
const creator = this.$store.state.user.id |
||||
toLocationCode.Items.forEach((item) => { |
this.detailSource.forEach((item) => { |
||||
item.Locations.forEach((fromLocation) => { |
item.subList.forEach((detail) => { |
||||
fromLocation.Batchs.forEach((batch) => { |
if (detail.scaned) { |
||||
const subItem = batch.detail |
const info = getPackingNumberAndBatchByList(this.managementList, detail.itemCode, detail.packingNumber, detail.toLocationCode, detail.batch) |
||||
subItem.recordList = [] |
const submitItem = deepCopyData(detail) |
||||
|
submitItem.toPackingNumber = info.packingNumber |
||||
if (batch.Records.length > 0) { |
submitItem.toBatch = info.batch |
||||
batch.Records.forEach((r) => { |
submitItem.toContainerNumber = detail.containerNumber |
||||
const record = {} |
|
||||
record.handleQty = r.qty |
submitItem.fromPackingNumber = info.packingNumber |
||||
subItem.recordList.push(record) |
submitItem.fromBatch = info.batch |
||||
}) |
submitItem.fromContainerNumber = detail.containerNumber |
||||
subList.push(subItem) |
|
||||
} |
submitItem.fromLocationCode = detail.locationCode |
||||
}) |
submitItem.toLocationCode = detail.toLocationCode |
||||
}) |
|
||||
}) |
// detail.toInventoryStatus = detail.inventoryStatus |
||||
}) |
// detail.toLocationCode = detail.toLocationCode |
||||
return (scanCount = subList.length) |
submitItem.qty = detail.handleQty |
||||
} |
submitItem.package = '' |
||||
|
submitItem.recordList = [ |
||||
const showMessage = (message) => { |
{ |
||||
comMessageRef.value.showMessage(message, (res) => { |
toInventoryStatus: detail.inventoryStatus, |
||||
|
fromPackingNumber: info.packingNumber, |
||||
|
fromParentPackingNumber: detail.parentNumber, |
||||
|
fromBatch: info.batch, |
||||
|
|
||||
|
toPackingNumber: info.packingNumber, |
||||
|
|
||||
|
toBatch: info.batch, |
||||
|
fromLocationCode: detail.locationCode, |
||||
|
toLocationCode: detail.toLocationCode, |
||||
|
handleQty: detail.handleQty, |
||||
|
fromPackUnit: detail.packUnit, |
||||
|
toPackUnit: detail.packUnit, |
||||
|
fromPackQty: detail.packQty, |
||||
|
toPackQty: detail.packQty |
||||
|
} |
||||
|
] |
||||
|
subList.push(submitItem) |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
if (subList.length > 0) { |
||||
|
this.dataContent.toWarehouseCode = subList[0].toWarehouseCode |
||||
|
} |
||||
|
this.dataContent.subList = subList |
||||
|
this.dataContent.creator = creator |
||||
|
this.dataContent.fromWarehouseCode = this.fromWarehouseCode |
||||
|
return this.dataContent |
||||
|
}, |
||||
|
|
||||
|
showMessage(message) { |
||||
|
this.$refs.comMessage.showMessage(message, (res) => { |
||||
if (res) { |
if (res) { |
||||
} |
} |
||||
}) |
}) |
||||
} |
}, |
||||
const showErrorMessage = (message) => { |
|
||||
comMessageRef.value.showErrorMessage(message, (res) => { |
|
||||
if (res) { |
|
||||
} |
|
||||
}) |
|
||||
} |
|
||||
const showScanMessage = (message) => { |
|
||||
comMessageRef.value.showScanMessage(message) |
|
||||
} |
|
||||
|
|
||||
const afterCloseMessage = () => { |
showScanMessage(message) { |
||||
scanPopupGetFocus() |
this.$refs.comMessage.showScanMessage(message) |
||||
} |
}, |
||||
const closeScanMessage = () => { |
|
||||
scanPopupGetFocus() |
afterCloseMessage() { |
||||
} |
this.scanPopupGetFocus() |
||||
const getLocation = (location, code) => { |
}, |
||||
getToLocationCode(location, code) |
|
||||
} |
|
||||
const getFromLocationCode = (location, code) => { |
|
||||
fromLocationCode.value = code |
|
||||
openScanPopup() |
|
||||
} |
|
||||
const getToLocationCode = (location, code) => { |
|
||||
// if (this.fromLocationCode == code) { |
|
||||
// uni.showToast({ |
|
||||
// title: "来源库位[" + this.fromLocationCode + "]不能与目标库位[" + code + "]一致", |
|
||||
// duration: 2000 |
|
||||
// }) |
|
||||
// return |
|
||||
// } |
|
||||
toLocationCodeInfo.value = location |
|
||||
toLocationCode.value = code |
|
||||
} |
|
||||
|
|
||||
const showCommitSuccessMessage = (hint) => { |
closeScanMessage() { |
||||
comMessageRef.value.showSuccessMessage(hint, (res) => { |
this.scanPopupGetFocus() |
||||
clearData() |
}, |
||||
|
getToLocationCode(location, code) { |
||||
|
if (this.fromLocationCode == code) { |
||||
|
uni.showToast({ |
||||
|
title: `来源库位[${this.fromLocationCode}]不能与目标库位[${code}]一致`, |
||||
|
duration: 2000 |
||||
}) |
}) |
||||
|
return |
||||
} |
} |
||||
const clearData = () => { |
this.toLocationCode = code |
||||
fromLocationCode.value = '' |
}, |
||||
detailSource.value = [] |
|
||||
requestList.value = [] |
|
||||
dataContent.value = {} |
|
||||
managementList.value = [] |
|
||||
} |
|
||||
</script> |
|
||||
|
|
||||
<style scoped lang="scss"> |
showCommitSuccessMessage(hint) { |
||||
page { |
this.$refs.comMessage.showSuccessMessage(hint, (res) => { |
||||
width: 100%; |
this.clear() |
||||
height: 100%; |
}) |
||||
background-color: #fff; |
}, |
||||
} |
|
||||
|
|
||||
.page-wraper { |
clear() { |
||||
display: flex; |
this.fromLocationCode = '' |
||||
flex-direction: column; |
this.fromWarehouseCode = '' |
||||
width: 100%; |
this.toWarehouseCode = '' |
||||
height: 100%; |
this.detailSource = [] |
||||
|
this.toLocationCode = '' |
||||
|
this.itemCode = '' |
||||
} |
} |
||||
|
|
||||
.page-main { |
|
||||
flex: 1; |
|
||||
position: relative; |
|
||||
} |
} |
||||
|
|
||||
.page-main-scroll { |
|
||||
position: absolute; |
|
||||
left: 0; |
|
||||
right: 0; |
|
||||
top: 0; |
|
||||
bottom: 0; |
|
||||
} |
} |
||||
|
</script> |
||||
|
|
||||
.page-main-list { |
<style scoped lang="scss"></style> |
||||
/* height: 80rpx; |
|
||||
line-height: 80rpx; */ |
|
||||
text-align: center; |
|
||||
background: #e0e0e0; |
|
||||
} |
|
||||
</style> |
|
||||
|
Loading…
Reference in new issue