zhang_li
5 months ago
6 changed files with 1510 additions and 300 deletions
File diff suppressed because it is too large
@ -0,0 +1,349 @@ |
|||
<template> |
|||
<view class="page-wraper"> |
|||
<view class="" v-if="detailSource.length == 0"> |
|||
<com-blank-view @goScan="goScan(true)"></com-blank-view> |
|||
</view> |
|||
<view v-else class="page-wraper"> |
|||
<view class="page-main"> |
|||
<scroll-view scroll-y="true" class=""> |
|||
<view v-for="(toLocation, index) in detailSource"> |
|||
<view class="uni-row uni-flex"> |
|||
<!-- <com-issue-request-info :workShopCode="workShopCode" :dataContent="toLocation"> |
|||
</com-issue-request-info> --> |
|||
<work-station :workshopCode="workShopCode" :productionLineCode="toLocation.productionLineCode" :workStationCode="toLocation.workStationCode" :rawLocationCode="toLocation.toLocationCode"></work-station> |
|||
</view> |
|||
<com-issue-detail-card ref="comIssueDetailCardRef" :dataContent="toLocation" @updateData="updateData" @removeItemCode="removeItemCode"> </com-issue-detail-card> |
|||
</view> |
|||
</scroll-view> |
|||
<button class="btn_add" @click="goScan(false)">+去添加</button> |
|||
</view> |
|||
|
|||
<view class="page-footer"> |
|||
<view class="uni-flex u-col-center space-between padding_10" style="background-color: ghostwhite; width: 100%"> |
|||
<view class=""> </view> |
|||
<view class="uni-flex uni-row"> |
|||
<button class="btn_single_commit" hover-class="btn_commit_after" @click="submit()">提交</button> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<com-issue-request-popup ref="comIssueRequestPopupRef" @confirm="requestConfirm" :itemCodeTypeList="itemCodeTypeList"></com-issue-request-popup> |
|||
<win-scan-button v-if="detailSource.length > 0" @goScan="openScanDetailPopup"></win-scan-button> |
|||
<com-scan-issue-pack ref="comScanIssuePackRef" @closeScan="closeScan" @updateData="updateData"> </com-scan-issue-pack> |
|||
<com-message ref="comMessageRef" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import { ref, getCurrentInstance, nextTick } from 'vue' |
|||
import { onLoad, onNavigationBarButtonTap, onReady, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app' |
|||
import { issueRecordSubmit, getBalanceByBatchOffShelf } from '@/api/request2.js' |
|||
|
|||
import { goHome, getRemoveOption, getISODateTime, getCurrDateTime, getPackingNumberAndBatch } from '@/common/basic.js' |
|||
|
|||
import { getDataSource } from '@/pages/issue/js/issue.js' |
|||
import { getBusinessType } from '@/common/record.js' |
|||
import { calc } from '@/common/calc.js' |
|||
|
|||
import { getManagementPrecisions } from '@/common/balance.js' |
|||
|
|||
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
|||
import comIssueRequestPopup from '@/pages/issue/coms/comIssueRequestPopup.vue' |
|||
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue' |
|||
import comIssueRequestCreator from '@/pages/issue/coms/comIssueRequestCreator.vue' |
|||
import comIssueRequestInfo from '@/pages/issue/coms/comIssueRequestInfo.vue' |
|||
import comIssueDetailCard from '@/pages/issue/coms/comIssueDetailCard.vue' |
|||
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|||
import comScanIssuePack from '@/pages/issue/coms/comScanIssuePack.vue' |
|||
import workStation from '@/mycomponents/workStation/workStation.vue' |
|||
|
|||
import { useCountStore } from '@/store' |
|||
// 获取自定义的store |
|||
const store = useCountStore() |
|||
const { proxy } = getCurrentInstance() |
|||
const subList = ref([]) // 接口返回的任务subList |
|||
const dataContent = ref({}) |
|||
const detailSource = ref([]) // 绑定在页面上的数据源 |
|||
const detailOptions = ref([]) |
|||
const scanOptions = ref([]) |
|||
const workShopCode = ref('') |
|||
const fromInventoryStatuses = ref('') |
|||
const toInventoryStatuses = ref('') |
|||
const requestList = ref([]) |
|||
const managementList = ref([]) |
|||
const itemCodeTypeList = ref([]) |
|||
const comIssueDetailCardRef = ref() |
|||
const comIssueRequestPopupRef = ref() |
|||
const comScanIssuePackRef = ref() |
|||
onNavigationBarButtonTap((e) => { |
|||
if (e.index === 0) { |
|||
goHome() |
|||
} |
|||
}) |
|||
onLoad((option) => { |
|||
const typeCode = 'Issue' |
|||
getBusinessType(typeCode, (res) => { |
|||
if (res.success) { |
|||
businessType.value = res.businessType |
|||
itemCodeTypeList.value = res.itemCodeTypeList |
|||
fromInventoryStatuses.value = res.fromInventoryStatuses |
|||
toInventoryStatuses.value = res.toInventoryStatuses |
|||
goScan(true) |
|||
} else { |
|||
showErrorMessage(res.message) |
|||
} |
|||
}) |
|||
}) |
|||
const closeScan = () => { |
|||
resizeCollapse() |
|||
} |
|||
const resizeCollapse = () => { |
|||
nextTick((r) => { |
|||
comIssueDetailCardRef.value.forEach((r) => { |
|||
r.resizeCollapse() |
|||
}) |
|||
}) |
|||
} |
|||
const goScan = (editPosition) => { |
|||
comIssueRequestPopupRef.value.openRequestPopup(editPosition) |
|||
} |
|||
|
|||
// 确定需求信息 |
|||
|
|||
const requestConfirm = (action, item) => { |
|||
if (item.itemCode == '' || item.itemCode == null) return |
|||
|
|||
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 (res) { |
|||
request.qty = item.qty |
|||
detailSource.value.forEach((detail) => { |
|||
const index = detail.Items.findIndex((r) => { |
|||
r.itemCode == item.itemCode |
|||
}) |
|||
detail.Items.splice(index, 1) |
|||
}) |
|||
getRecommendInfo(item) |
|||
} |
|||
}) |
|||
} |
|||
} |
|||
|
|||
const getRecommendInfo = (item) => { |
|||
proxy.$modal.loading('加载中....') |
|||
getBalanceByBatchOffShelf(item.itemCode, item.qty) |
|||
.then((res) => { |
|||
if (res.data == null) { |
|||
showMessage('未获取到推荐信息') |
|||
} else { |
|||
if (res.data.length > 0) { |
|||
workShopCode.value = item.workshopCode |
|||
res.data.forEach((r) => { |
|||
r.toLocationCode = item.rawLocationCode |
|||
r.productionLineCode = item.productionLineCode |
|||
r.workStationCode = item.workStationCode |
|||
// r.itemCode = item.itemCode; |
|||
r.itemName = item.itemName |
|||
r.uom = item.uom |
|||
subList.value.push(r) |
|||
}) |
|||
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 |
|||
}) |
|||
}) |
|||
resizeCollapse() |
|||
} else { |
|||
showMessage('列表数据为0') |
|||
} |
|||
uni.hideLoading() |
|||
} |
|||
}) |
|||
.catch((error) => { |
|||
uni.hideLoading() |
|||
showErrorMessage(error) |
|||
}) |
|||
} |
|||
|
|||
const caclcQty = () => { |
|||
let totalQty = 0 |
|||
detailSource.value.subList.forEach((res) => { |
|||
totalQty = calc.add(totalQty, res.qty) |
|||
}) |
|||
detailSource.value.totalQty = totalQty |
|||
} |
|||
constopenScanDetailPopup = () => { |
|||
const datacontent = {} |
|||
// 克隆对象,深度克隆,防止双向绑定同一个变量 |
|||
// Object.assign(datacontent, this.detailSource); |
|||
const dataContent = { |
|||
allowModifyPackingNumber: 'FALSE', |
|||
outInventoryStatuses: fromInventoryStatuses.value |
|||
} |
|||
comScanIssuePackRef.value.openScanPopup(detailSource.value, dataContent) |
|||
} |
|||
|
|||
const closeScanPopup = () => { |
|||
updateCommitBtn() |
|||
} |
|||
|
|||
constupdateData = (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) |
|||
} |
|||
}) |
|||
} |
|||
resizeCollapse() |
|||
// item.handleQty=itemHandleQty; |
|||
// this.closeScan(); |
|||
} |
|||
const removeItemCode = () => { |
|||
const isClear = detailSource.value[0].Items.length == 0 |
|||
if (isClear) { |
|||
clearData() |
|||
comIssueRequestPopupRef.value.initData() |
|||
} |
|||
} |
|||
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 single_price = r.singlePrice == null ? 0 : r.singlePrice |
|||
|
|||
record.singlePrice = single_price |
|||
record.amount = single_price * r.qty |
|||
|
|||
// 使用在途库不改变管理模式 |
|||
const info = getPackingNumberAndBatch(managementList.value, 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 submit = () => { |
|||
proxy.$modal.loading('提交中....') |
|||
|
|||
// 目前任务只到一个库位 |
|||
const itemCodes = [] |
|||
const locationCode = detailSource.value[0].toLocationCode |
|||
detailSource.value.forEach((toLocation) => { |
|||
toLocation.Items.forEach((item) => { |
|||
itemCodes.push(item.itemCode) |
|||
}) |
|||
}) |
|||
|
|||
// 获取管理模式,封装参数 |
|||
getManagementPrecisions(itemCodes, locationCode, (res) => { |
|||
if (res.success) { |
|||
managementList.value = res.list |
|||
submitJob() |
|||
} else { |
|||
uni.hideLoading() |
|||
showErrorMessage(res.message) |
|||
} |
|||
}) |
|||
} |
|||
|
|||
const submitJob = () => { |
|||
const params = setParams() |
|||
console.log('提交参数', JSON.stringify(params)) |
|||
issueRecordSubmit(params) |
|||
.then((res) => { |
|||
uni.hideLoading() |
|||
if (res.data) { |
|||
showCommitSuccessMessage(`提交成功<br>生成发料记录<br>${res.data}`) |
|||
} else { |
|||
showErrorMessage(`提交失败:【${res.msg}】`) |
|||
} |
|||
}) |
|||
.catch((error) => { |
|||
uni.hideLoading() |
|||
showErrorMessage(error) |
|||
}) |
|||
} |
|||
|
|||
const showCommitSuccessMessage = (hint) => { |
|||
comMessageRef.value.showSuccessMessage(hint, (res) => { |
|||
if (res) { |
|||
clearData() |
|||
comIssueRequestPopup.value.initData() |
|||
} |
|||
}) |
|||
} |
|||
|
|||
const clearData = () => { |
|||
subList.value = [] // 接口返回的任务subList |
|||
detailSource.value = [] // 绑定在页面上的数据源 |
|||
detailOptions.value = [] |
|||
scanOptions.value = [] |
|||
workShopCode.value = '' |
|||
requestList.value = [] |
|||
dataContent.value = {} |
|||
managementList.value = [] |
|||
} |
|||
const showMessage = (message) => { |
|||
comMessageRef.value.showMessage(message, (res) => { |
|||
if (res) { |
|||
afterCloseMessage() |
|||
} |
|||
}) |
|||
} |
|||
const showErrorMessage = (message) => { |
|||
comMessageRef.value.showErrorMessage(message, (res) => { |
|||
if (res) { |
|||
} |
|||
}) |
|||
} |
|||
</script> |
|||
|
|||
<style></style> |
@ -0,0 +1,465 @@ |
|||
<template> |
|||
<view class="page-wraper"> |
|||
<view class=""> |
|||
<com-blank-view @goScan="showRequestPopup" v-if="detailSource.length == 0"></com-blank-view> |
|||
</view> |
|||
<view class="page-wraper" v-if="detailSource.length > 0"> |
|||
<view class="page-main"> |
|||
<scroll-view scroll-y="true" class="page-main-scroll"> |
|||
<view class="" v-for="(toLocation, index) in detailSource" :key="index"> |
|||
<view class="u-p-t-20" style="background: white"> |
|||
<view class="page-header" style="background-color: #f5f5f5 !important; margin: 0px 20rpx"> |
|||
<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 class='split_line'></view> --> |
|||
</view> |
|||
</scroll-view> |
|||
</view> |
|||
|
|||
<view class="page-footer"> |
|||
<view class="uni-flex u-col-center space-between padding_20" style="background-color: ghostwhite; width: 100%"> |
|||
<button class="btn_single_commit" style="flex: 1" hover-class="btn_commit_after" @click="submit">提交</button> |
|||
</view> |
|||
</view> |
|||
<win-scan-button @goScan="openScanPopup"></win-scan-button> |
|||
</view> |
|||
<com-repleinsh-request-popup ref="comRepleinshRequestPopupRef" :toLocationAreaTypeList="toLocationAreaTypeList" @confirm="requestConfirm" :itemCodeTypeList="itemCodeTypeList"> </com-repleinsh-request-popup> |
|||
<win-scan-button v-if="detailSource.length > 0" @goScan="openScanDetailPopup"></win-scan-button> |
|||
<com-scan-issue-pack ref="comScanIssuePackRef" @closeScan="closeScan" @updateData="updateData"> </com-scan-issue-pack> |
|||
<com-message ref="comMessageRef" /> |
|||
</view> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import { ref, getCurrentInstance, nextTick } from 'vue' |
|||
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, getCurrDateTime, getPackingNumberAndBatch } from '@/common/basic.js' |
|||
|
|||
import { getInventoryStatusDesc, getDirectoryItemArray } from '@/common/directory.js' |
|||
|
|||
import { getDetailOption, getDetailRemoveOption, getDetailEditRemoveOption } from '@/common/array.js' |
|||
|
|||
import { getBusinessType, calcHandleQty } from '@/common/record.js' |
|||
|
|||
import { getDataSource } from '@/pages/issue/js/issue.js' |
|||
|
|||
import { getManagementPrecisions } from '@/common/balance.js' |
|||
|
|||
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|||
import winScanPack from '@/mycomponents/scan/winScanPack.vue' |
|||
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
|||
import winScanPackAndLocation from '@/mycomponents/scan/winScanPackAndLocation.vue' |
|||
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' |
|||
import comRepleinshRequestPopup from '@/pages/repleinsh/coms/comRepleinshRequestPopup.vue' |
|||
import comIssueDetailCard from '@/pages/issue/coms/comIssueDetailCard.vue' |
|||
import comScanIssuePack from '@/pages/issue/coms/comScanIssuePack.vue' |
|||
import { useCountStore } from '@/store' |
|||
// 获取自定义的store |
|||
const store = useCountStore() |
|||
const { proxy } = getCurrentInstance() |
|||
const id = ref('') |
|||
const receiptJob = ref({}) |
|||
const subList = ref([]) // 接口返回的任务subList |
|||
const detailSource = ref([]) // 绑定在页面上的数据源 |
|||
const businessTypeInfo = ref({}) |
|||
const fromLocationCode = ref('') |
|||
const toLocationCode = ref('') |
|||
const toLocationAreaTypeList = ref([]) |
|||
const allowModifyLocation = ref(false) |
|||
const businessType = ref({}) |
|||
const requestList = ref([]) |
|||
const managementList = ref([]) |
|||
const dataContent = ref({}) |
|||
const itemCodeTypeList = ref([]) |
|||
const comRepleinshDetailCard = ref() |
|||
const comRepleinshRequestPopupRef = ref() |
|||
const comScanIssuePackRef = ref() |
|||
const comMessageRef = ref() |
|||
onLoad((option) => { |
|||
const typeCode = 'Repleinment' |
|||
getBusinessType(typeCode, (res) => { |
|||
if (res.success) { |
|||
businessType.value = res.businessType |
|||
itemCodeTypeList.value = res.itemCodeTypeList |
|||
toLocationAreaTypeList.value = res.toLocationAreaTypeList |
|||
showRequestPopup() |
|||
} else { |
|||
showErrorMessage(res.message) |
|||
} |
|||
}) |
|||
}) |
|||
onNavigationBarButtonTap((e) => { |
|||
if (e.index === 0) { |
|||
goHome() |
|||
} |
|||
}) |
|||
const closeScan = () => { |
|||
resizeCollapse() |
|||
} |
|||
const resizeCollapse = () => { |
|||
nextTick((r) => { |
|||
comRepleinshDetailCard.value.forEach((r) => { |
|||
r.resizeCollapse() |
|||
}) |
|||
}) |
|||
} |
|||
const showRequestPopup = () => { |
|||
comRepleinshRequestPopupRef.value.openRequestPopup() |
|||
} |
|||
// 确定需求信息 |
|||
const requestConfirm = (action, item) => { |
|||
if (item.itemCode == '' || item.itemCode == null) return |
|||
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) |
|||
}) |
|||
getRecommendInfo(item) |
|||
} |
|||
}) |
|||
} |
|||
} |
|||
const getRecommendInfo = (item) => { |
|||
proxy.$modal.loading('加载中...') |
|||
getBalanceByBatchOffShelf(item.itemCode, item.qty) |
|||
.then((res) => { |
|||
if (res.data == null) { |
|||
showMessage('未获取到推荐信息') |
|||
} else { |
|||
if (res.data.length > 0) { |
|||
res.data.forEach((r) => { |
|||
r.toLocationCode = item.toLocation.code |
|||
r.itemName = item.itemName |
|||
r.uom = item.uom |
|||
subList.value.push(r) |
|||
}) |
|||
|
|||
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 { |
|||
showMessage('列表数据为0') |
|||
} |
|||
uni.hideLoading() |
|||
} |
|||
}) |
|||
.catch((error) => { |
|||
uni.hideLoading() |
|||
showErrorMessage(error) |
|||
}) |
|||
} |
|||
|
|||
const caclcQty = () => { |
|||
const totalQty = 0 |
|||
detailSource.value.subList.forEach((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) |
|||
} |
|||
}) |
|||
} |
|||
resizeCollapse() |
|||
// item.handleQty=itemHandleQty; |
|||
// this.closeScan(); |
|||
} |
|||
|
|||
const calcHandleQty = () => { |
|||
for (const item of detailSource.value) { |
|||
item.qty = 0 |
|||
for (const detail of item.subList) { |
|||
if (detail != undefined) { |
|||
item.qty = calc.add(item.qty, detail.qty) |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
const removeItem = (index, item) => { |
|||
detailSource.value.splice(index, 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) |
|||
} |
|||
} |
|||
updateData() |
|||
} |
|||
|
|||
const openScanPopup = () => { |
|||
scanPopup.value.openScanPopupForType(fromLocationCode.value, businessType.value) |
|||
} |
|||
|
|||
const showFromLocationPopup = () => { |
|||
nextTick(() => { |
|||
scanLocationCode.value.openScanPopup() |
|||
}) |
|||
} |
|||
|
|||
const closeScanPopup = () => { |
|||
if (scanPopup.value != undefined) { |
|||
scanPopup.value.closeScanPopup() |
|||
} |
|||
} |
|||
|
|||
const scanPopupGetFocus = () => { |
|||
if (scanPopup.value != undefined) { |
|||
scanPopup.value.getfocus() |
|||
} |
|||
} |
|||
|
|||
const submit = () => { |
|||
if (getScanCount()) { |
|||
showErrorMessage('当前扫描数为0,请先扫描在提交') |
|||
return |
|||
} |
|||
uni.showLoading({ |
|||
title: '提交中....', |
|||
mask: true |
|||
}) |
|||
|
|||
// 目前任务只到一个库位 |
|||
const itemCodes = [] |
|||
const locationCode = detailSource.value[0].toLocationCode |
|||
detailSource.value.forEach((toLocation) => { |
|||
toLocation.Items.forEach((item) => { |
|||
itemCodes.push(item.itemCode) |
|||
}) |
|||
}) |
|||
|
|||
// 获取管理模式,封装参数 |
|||
getManagementPrecisions(itemCodes, locationCode, (res) => { |
|||
if (res.success) { |
|||
managementList.value = res.list |
|||
submitJob() |
|||
} else { |
|||
uni.hideLoading() |
|||
showErrorMessage(res.message) |
|||
} |
|||
}) |
|||
} |
|||
|
|||
const submitJob = () => { |
|||
const params = setParams() |
|||
repleinshRecordSubmit(params) |
|||
.then((res) => { |
|||
uni.hideLoading() |
|||
if (res.data) { |
|||
showCommitSuccessMessage(`提交成功<br>生成补料记录<br>${res.data}`) |
|||
} else { |
|||
showErrorMessage(`提交失败[${res.msg}]`) |
|||
} |
|||
}) |
|||
.catch((error) => { |
|||
uni.hideLoading() |
|||
showErrorMessage(error) |
|||
}) |
|||
} |
|||
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 = () => { |
|||
let scanCount = 0 |
|||
const subList = [] |
|||
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 |
|||
subItem.recordList.push(record) |
|||
}) |
|||
subList.push(subItem) |
|||
} |
|||
}) |
|||
}) |
|||
}) |
|||
}) |
|||
return (scanCount = subList.length) |
|||
} |
|||
|
|||
const showMessage = (message) => { |
|||
comMessageRef.value.showMessage(message, (res) => { |
|||
if (res) { |
|||
} |
|||
}) |
|||
} |
|||
const showErrorMessage = (message) => { |
|||
comMessageRef.value.showErrorMessage(message, (res) => { |
|||
if (res) { |
|||
} |
|||
}) |
|||
} |
|||
const showScanMessage = (message) => { |
|||
comMessageRef.value.showScanMessage(message) |
|||
} |
|||
|
|||
const afterCloseMessage = () => { |
|||
scanPopupGetFocus() |
|||
} |
|||
const closeScanMessage = () => { |
|||
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) => { |
|||
comMessageRef.value.showSuccessMessage(hint, (res) => { |
|||
clearData() |
|||
}) |
|||
} |
|||
const clearData = () => { |
|||
fromLocationCode.value = '' |
|||
detailSource.value = [] |
|||
requestList.value = [] |
|||
dataContent.value = {} |
|||
managementList.value = [] |
|||
} |
|||
</script> |
|||
|
|||
<style scoped lang="scss"> |
|||
page { |
|||
width: 100%; |
|||
height: 100%; |
|||
background-color: #fff; |
|||
} |
|||
|
|||
.page-wraper { |
|||
display: flex; |
|||
flex-direction: column; |
|||
width: 100%; |
|||
height: 100%; |
|||
} |
|||
|
|||
.page-main { |
|||
flex: 1; |
|||
position: relative; |
|||
} |
|||
|
|||
.page-main-scroll { |
|||
position: absolute; |
|||
left: 0; |
|||
right: 0; |
|||
top: 0; |
|||
bottom: 0; |
|||
} |
|||
|
|||
.page-main-list { |
|||
/* height: 80rpx; |
|||
line-height: 80rpx; */ |
|||
text-align: center; |
|||
background: #e0e0e0; |
|||
} |
|||
</style> |
Loading…
Reference in new issue