6 changed files with 1510 additions and 300 deletions
@ -1,349 +1,744 @@ |
|||||
<template> |
<template> |
||||
<view class="page-wraper"> |
<view class="page-wraper"> |
||||
<view class="" v-if="detailSource.length == 0"> |
<view class=""> |
||||
<com-blank-view @goScan="goScan(true)"></com-blank-view> |
<com-blank-view @goScan="showFromLocationPopup" v-if="recommendList.length == 0"></com-blank-view> |
||||
</view> |
</view> |
||||
<view v-else class="page-wraper"> |
<view class="page-wraper" v-if="recommendList.length > 0"> |
||||
|
<!-- <view class="page-header"> |
||||
|
<view class="header_item"> |
||||
|
来源库位 : {{fromLocationCode}} |
||||
|
</view> |
||||
|
<view class='split_line'></view> |
||||
|
</view> --> |
||||
|
|
||||
|
<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 class="page-main"> |
<view class="page-main"> |
||||
<scroll-view scroll-y="true" class=""> |
<scroll-view scroll-y="true" class="page-main-scroll"> |
||||
<view v-for="(toLocation, index) in detailSource"> |
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
||||
<view class="uni-row uni-flex"> |
<view class=""> |
||||
<!-- <com-issue-request-info :workShopCode="workShopCode" :dataContent="toLocation"> |
<record-com-detail-card :dataContent="item" :index="index" :settingParam="dataContent" :isShowFromLocation="false" @removeItem="removeItem(index, item)" :isShowToLocation="false" @updateData="updateData" @removePack="removePack"> </record-com-detail-card> |
||||
</com-issue-request-info> --> |
|
||||
<work-station :workshopCode="workShopCode" :productionLineCode="toLocation.productionLineCode" :workStationCode="toLocation.workStationCode" :rawLocationCode="toLocation.toLocationCode"></work-station> |
|
||||
</view> |
</view> |
||||
<com-issue-detail-card ref="comIssueDetailCardRef" :dataContent="toLocation" @updateData="updateData" @removeItemCode="removeItemCode"> </com-issue-detail-card> |
|
||||
</view> |
</view> |
||||
</scroll-view> |
</scroll-view> |
||||
<button class="btn_add" @click="goScan(false)">+去添加</button> |
|
||||
</view> |
</view> |
||||
|
|
||||
<view class="page-footer"> |
<view class="page-footer"> |
||||
<view class="uni-flex u-col-center space-between padding_10" style="background-color: ghostwhite; width: 100%"> |
<view class="uni-flex u-col-center space-between padding_10" style="background-color: ghostwhite; width: 100%"> |
||||
<view class=""> </view> |
<view class="uni-row uni-flex"> |
||||
|
<text>生产线:</text> |
||||
|
<view class="uni-flex u-col-center uni-row" @click="showSelect"> |
||||
|
<view class="" style="margin-left: 20rpx"> |
||||
|
{{ positionInfo }} |
||||
|
</view> |
||||
|
<u-select v-model="show" mode="mutil-column-auto" :list="positionList" @confirm="confirmSelect"></u-select> |
||||
|
</view> |
||||
|
</view> |
||||
<view class="uni-flex uni-row"> |
<view class="uni-flex uni-row"> |
||||
<button class="btn_single_commit" hover-class="btn_commit_after" @click="submit()">提交</button> |
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button> |
||||
</view> |
</view> |
||||
</view> |
</view> |
||||
</view> |
</view> |
||||
|
<win-scan-button @goScan="openScanPopup"></win-scan-button> |
||||
</view> |
</view> |
||||
|
<win-scan-pack-and-location ref="scanPopup" @getResult="onScan" :allowModifyLocation="false" :queryBalance="false"> </win-scan-pack-and-location> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
<win-scan-location ref="scanLocationCode" title="来源库位" @getLocation="getLocation" :locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location> |
||||
|
<balance-select ref="balanceSelect" @onSelectItem="selectBalanceItem"></balance-select> |
||||
</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> |
</template> |
||||
|
|
||||
<script setup lang="ts"> |
<script> |
||||
import { ref, getCurrentInstance, nextTick } from 'vue' |
import { issueRecordSubmit, getWorkShopLineStation, getBalanceByFilter, getBalanceByBatchOffShelf } from '@/api/request2.js' |
||||
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 { goHome, getPackingNumberAndBatchByList, deepCopyData } 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 { calc } from '@/common/calc.js' |
||||
|
|
||||
import { getManagementPrecisions } from '@/common/balance.js' |
import { getInventoryStatusDesc, getDirectoryItemArray } from '@/common/directory.js' |
||||
|
|
||||
|
import { getBusinessType, createItemInfo, createDetailInfo, calcTreeHandleQty, calcHandleQty } from '@/common/record.js' |
||||
|
|
||||
|
import { getManagementPrecisions, getPrecisionStrategyList, getPrecisionStrategyParams } 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 winScanButton from '@/mycomponents/scan/winScanButton.vue' |
||||
import comScanIssuePack from '@/pages/issue/coms/comScanIssuePack.vue' |
import winScanPack from '@/mycomponents/scan/winScanPack.vue' |
||||
import workStation from '@/mycomponents/workStation/workStation.vue' |
import requiredLocation from '@/mycomponents/location/requiredLocation.vue' |
||||
|
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
||||
import { useCountStore } from '@/store' |
import winScanLocation from '@/mycomponents/scan/winScanLocation.vue' |
||||
// 获取自定义的store |
import winScanPackAndLocation from '@/mycomponents/scan/winScanPackAndLocation.vue' |
||||
const store = useCountStore() |
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' |
||||
const { proxy } = getCurrentInstance() |
import recordDetailCard from '@/mycomponents/record/recordDetailCard.vue' |
||||
const subList = ref([]) // 接口返回的任务subList |
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' |
||||
const dataContent = ref({}) |
import balance from '@/mycomponents/balance/balance.vue' |
||||
const detailSource = ref([]) // 绑定在页面上的数据源 |
|
||||
const detailOptions = ref([]) |
export default { |
||||
const scanOptions = ref([]) |
components: { |
||||
const workShopCode = ref('') |
winScanButton, |
||||
const fromInventoryStatuses = ref('') |
winScanPack, |
||||
const toInventoryStatuses = ref('') |
requiredLocation, |
||||
const requestList = ref([]) |
comBlankView, |
||||
const managementList = ref([]) |
winScanLocation, |
||||
const itemCodeTypeList = ref([]) |
winScanPackAndLocation, |
||||
const comIssueDetailCardRef = ref() |
recordComDetailCard, |
||||
const comIssueRequestPopupRef = ref() |
recordDetailCard, |
||||
const comScanIssuePackRef = ref() |
balanceSelect, |
||||
onNavigationBarButtonTap((e) => { |
balance |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
id: '', |
||||
|
dataContent: {}, // 内容 |
||||
|
detailSource: [], // 绑定在页面上的数据源 |
||||
|
fromLocationInfo: {}, |
||||
|
fromLocationCode: '', |
||||
|
fromLocationAreaTypeList: [], |
||||
|
toLocationAreaTypeList: [], |
||||
|
inInventoryStatus: '', // 目标入库库存状态 |
||||
|
outInventoryStatus: '', // 来源出库库存状态 |
||||
|
businessType: {}, |
||||
|
showToLoaction: true, |
||||
|
recommendLocationList: [], // 推荐库位列表 |
||||
|
fromWarehouseCode: '', // 来源仓库 |
||||
|
businessTypeCode: 'Issue', |
||||
|
positionList: [], |
||||
|
show: false, |
||||
|
positionInfo: '请选择生产线', |
||||
|
resultData: {}, |
||||
|
recommendList: [] |
||||
|
} |
||||
|
}, |
||||
|
onLoad(option) { |
||||
|
uni.setNavigationBarTitle({ |
||||
|
title: option.title |
||||
|
}) |
||||
|
this.clearData() |
||||
|
getBusinessType(this.businessTypeCode, (res) => { |
||||
|
if (res.success) { |
||||
|
this.businessType = res.businessType |
||||
|
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList |
||||
|
this.toLocationAreaTypeList = res.toLocationAreaTypeList |
||||
|
this.showFromLocationPopup() |
||||
|
} else { |
||||
|
this.showErrorMessage(res.message) |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
// if (this.positionList.length == 0) { |
||||
|
getWorkShopLineStation() |
||||
|
.then((res) => { |
||||
|
if (res.data != null && res.data.length > 0) { |
||||
|
this.positionList = res.data |
||||
|
} else { |
||||
|
this.showErrorMessage('未查找到位置信息') |
||||
|
} |
||||
|
}) |
||||
|
.catch((error) => { |
||||
|
this.showErrorMessage(error) |
||||
|
}) |
||||
|
// } |
||||
|
}, |
||||
|
// 返回首页 |
||||
|
onNavigationBarButtonTap(e) { |
||||
if (e.index === 0) { |
if (e.index === 0) { |
||||
goHome() |
goHome() |
||||
} |
} |
||||
|
}, |
||||
|
// 拦截返回按钮事件 |
||||
|
onBackPress(e) {}, |
||||
|
|
||||
|
onPullDownRefresh() {}, |
||||
|
|
||||
|
mounted() {}, |
||||
|
|
||||
|
methods: { |
||||
|
getBalance(label, packageInfo, callback) { |
||||
|
const filters = [] |
||||
|
|
||||
|
if (packageInfo.parentNumber) { |
||||
|
const packingNumber = `${packageInfo.parentNumber},${label.packingNumber}` |
||||
|
filters.push({ |
||||
|
column: 'packingNumber', |
||||
|
action: 'in', |
||||
|
value: packingNumber |
||||
}) |
}) |
||||
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 { |
} else { |
||||
showErrorMessage(res.message) |
filters.push({ |
||||
|
column: 'packingNumber', |
||||
|
action: '==', |
||||
|
value: label.packingNumber |
||||
|
}) |
||||
} |
} |
||||
|
|
||||
|
filters.push({ |
||||
|
column: 'itemCode', |
||||
|
action: '==', |
||||
|
value: label.itemCode |
||||
}) |
}) |
||||
|
filters.push({ |
||||
|
column: 'batch', |
||||
|
action: '==', |
||||
|
value: label.batch |
||||
|
}) |
||||
|
|
||||
|
if (this.fromInventoryStatuses != null && this.fromInventoryStatuses != '') { |
||||
|
filters.push({ |
||||
|
column: 'inventoryStatus', |
||||
|
action: 'in', |
||||
|
value: this.fromInventoryStatuses |
||||
}) |
}) |
||||
const closeScan = () => { |
|
||||
resizeCollapse() |
|
||||
} |
} |
||||
const resizeCollapse = () => { |
|
||||
nextTick((r) => { |
const params = { |
||||
comIssueDetailCardRef.value.forEach((r) => { |
filters, |
||||
r.resizeCollapse() |
pageNo: 1, |
||||
|
pageSize: 100 |
||||
|
} |
||||
|
getBalanceByFilter(params) |
||||
|
.then((res) => { |
||||
|
callback(res.data) |
||||
}) |
}) |
||||
|
.catch((err) => { |
||||
|
this.showErrorMessage(err.message) |
||||
}) |
}) |
||||
|
}, |
||||
|
|
||||
|
getScanResult(result) { |
||||
|
this.resultData = result |
||||
|
const packageInfo = result.package |
||||
|
this.getBalance(result.label, packageInfo, (balances) => { |
||||
|
// 扫描的是外包装 |
||||
|
const s = '' |
||||
|
if (!result.package.parentNumber) { |
||||
|
if (balances.list.length == 0) { |
||||
|
this.showErrorMessage('未查找到该包装的库存信息,请重新扫描') |
||||
|
} else { |
||||
|
const newBalances = balances.list.filter((b) => b.locationCode == this.fromLocationCode) |
||||
|
if (newBalances.length == 0) { |
||||
|
this.showErrorMessage('未查找到该包装的库存信息,请重新扫描') |
||||
|
} else if (newBalances.length == 1) { |
||||
|
const balance = newBalances[0] |
||||
|
result.balance = balance |
||||
|
this.afterGetBalance(result) |
||||
|
} else { |
||||
|
this.showBalanceSelect(newBalances) |
||||
} |
} |
||||
const goScan = (editPosition) => { |
|
||||
comIssueRequestPopupRef.value.openRequestPopup(editPosition) |
|
||||
} |
} |
||||
|
} else { |
||||
|
// 扫描的是小包装 |
||||
|
if (balances.list.length == 0) { |
||||
|
this.showErrorMessage('未查找到该包装的库存信息,请重新扫描') |
||||
|
} else { |
||||
|
// 小包装库存 |
||||
|
const subPackitems = balances.list.filter((r) => r.packingNumber == packageInfo.number) |
||||
|
// 外包装库存 |
||||
|
const subParentPackitems = balances.list.filter((r) => r.packingNumber == packageInfo.parentNumber && r.locationCode == this.fromLocationCode) |
||||
|
|
||||
// 确定需求信息 |
// 小包装没有库存, |
||||
|
if (subPackitems.length == 0) { |
||||
const requestConfirm = (action, item) => { |
// 外包装有库存,出库后剩余库存未转换为出库包装规格 |
||||
if (item.itemCode == '' || item.itemCode == null) return |
|
||||
|
|
||||
const request = requestList.value.find((r) => r.itemCode == item.itemCode) |
if (subParentPackitems.length > 0) { |
||||
if (request == undefined) { |
if (subParentPackitems.length == 1) { |
||||
requestList.value.push(item) |
const balance = subParentPackitems[0] |
||||
getRecommendInfo(item) |
balance.qty = packageInfo.qty |
||||
|
result.balance = balance |
||||
|
this.afterGetBalance(result) |
||||
} else { |
} else { |
||||
comMessageRef.value.showQuestionMessage(`已经存在物料[${item.itemCode}]的需求信息,是否要修改?`, (res) => { |
this.showBalanceSelect(subParentPackitems) |
||||
if (res) { |
} |
||||
request.qty = item.qty |
} else { |
||||
detailSource.value.forEach((detail) => { |
this.showErrorMessage(`按外包装【${packageInfo.parentNumber}】和子包装【${packageInfo.number}】都未查找到库存余额`) |
||||
const index = detail.Items.findIndex((r) => { |
} |
||||
r.itemCode == item.itemCode |
} else { |
||||
}) |
let locationCode = this.fromLocationCode |
||||
detail.Items.splice(index, 1) |
if (balances.list == 1) { |
||||
}) |
locationCode = balances.list[0].locationCode |
||||
getRecommendInfo(item) |
} else { |
||||
|
const manyBlances = balances.list.filter((r) => r.locationCode != this.fromLocationCode) |
||||
|
if (manyBlances.length > 0) { |
||||
|
locationCode = manyBlances[0].locationCode |
||||
|
} |
||||
|
} |
||||
|
this.showErrorMessage(`该包装【${packageInfo.number}】在库位【${locationCode}】已经有库存余额,请重新扫描`) |
||||
|
} |
||||
|
} |
||||
} |
} |
||||
}) |
}) |
||||
|
}, |
||||
|
|
||||
|
onScan(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.getScanResult(result) |
||||
|
} |
||||
} |
} |
||||
|
} else { |
||||
|
this.getRecommendInfo(result) |
||||
} |
} |
||||
|
}, |
||||
|
|
||||
const getRecommendInfo = (item) => { |
getRecommendInfo(result) { |
||||
proxy.$modal.loading('加载中....') |
const that = this |
||||
getBalanceByBatchOffShelf(item.itemCode, item.qty) |
uni.showLoading({ |
||||
|
title: '加载中...', |
||||
|
mask: true |
||||
|
}) |
||||
|
const item = { |
||||
|
itemCode: result.package.itemCode, |
||||
|
qty: result.package.qty |
||||
|
} |
||||
|
getBalanceByBatchOffShelf(item.itemCode, item.qty, 'issue') |
||||
.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) { |
||||
workShopCode.value = item.workshopCode |
that.recommendList = res.data |
||||
res.data.forEach((r) => { |
that.recommendList.forEach((r) => (r.locationCode = r.fromLocationCode)) |
||||
r.toLocationCode = item.rawLocationCode |
const recommendInfo = res.data[0] |
||||
r.productionLineCode = item.productionLineCode |
if (recommendInfo.batch != result.package.batch) { |
||||
r.workStationCode = item.workStationCode |
that.showErrorMessage(`扫描的批次【${result.package.batch}】,不是系统推荐的批次【${recommendInfo.batch}】,不满足系统的先进先出规则,请重新扫描`) |
||||
// r.itemCode = item.itemCode; |
} else { |
||||
r.itemName = item.itemName |
this.getScanResult(result) |
||||
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 { |
} else { |
||||
showMessage('列表数据为0') |
that.showErrorMessage('未查找到物料的推荐信息') |
||||
} |
} |
||||
uni.hideLoading() |
uni.hideLoading() |
||||
} |
} |
||||
}) |
}) |
||||
.catch((error) => { |
.catch((error) => { |
||||
uni.hideLoading() |
uni.hideLoading() |
||||
showErrorMessage(error) |
that.showErrorMessage(error) |
||||
}) |
}) |
||||
|
}, |
||||
|
|
||||
|
showBalanceSelect(items) { |
||||
|
this.$refs.balanceSelect.openPopup(items) |
||||
|
}, |
||||
|
|
||||
|
selectBalanceItem(balance) { |
||||
|
this.resultData.balance = balance |
||||
|
this.afterGetBalance(this.resultData) |
||||
|
}, |
||||
|
|
||||
|
afterGetBalance(result) { |
||||
|
const { balance } = result |
||||
|
const { label } = result |
||||
|
const pack = result.package |
||||
|
const { packUnit } = pack |
||||
|
const { packQty } = pack |
||||
|
const item = this.detailSource.find((res) => { |
||||
|
if (res.itemCode == balance.itemCode) { |
||||
|
return res |
||||
|
} |
||||
|
}) |
||||
|
if (this.fromWarehouseCode == '') { |
||||
|
this.fromWarehouseCode = balance.warehouseCode |
||||
|
} |
||||
|
if (item == undefined) { |
||||
|
const itemp = createItemInfo(balance, pack) |
||||
|
const newDetail = createDetailInfo(balance, pack) // |
||||
|
newDetail.parentNumber = pack.parentNumber |
||||
|
newDetail.packingNumber = pack.number |
||||
|
newDetail.packUnit = packUnit |
||||
|
newDetail.packQty = packQty |
||||
|
itemp.subList.push(newDetail) |
||||
|
this.detailSource.push(itemp) |
||||
|
calcHandleQty(this.detailSource) |
||||
|
} 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 |
||||
} |
} |
||||
|
}) |
||||
|
if (detail == undefined) { |
||||
|
const newDetail = createDetailInfo(balance, pack) |
||||
|
newDetail.parentNumber = pack.parentNumber |
||||
|
newDetail.packingNumber = pack.number |
||||
|
newDetail.packUnit = packUnit |
||||
|
newDetail.packQty = packQty |
||||
|
item.subList.push(newDetail) |
||||
|
calcHandleQty(this.detailSource) |
||||
|
} else if (detail.scaned == true) { |
||||
|
this.showErrorMessage(`箱码[${detail.packingNumber}]批次[${balance.batch}]已经在列表中`) |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
|
||||
const caclcQty = () => { |
getScanResult1(result) { |
||||
let totalQty = 0 |
const { balance } = result |
||||
detailSource.value.subList.forEach((res) => { |
const { label } = result |
||||
totalQty = calc.add(totalQty, res.qty) |
const pack = result.package |
||||
|
const { packUnit } = pack |
||||
|
const { packQty } = pack |
||||
|
const item = this.detailSource.find((res) => { |
||||
|
if (res.itemCode == balance.itemCode) { |
||||
|
return res |
||||
|
} |
||||
}) |
}) |
||||
detailSource.value.totalQty = totalQty |
if (this.fromWarehouseCode == '') { |
||||
|
this.fromWarehouseCode = balance.warehouseCode |
||||
|
} |
||||
|
if (item == undefined) { |
||||
|
const itemp = createItemInfo(balance, pack) |
||||
|
const newDetail = createDetailInfo(balance, pack) // |
||||
|
newDetail.packUnit = packUnit |
||||
|
newDetail.packQty = packQty |
||||
|
itemp.subList.push(newDetail) |
||||
|
this.detailSource.push(itemp) |
||||
|
calcHandleQty(this.detailSource) |
||||
|
} else { |
||||
|
const detail = item.subList.find((r) => { |
||||
|
if (r.packingNumber == balance.packingNumber && r.batch == balance.batch && r.locationCode == balance.locationCode && r.inventoryStatus == balance.inventoryStatus) { |
||||
|
return r |
||||
} |
} |
||||
constopenScanDetailPopup = () => { |
}) |
||||
const datacontent = {} |
if (detail == undefined) { |
||||
// 克隆对象,深度克隆,防止双向绑定同一个变量 |
const newDetail = createDetailInfo(balance, pack) |
||||
// Object.assign(datacontent, this.detailSource); |
newDetail.packUnit = packUnit |
||||
const dataContent = { |
newDetail.packQty = packQty |
||||
allowModifyPackingNumber: 'FALSE', |
item.subList.push(newDetail) |
||||
outInventoryStatuses: fromInventoryStatuses.value |
calcHandleQty(this.detailSource) |
||||
|
} else if (detail.scaned == true) { |
||||
|
this.showErrorMessage(`箱码[${balance.packingNumber}批次[${balance.batch}]已经在列表中`) |
||||
} |
} |
||||
comScanIssuePackRef.value.openScanPopup(detailSource.value, dataContent) |
|
||||
} |
} |
||||
|
}, |
||||
|
|
||||
const closeScanPopup = () => { |
// 获取推荐库位 |
||||
updateCommitBtn() |
getRecommendLocation(balance, pack, callback) { |
||||
|
uni.showLoading({ |
||||
|
title: '扫描中...', |
||||
|
mask: true |
||||
|
}) |
||||
|
const recommend = this.recommendLocationList.find((r) => r.itemCode == balance.itemCode) |
||||
|
if (recommend == undefined) { |
||||
|
const param = { |
||||
|
itemCode: balance.itemCode, |
||||
|
batch: balance.batch, |
||||
|
inventoryStatus: balance.inventoryStatus, |
||||
|
supplierCode: pack.supplierCode, |
||||
|
businessCode: this.businessTypeCode |
||||
|
} |
||||
|
console.log(JSON.stringify(param)) |
||||
|
getPutawayRecommendLocation(param) |
||||
|
.then((res) => { |
||||
|
this.recommendLocationList.push({ |
||||
|
itemCode: balance.itemCode, |
||||
|
locationCode: res.data.code |
||||
|
}) |
||||
|
callback(res.data) |
||||
|
uni.hideLoading() |
||||
|
}) |
||||
|
.catch((error) => { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(error) |
||||
|
uni.hideLoading() |
||||
|
}) |
||||
|
} else { |
||||
|
callback(recommend) |
||||
} |
} |
||||
|
}, |
||||
|
|
||||
constupdateData = (record) => { |
showErrorMessage(message) { |
||||
const requestLocation = detailSource.value.find((r) => r.toLocationCode == record.toLocationCode) |
this.$refs.comMessage.showErrorMessage(message, (res) => { |
||||
const item = requestLocation.Items.find((r) => r.itemCode == record.itemCode) |
if (res) { |
||||
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) |
|
||||
} |
} |
||||
}) |
}) |
||||
|
}, |
||||
|
|
||||
|
calcTreeHandleQty() { |
||||
|
for (const item of this.detailSource) { |
||||
|
item.qty = 0 |
||||
|
for (const detail of item.subList) { |
||||
|
if (detail != undefined) { |
||||
|
item.qty = calc.add(item.qty, detail.qty) |
||||
} |
} |
||||
resizeCollapse() |
|
||||
// item.handleQty=itemHandleQty; |
|
||||
// this.closeScan(); |
|
||||
} |
|
||||
const removeItemCode = () => { |
|
||||
const isClear = detailSource.value[0].Items.length == 0 |
|
||||
if (isClear) { |
|
||||
clearData() |
|
||||
comIssueRequestPopupRef.value.initData() |
|
||||
} |
} |
||||
} |
} |
||||
const setParams = () => { |
this.$forceUpdate() |
||||
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 |
showSelect() { |
||||
record.toInventoryStatus = r.inventoryStatus |
// if (this.editPosition) { |
||||
record.toLocationCode = subItem.toLocationCode |
this.show = true |
||||
record.fromLocationCode = fromLocation.fromLocationCode |
// } |
||||
record.supplierCode = r.supplierCode |
}, |
||||
|
|
||||
const single_price = r.singlePrice == null ? 0 : r.singlePrice |
confirmSelect(e) { |
||||
|
this.positionInfo = `${e[0].label}-${e[1].label}-${e[2].label}` |
||||
|
console.log('位置', this.positionInfo) |
||||
|
this.workshopCode = e[0].value |
||||
|
this.productionLineCode = e[1].value |
||||
|
this.workStationCode = e[2].value |
||||
|
this.workShopName = e[0].label |
||||
|
this.productionLineName = e[1].label |
||||
|
this.workStationName = e[2].label |
||||
|
|
||||
record.singlePrice = single_price |
const shop = this.positionList.find((shop) => shop.value == this.workshopCode) |
||||
record.amount = single_price * r.qty |
if (shop != undefined && shop.children != undefined) { |
||||
|
const prodLine = shop.children.find((line) => line.value == this.productionLineCode) |
||||
|
if (prodLine != undefined && prodLine.children != undefined) { |
||||
|
const station = prodLine.children.find((r) => r.value == this.workStationCode) |
||||
|
if (station.rawLocationCode == '' && station.rawLocationCode == null) { |
||||
|
this.showErrorMessage(`${this.workStationName}的原材料库位为空,请重新选择`) |
||||
|
return |
||||
|
} |
||||
|
this.rawLocationCode = station.rawLocationCode |
||||
|
this.fgLocationCode = station.fgLocationCode |
||||
|
} else { |
||||
|
this.showErrorMessage('生产线-工位基础信息维护错误') |
||||
|
} |
||||
|
} else { |
||||
|
this.showErrorMessage('车间-生产线基础信息维护错误') |
||||
|
} |
||||
|
|
||||
// 使用在途库不改变管理模式 |
// 赋值到库位代码 |
||||
const info = getPackingNumberAndBatch(managementList.value, r.itemCode, r.packingNumber, r.batch) |
let toLocationCode = '' |
||||
record.toPackingNumber = info.packingNumber |
this.positionList.forEach((item) => { |
||||
record.toBatch = info.batch |
if (this.workshopCode == item.value) { |
||||
subItem.recordList.push(record) |
// 车间 |
||||
}) |
item.children.find((child) => { |
||||
subList.push(subItem) |
if (this.productionLineCode == child.value) { |
||||
|
toLocationCode = child.children.find((subChild) => this.workStationCode == subChild.value).rawLocationCode |
||||
} |
} |
||||
}) |
}) |
||||
|
} |
||||
}) |
}) |
||||
|
this.detailSource.forEach((item) => { |
||||
|
item.subList.forEach((detail) => { |
||||
|
detail.toLocationCode = toLocationCode |
||||
}) |
}) |
||||
}) |
}) |
||||
|
}, |
||||
|
|
||||
dataContent.value.subList = subList |
removeItem(index, item) { |
||||
dataContent.value.createTime = createTime |
this.detailSource.splice(index, 1) |
||||
dataContent.value.creator = creator |
}, |
||||
return dataContent.value |
|
||||
|
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) |
||||
|
} |
||||
} |
} |
||||
const submit = () => { |
this.updateData() |
||||
proxy.$modal.loading('提交中....') |
}, |
||||
|
|
||||
// 目前任务只到一个库位 |
openScanPopup() { |
||||
const itemCodes = [] |
if (this.fromLocationCode == '') { |
||||
const locationCode = detailSource.value[0].toLocationCode |
this.showFromLocationPopup() |
||||
detailSource.value.forEach((toLocation) => { |
return |
||||
toLocation.Items.forEach((item) => { |
} |
||||
itemCodes.push(item.itemCode) |
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType) |
||||
}) |
}, |
||||
|
|
||||
|
showFromLocationPopup() { |
||||
|
this.$nextTick(() => { |
||||
|
this.$refs.scanLocationCode.openScanPopup() |
||||
}) |
}) |
||||
|
}, |
||||
|
|
||||
// 获取管理模式,封装参数 |
closeScanPopup() { |
||||
getManagementPrecisions(itemCodes, locationCode, (res) => { |
if (this.$refs.scanPopup != undefined) { |
||||
if (res.success) { |
this.$refs.scanPopup.closeScanPopup() |
||||
managementList.value = res.list |
|
||||
submitJob() |
|
||||
} else { |
|
||||
uni.hideLoading() |
|
||||
showErrorMessage(res.message) |
|
||||
} |
} |
||||
}) |
}, |
||||
|
|
||||
|
scanPopupGetFocus() { |
||||
|
if (this.$refs.scanPopup != undefined) { |
||||
|
this.$refs.scanPopup.getfocus() |
||||
} |
} |
||||
|
}, |
||||
|
|
||||
|
// scanLocationCode(location, code) { |
||||
|
// this.toLocationCode = code |
||||
|
// this.toLocationCode = location; |
||||
|
|
||||
|
// }, |
||||
|
|
||||
|
commit() { |
||||
|
uni.showLoading({ |
||||
|
title: '提交中....', |
||||
|
mask: true |
||||
|
}) |
||||
|
|
||||
const submitJob = () => { |
// 记录有目标库位,需要查询管理模式 |
||||
const params = setParams() |
const precisionStrategyParams = getPrecisionStrategyParams(this.detailSource) |
||||
|
// 2:获取管理模式,封装参数 |
||||
|
getPrecisionStrategyList(precisionStrategyParams, (res) => { |
||||
|
if (res.success) { |
||||
|
this.managementList = res.list |
||||
|
const params = { |
||||
|
...this.setRecordParams() |
||||
|
} |
||||
console.log('提交参数', JSON.stringify(params)) |
console.log('提交参数', JSON.stringify(params)) |
||||
|
|
||||
issueRecordSubmit(params) |
issueRecordSubmit(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) |
||||
} |
} |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
setRecordParams() { |
||||
|
const subList = [] |
||||
|
const creator = this.$store.state.user.id |
||||
|
this.detailSource.forEach((item) => { |
||||
|
item.subList.forEach((detail) => { |
||||
|
if (detail.scaned) { |
||||
|
const info = getPackingNumberAndBatchByList(this.managementList, detail.itemCode, detail.packingNumber, detail.toLocationCode, detail.batch) |
||||
|
const submitItem = deepCopyData(detail) |
||||
|
submitItem.toPackingNumber = info.packingNumber |
||||
|
submitItem.toBatch = info.batch |
||||
|
submitItem.toContainerNumber = detail.containerNumber |
||||
|
|
||||
const showCommitSuccessMessage = (hint) => { |
submitItem.fromPackingNumber = info.packingNumber |
||||
comMessageRef.value.showSuccessMessage(hint, (res) => { |
submitItem.fromBatch = info.batch |
||||
|
submitItem.fromContainerNumber = detail.containerNumber |
||||
|
|
||||
|
submitItem.fromLocationCode = detail.locationCode |
||||
|
submitItem.toLocationCode = detail.toLocationCode |
||||
|
|
||||
|
// detail.toInventoryStatus = detail.inventoryStatus |
||||
|
// detail.toLocationCode = detail.toLocationCode |
||||
|
submitItem.qty = detail.handleQty |
||||
|
submitItem.package = '' |
||||
|
submitItem.recordList = [ |
||||
|
{ |
||||
|
toInventoryStatus: detail.inventoryStatus, |
||||
|
fromParentPackingNumber: detail.parentNumber, |
||||
|
fromPackingNumber: info.packingNumber, |
||||
|
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) { |
||||
clearData() |
|
||||
comIssueRequestPopup.value.initData() |
|
||||
} |
} |
||||
}) |
}) |
||||
|
}, |
||||
|
|
||||
|
showScanMessage(message) { |
||||
|
this.$refs.comMessage.showScanMessage(message) |
||||
|
}, |
||||
|
|
||||
|
afterCloseMessage() { |
||||
|
this.scanPopupGetFocus() |
||||
|
}, |
||||
|
|
||||
|
closeScanMessage() { |
||||
|
this.scanPopupGetFocus() |
||||
|
}, |
||||
|
getLocation(location, code) { |
||||
|
this.getFromLocationCode(location, code) |
||||
|
}, |
||||
|
getFromLocationCode(location, code) { |
||||
|
this.fromLocationInfo = location |
||||
|
this.fromLocationCode = code |
||||
|
this.openScanPopup() |
||||
|
}, |
||||
|
getToLocationCode(location, code) { |
||||
|
if (this.fromLocationCode == code) { |
||||
|
uni.showToast({ |
||||
|
title: `来源库位[${this.fromLocationCode}]不能与目标库位[${code}]一致`, |
||||
|
duration: 2000 |
||||
|
}) |
||||
|
return |
||||
} |
} |
||||
|
this.toLocationCode = code |
||||
|
}, |
||||
|
|
||||
|
showCommitSuccessMessage(hint) { |
||||
|
this.$refs.comMessage.showSuccessMessage(hint, (res) => { |
||||
|
this.clearData() |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
const clearData = () => { |
updateData() { |
||||
subList.value = [] // 接口返回的任务subList |
calcHandleQty(this.detailSource) |
||||
detailSource.value = [] // 绑定在页面上的数据源 |
for (let i = 0; i < this.detailSource.length; i++) { |
||||
detailOptions.value = [] |
const item = this.detailSource[i] |
||||
scanOptions.value = [] |
if (item.qty == 0) { |
||||
workShopCode.value = '' |
this.detailSource.splice(i, 1) |
||||
requestList.value = [] |
|
||||
dataContent.value = {} |
|
||||
managementList.value = [] |
|
||||
} |
} |
||||
const showMessage = (message) => { |
|
||||
comMessageRef.value.showMessage(message, (res) => { |
|
||||
if (res) { |
|
||||
afterCloseMessage() |
|
||||
} |
} |
||||
}) |
this.$forceUpdate() |
||||
|
}, |
||||
|
|
||||
|
clearData() { |
||||
|
this.fromLocationInfo = {} |
||||
|
this.fromLocationCode = '' |
||||
|
this.fromWarehouseCode = '' |
||||
|
this.toWarehouseCode = '' |
||||
|
this.detailSource = [] |
||||
|
this.positionInfo = '请选择生产线' |
||||
} |
} |
||||
const showErrorMessage = (message) => { |
|
||||
comMessageRef.value.showErrorMessage(message, (res) => { |
|
||||
if (res) { |
|
||||
} |
} |
||||
}) |
|
||||
} |
} |
||||
</script> |
</script> |
||||
|
|
||||
<style></style> |
<style scoped lang="scss"></style> |
||||
|
@ -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