王志国
3 weeks ago
7 changed files with 1044 additions and 10 deletions
@ -0,0 +1,475 @@ |
|||
<template> |
|||
<view> |
|||
<u-popup v-model="show" mode="bottom" :maskClick='false'> |
|||
<view class=""> |
|||
<view class="popup_box"> |
|||
<view class="pop_title uni-flex space-between"> |
|||
<view class="" style="font-size: 35rpx;"> |
|||
扫描箱码 |
|||
</view> |
|||
|
|||
<view class=""> |
|||
<image class="fr icons_scan_close" src="/static/icons/icons_scan_close.svg" @click="closeScanPopup()"> |
|||
</image> |
|||
</view> |
|||
</view> |
|||
|
|||
<!-- <view class="uni-flex uni-row" style="align-items: center; |
|||
background-color: #fff; |
|||
margin-left: 20rpx; |
|||
margin-right: 20rpx; |
|||
padding:20rpx; |
|||
border-radius: 8rpx;"> |
|||
<view class="uni-center"> |
|||
位置 : |
|||
</view> |
|||
<view class="" style="width: 75%;padding: 0rpx"> |
|||
<view class="uni-flex u-col-center uni-row" @click="showSelect"> |
|||
<view class="" style="margin-left: 15rpx;font-size: 30rpx;"> |
|||
{{positionInfo}} |
|||
</view> |
|||
<u-select v-model="show" mode="mutil-column-auto" :list="positionList" :defaultValue="defaultValueList" |
|||
@confirm="confirmSelect"></u-select> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<u-line class='line_color'></u-line> --> |
|||
|
|||
<view class="uni-flex uni-row" style="align-items: center; |
|||
background-color: #fff; |
|||
margin-left: 20rpx; |
|||
margin-right: 20rpx; |
|||
margin-top: 8rpx; |
|||
border-radius: 8rpx;"> |
|||
<view class="uni-center" style="width: 25%; "> |
|||
来源库位 |
|||
</view> |
|||
<view class="" style="width: 75%; padding: 8rpx;"> |
|||
<uni-combox :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请选择库位" |
|||
@confirm="fromLocationUpdate"></uni-combox> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class=""> |
|||
<view class=""> |
|||
<win-com-scan ref="comscanRef" placeholder="箱标签" @getResult="onScan" :clearResult="true" |
|||
:headerType="headerType" :isShowHistory="false"> |
|||
</win-com-scan> |
|||
|
|||
<view style="width: 100%;"> |
|||
<view style="width: 100%;" v-if="issueRecord.length>0"> |
|||
<view class="uni-flex uni-row space-between u-col-center"> |
|||
<view class="" style="padding: 10rpx;"> |
|||
历史记录 |
|||
</view> |
|||
<view class="" style="padding-right: 10rpx;"> |
|||
<u-icon :name="expendIcon" size="35rpx" @click="expands()"></u-icon> |
|||
</view> |
|||
</view> |
|||
<u-line class='line_color' style='padding-top: 10rpx;padding-bottom: 20rpx;'> |
|||
</u-line> |
|||
<scroll-view scroll-y="true" class="scroll-view" v-if="expand&&issueRecord.length>0"> |
|||
<view class="uni-flex u-col" v-for="(record,index) in issueRecord"> |
|||
<view style="width: 100%;"> |
|||
<u-swipe-action ref="swipeAction" :options="scanOptions" @click="(...event)=>swipeClick(event,record,index)"> |
|||
<<view style="padding: 0px 10px"> |
|||
<balance :dataContent="record" :isShowLocation="false" :isShowStdPack="false"></balance> |
|||
</view> |
|||
</u-swipe-action> |
|||
<u-line class='line_color'></u-line> |
|||
</view> |
|||
</view> |
|||
</scroll-view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</u-popup> |
|||
<balance-select ref="balanceSelectRef" @onSelectItem='selectBalanceItem'></balance-select> |
|||
<comMessage ref="comMessageRef"></comMessage> |
|||
<balance-qty-edit ref="balanceQtyEditRef" @confirm="confirm" :isShowStatus="true"></balance-qty-edit> |
|||
</view> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import winComScan from '@/mycomponents/scan/winComScan.vue' |
|||
import balance from '@/mycomponents/balance/balance.vue' |
|||
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue' |
|||
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' |
|||
|
|||
import { |
|||
getDetailOption, |
|||
getDetailEditRemoveOption |
|||
} from '@/common/array.js'; |
|||
|
|||
|
|||
import { |
|||
calc |
|||
} from '@/common/calc.js'; |
|||
import { |
|||
getWorkShopLineStation |
|||
} from '@/api/request2.js'; |
|||
|
|||
import { |
|||
getBalanceByManagementPrecision |
|||
} from '@/common/balance.js'; |
|||
import { |
|||
getDirectoryItemArray |
|||
} from '@/common/directory.js'; |
|||
|
|||
import { ref, onMounted } from 'vue'; |
|||
|
|||
const props = defineProps({ |
|||
title: { |
|||
type: String, |
|||
default: '' |
|||
}, |
|||
headerType: { |
|||
type: String, |
|||
default: "HPQ,HMQ" |
|||
} |
|||
}); |
|||
const emit = defineEmits(['closeScan','updateData']); |
|||
const dataContent = ref({}); |
|||
const jobContent = ref({}); |
|||
const expendIcon = ref('arrow-down'); |
|||
const show = ref(false); |
|||
const scanList = ref([]); |
|||
const toLocation = ref(null); |
|||
const toLocationCode = ref(''); |
|||
const fromLocationList = ref([]); |
|||
const fromLocationCode = ref(''); |
|||
const fromLocation = ref(null); |
|||
const issueRecord = ref([]); // 发货历史 |
|||
const expand = ref(true); |
|||
const scanOptions = ref({}); |
|||
const editItem = ref({}); |
|||
const positionInfo = ref("请选择位置"); |
|||
const positionList = ref([]); |
|||
const defaultValueList = ref([]); |
|||
const label = ref({}); |
|||
const fromInventoryStatuses = ref(""); |
|||
const packageInfo = ref({}); |
|||
const detailOptions = ref('') |
|||
const showItem = ref([]) |
|||
const balanceSelectRef = ref(null); |
|||
const comMessageRef = ref(null); |
|||
const toLocationComboxRef = ref(null); |
|||
const comscanRef = ref(null); |
|||
const receiptHintRef = ref(null); |
|||
const balanceQtyEditRef = ref(null); |
|||
|
|||
onMounted(() => { |
|||
detailOptions.value = getDetailOption(); |
|||
scanOptions.value = getDetailEditRemoveOption(); |
|||
}); |
|||
|
|||
const openScanPopup = (content, jobcontent) => { |
|||
issueRecord.value = []; |
|||
dataContent.value = content; |
|||
jobContent.value = jobcontent; |
|||
initData(); |
|||
positionInfo.value = jobContent.value.workShopCode + "-" + jobContent.value.subList[0].productionLineCode + |
|||
"-" + jobContent.value.subList[0].workStationCode; |
|||
show.value = true |
|||
setTimeout(() => { |
|||
getfocus(); |
|||
}, 500); |
|||
}; |
|||
|
|||
const closeScanPopup = () => { |
|||
losefocus(); |
|||
show.value = false |
|||
emit("closeScan"); |
|||
}; |
|||
|
|||
const initData = () => { |
|||
fromLocationList.value = []; |
|||
if (dataContent.value != null) { |
|||
fromInventoryStatuses.value = getDirectoryItemArray(jobContent.value.outInventoryStatuses); |
|||
toLocation.value = dataContent.value.subList; |
|||
toLocationCode.value = dataContent.value.subList[0].toLocationCode; |
|||
fromLocationList.value = getFromLocationList(); |
|||
} |
|||
}; |
|||
|
|||
const showBalanceSelect = (items, packageInfo) => { |
|||
packageInfo.value = packageInfo; |
|||
balanceSelectRef.value.openPopup(items); |
|||
}; |
|||
|
|||
const getFromLocationList = () => { |
|||
let list = []; |
|||
let item = dataContent.value.subList.find(r => r.toLocationCode == toLocationCode.value); |
|||
if (item != undefined) { |
|||
dataContent.value.subList.forEach(item => { |
|||
list.push(item.fromLocationCode); |
|||
}); |
|||
fromLocationCode.value = list[0]; |
|||
return list; |
|||
} else { |
|||
comMessageRef.value.showErrorMessages('需求库位【' + toLocationCode.value + '】不存在', res => { |
|||
toLocationCode.value = ''; |
|||
}); |
|||
} |
|||
}; |
|||
|
|||
const fromLocationUpdate = (fromlocation) => { |
|||
let location = fromLocationList.value.find(r => r == fromlocation); |
|||
if (location == undefined) { |
|||
fromLocationCode.value = ''; |
|||
showErrorMessage('发货库位【' + fromlocation + '】不存在'); |
|||
} |
|||
}; |
|||
|
|||
const onScan = (result) => { |
|||
try { |
|||
if (fromLocationCode.value == '') { |
|||
showErrorMessage('请选择来源库位', res => { |
|||
toLocationComboxRef.value.onFocus(); |
|||
}); |
|||
return; |
|||
} |
|||
let packageInfo = result.package; |
|||
let itemCode = result.label.itemCode; |
|||
let packingCode = result.label.packingNumber; |
|||
let lot = result.label.batch; |
|||
let item = toLocation.value.find(r => r.itemCode == itemCode); |
|||
if (item == undefined) { |
|||
showErrorMessage('未查找到物料【' + itemCode + '】的发货明细', res => { |
|||
getfocus(); |
|||
}); |
|||
return; |
|||
} else { |
|||
uni.showLoading({ |
|||
title: '加载中', |
|||
mask: true |
|||
}); |
|||
getBalanceByManagementPrecision(result.label, fromLocationCode.value, fromInventoryStatuses.value, balanceRes => { |
|||
if (balanceRes.success) { |
|||
if (balanceRes.data.list.length == 0) { |
|||
showErrorMessage('在来源库位[' + fromLocationCode.value + '],未查找到该包装的库存记录', res => { |
|||
packGetFocus(); |
|||
}); |
|||
} else if (balanceRes.data.list.length == 1) { |
|||
let balance = balanceRes.data.list[0]; |
|||
afterGetBalance(result.label, balance, packageInfo); |
|||
} else { |
|||
label.value = result.label; |
|||
showBalanceSelect(balanceRes.data.list, packageInfo); |
|||
} |
|||
} else { |
|||
showErrorMessage(balanceRes.message); |
|||
} |
|||
uni.hideLoading(); |
|||
}); |
|||
} |
|||
} catch (error) { |
|||
showErrorMessage(error); |
|||
uni.hideLoading(); |
|||
} |
|||
}; |
|||
|
|||
const selectBalanceItem = (balance) => { |
|||
afterGetBalance(balance, balance, packageInfo.value); |
|||
}; |
|||
|
|||
const afterGetBalance = (label, balance, packageInfo) => { |
|||
try { |
|||
let itemCode = label.itemCode; |
|||
let packingCode = label.packingNumber; |
|||
let lot = label.batch; |
|||
let item = toLocation.value.find(r => r.itemCode == itemCode); |
|||
item.scaned = true; |
|||
fromLocationCode.value = balance.locationCode; |
|||
if (item.fromLocation != fromLocationCode.value) { |
|||
if (item.batch != undefined) { |
|||
addRecord(item.batch, label, balance, packageInfo); |
|||
} else { |
|||
if (jobContent.value.allowModifyBatch == "TRUE") { |
|||
showQuestionMessage('在【' + fromLocationCode.value + '】库位下,未查找到批次【' + lot + |
|||
'】的发货明细,是否要继续发货?', res => { |
|||
if (res) { |
|||
let batch = createBatchInfo(label, balance, packageInfo); |
|||
// 新增加的批次赋值details |
|||
if (fromLocation.value.Batchs.length > 0) { |
|||
batch.detail = fromLocation.value.Batchs[0].detail; |
|||
} |
|||
fromLocation.value.Batchs.unshift(batch); |
|||
} |
|||
}); |
|||
} else { |
|||
showErrorMessage('未查找到批次【' + lot + '】的发货明细', res => { |
|||
getfocus(); |
|||
}); |
|||
} |
|||
} |
|||
} else { |
|||
showErrorMessage('未查找到推荐库位【' + fromLocationCode.value + '】的发货明细', res => { |
|||
getfocus(); |
|||
}); |
|||
} |
|||
} catch (e) { |
|||
showErrorMessage(e.stack, res => { |
|||
getfocus(); |
|||
}); |
|||
} |
|||
}; |
|||
|
|||
const createBatchInfo = (data, balance, packageInfo) => { |
|||
let batch = { |
|||
batch: data.batch, |
|||
qty: 0, |
|||
uom: data.uom, |
|||
handleQty: Number(data.qty), |
|||
Records: [] |
|||
}; |
|||
let record = creatRecord(data, balance, packageInfo); |
|||
batch.Records.push(record); |
|||
issueRecord.value.unshift(record); |
|||
return batch; |
|||
}; |
|||
|
|||
const creatRecord = (label, balance, packageInfo) => { |
|||
balance.packQty = packageInfo.packQty; |
|||
balance.packUnit = packageInfo.packUnit; |
|||
let record = { |
|||
itemCode: label.itemCode, |
|||
packingNumber: label.packingNumber, |
|||
batch: label.batch, |
|||
qty: Number(label.qty) > Number(balance.qty) ? Number(balance.qty) : Number(label.qty), |
|||
uom: balance.uom, |
|||
inventoryStatus: balance.inventoryStatus, |
|||
balance: balance, |
|||
toLocationCode: toLocationCode.value, |
|||
supplierCode: label.supplierCode |
|||
}; |
|||
return record; |
|||
}; |
|||
|
|||
const calcBatchHandleQty = (batch, label, balance) => { |
|||
dataContent.value.subList.forEach(item => { |
|||
if (item.itemCode == balance.itemCode && item.batch == batch) { |
|||
item.handleQty = label.qty; |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
const addRecord = (batch, label, balance, packageInfo) => { |
|||
calcBatchHandleQty(batch, label, balance); |
|||
}; |
|||
|
|||
const getfocus = () => { |
|||
if (comscanRef.value) { |
|||
comscanRef.value.getfocus(); |
|||
} |
|||
}; |
|||
|
|||
const losefocus = () => { |
|||
if (comscanRef.value) { |
|||
comscanRef.value.losefocus(); |
|||
} |
|||
}; |
|||
|
|||
const expands = () => { |
|||
expand.value = !expand.value; |
|||
expendIcon.value = expand.value ? "arrow-down" : "arrow-up"; |
|||
}; |
|||
|
|||
const swipeClick = (e, item, index) => { |
|||
if (e.content.text == "详情") { |
|||
detail(item); |
|||
} else if (e.content.text == "编辑") { |
|||
edit(item); |
|||
} else if (e.content.text == "移除") { |
|||
remove(item, index); |
|||
} |
|||
}; |
|||
|
|||
const edit = (item) => { |
|||
editItem.value = item; |
|||
item.balance.balanceQty = item.balance.qty; |
|||
balanceQtyEditRef.value.openEditPopup(item.balance, item.qty); |
|||
}; |
|||
|
|||
const detail = (item) => { |
|||
showItem.value = item; |
|||
receiptHintRef.value.openScanPopup(); |
|||
}; |
|||
|
|||
const remove = (record, index) => { |
|||
showQuestionMessage("确定移除扫描信息?", res => { |
|||
if (res) { |
|||
record.qty = 0; |
|||
issueRecord.value.splice(index, 1); |
|||
|
|||
let item = toLocation.value.Items.find(r => r.itemCode == record.itemCode); |
|||
if (item != undefined) { |
|||
item.Locations.forEach(l => { |
|||
let batch = l.Batchs.find(b => b.packingNumber == record.packingNumber && b.batch == record.batch); |
|||
let rIndex = batch.Records.findIndex(r => r.packingNumber == record.packingNumber && r.batch == record.batch); |
|||
batch.Records.splice(rIndex, 1); |
|||
}); |
|||
} |
|||
emit('updateData', item); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
const packGetFocus = () => { |
|||
comscanRef.value.getfocus(); |
|||
}; |
|||
|
|||
const packLoseFocus = () => { |
|||
comscanRef.value.losefocus(); |
|||
}; |
|||
|
|||
const showMessage = (message, callback) => { |
|||
setTimeout(() => { |
|||
packLoseFocus(); |
|||
comMessageRef.value.showMessage(message, callback); |
|||
}); |
|||
}; |
|||
|
|||
const showErrorMessage = (message, callback) => { |
|||
setTimeout(() => { |
|||
packLoseFocus(); |
|||
comMessageRef.value.showErrorMessage(message, callback); |
|||
}); |
|||
}; |
|||
|
|||
const showQuestionMessage = (message, callback) => { |
|||
setTimeout(() => { |
|||
packLoseFocus(); |
|||
comMessageRef.value.showQuestionMessage(message, callback); |
|||
}); |
|||
}; |
|||
|
|||
const confirm = (val) => { |
|||
editItem.value.qty = Number(val); |
|||
emit('updateData', editItem.value); |
|||
}; |
|||
|
|||
const cancle = () => { |
|||
closeScanPopup(); |
|||
}; |
|||
</script> |
|||
|
|||
<style lang="scss"> |
|||
button { |
|||
border: none; |
|||
} |
|||
|
|||
button::after { |
|||
border: none |
|||
} |
|||
|
|||
.scroll-view { |
|||
overflow-y: scroll; |
|||
height: auto; |
|||
max-height: 300rpx; |
|||
padding: 10rpx; |
|||
} |
|||
</style> |
@ -0,0 +1,129 @@ |
|||
<template> |
|||
<view> |
|||
<!-- <requiredLocation title="需求库位" :locationCode="dataContent.toLocationCode" |
|||
:isShowEdit="dataContent.allowModifyLocation==1"></requiredLocation> --> |
|||
<view v-for="(item,index) in dataContent.subList"> |
|||
<u-swipe-action ref="swipeAction" |
|||
:options="(item.scaned&&isEdit)?editAndRemoveOptions : item.scaned? removeOptions:options" |
|||
:class="item.scaned? 'scan_view':''" @click="(...event)=>swipeClick(event,item,index)"> |
|||
<uni-swipe-action-item |
|||
:right-options="(item.scaned&&isEdit)?editAndRemoveOptions : item.scaned? removeOptions:options" |
|||
@click="swipeClick($event,item,index)" style='padding:0px 0px 5px 0px;align-items: center;'> |
|||
<item-qty :dataContent="item" :handleQty="item.handleQty" :isShowBalanceQty="false"></item-qty> |
|||
<location :locationCode="item.fromLocationCode"> |
|||
</location> |
|||
<handleBalanceBatch :detail="item" :isShowLocation="false" |
|||
:isShowBatch="true" :isShowPack='false'> |
|||
</handleBalanceBatch> |
|||
</uni-swipe-action-item> |
|||
</u-swipe-action> |
|||
</view> |
|||
</view> |
|||
<qtyEdit ref="balanceQtyEditRef" @confirm="confirm" :isShowStatus="true"></qtyEdit> |
|||
<detail-info-popup ref="detailInfoPopup"></detail-info-popup> |
|||
<comMessage ref="messageRef"></comMessage> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import itemQty from '@/mycomponents/item/itemQty.vue' |
|||
import recommend from '@/mycomponents/recommend/recommend.vue' |
|||
import recommendBalance from '@/mycomponents/balance/recommendBalance.vue' |
|||
import handleBalance from '@/mycomponents/balance/handleBalance.vue' |
|||
import handleBalanceBatch from '@/mycomponents/balance/handleBalanceBatch.vue' |
|||
import recommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue' |
|||
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue' |
|||
import requiredLocation from '@/mycomponents/location/requiredLocation.vue' |
|||
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue' |
|||
import qtyEdit from '@/mycomponents/qty/qtyEdit.vue' |
|||
import location from '@/mycomponents/balance/location.vue' |
|||
import detailInfoPopup from '@/pages/productionReceipt/coms/detailInfoPopup.vue' |
|||
|
|||
import { |
|||
getDetailOption, |
|||
getPurchaseReceiptOption, |
|||
getRemoveOption, |
|||
getEditRemoveOption |
|||
} from '@/common/array.js'; |
|||
|
|||
import {ref, onMounted, watch,nextTick} from 'vue'; |
|||
|
|||
const props = defineProps({ |
|||
dataContent: { |
|||
type: Object, |
|||
default: null |
|||
}, |
|||
settingParam: { |
|||
type: Object, |
|||
default: null |
|||
}, |
|||
isEdit: { |
|||
type: Boolean, |
|||
default: true |
|||
} |
|||
}); |
|||
const emit = defineEmits(['updateData']) |
|||
const option = ref([]); |
|||
const showItem = ref({}); |
|||
const editItem = ref({}); |
|||
const batchItem = ref({}); |
|||
const detailOptions = ref([]); |
|||
const scanOptions = ref([]); |
|||
const removeOptions = ref([]); |
|||
const editAndRemoveOptions = ref([]); |
|||
|
|||
const collapseRef = ref([]); |
|||
const balanceQtyEditRef = ref(null); |
|||
const receiptHintRef = ref(null); |
|||
const messageRef = ref(null); |
|||
|
|||
onMounted(() => { |
|||
removeOptions.value = getRemoveOption(); |
|||
editAndRemoveOptions.value = getEditRemoveOption(); |
|||
}); |
|||
|
|||
const resizeCollapse = () => { |
|||
nextTick(() => { |
|||
collapseRef.value.forEach(r => { |
|||
r.childrens.forEach(i => { |
|||
i.init(); |
|||
}); |
|||
r.resize(); |
|||
}); |
|||
}); |
|||
}; |
|||
|
|||
const swipeClick = (e, item, index) => { |
|||
if (e.content.text == "编辑") { |
|||
edit(item); |
|||
} else if (e.content.text == "移除") { |
|||
remove(item, index); |
|||
} |
|||
}; |
|||
|
|||
const edit = (item) => { |
|||
editItem.value = item; |
|||
balanceQtyEditRef.value.openEditPopup(item); |
|||
}; |
|||
|
|||
const detail = (item) => { |
|||
showItem.value = item; |
|||
receiptHintRef.value.openScanPopup(); |
|||
}; |
|||
|
|||
const remove = (item, index) => { |
|||
messageRef.value.showQuestionMessage("确定移除扫描信息?", res => { |
|||
if (res) { |
|||
item.handleQty = 0; |
|||
item.scaned = false; |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
const confirm = (val) => { |
|||
editItem.value.handleQty = val; |
|||
emit('updateData', editItem.value); |
|||
}; |
|||
</script> |
|||
|
|||
<style> |
|||
</style> |
@ -0,0 +1,408 @@ |
|||
<template> |
|||
<view class="page-wraper"> |
|||
<view class="page-header"> |
|||
<view class="header-view"> |
|||
<view class="header_job_top"> |
|||
<job-top :dataContent="jobContent"></job-top> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="page-main"> |
|||
<scroll-view scroll-y="true" class=""> |
|||
<comStockUpDetailCardBatch |
|||
ref='comIssueDetailCard' |
|||
:dataContent="detailSource" |
|||
@updateData='updateData' |
|||
:settingParam="jobContent" |
|||
> |
|||
</comStockUpDetailCardBatch> |
|||
</scroll-view> |
|||
</view> |
|||
|
|||
|
|||
<view class="page-footer"> |
|||
<view class="uni-flex u-col-center space-between padding_10" |
|||
style="background-color:ghostwhite; width: 100%; "> |
|||
<view class=""> |
|||
<locationCompare ref='comScanLocation' title="目标库位" :recommendLocationCode="jobToLocationCode" |
|||
:locationCode="toLocationCode" @getLocation='scanLocationCode' |
|||
:locationAreaTypeList="toLocationAreaTypeList"></locationCompare> |
|||
</view> |
|||
<view class=" uni-flex uni-row"> |
|||
<button class="btn_single_commit" hover-class="btn_commit_after" @click="submit">提交</button> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
|
|||
<!-- <div class="btn_bottom"> |
|||
<view class="" style="display: flex;flex-direction: row;"> |
|||
<view class=""> |
|||
<button class="btn_commit" hover-class="btn_commit_after" @click="submit()">提交</button> |
|||
</view> |
|||
</view> |
|||
</div> --> |
|||
<win-scan-button @goScan='openScanDetailPopup'></win-scan-button> |
|||
<comScanStockUpPackBatch ref="comScanIssuePackRef" @closeScan='closeScan' @updateData='updateData'> |
|||
</comScanStockUpPackBatch> |
|||
<comMessage ref="comMessageRef"></comMessage> |
|||
</view> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import { |
|||
getStockUpJobDetail, |
|||
takeStockUpJob, |
|||
cancleTakeStockUpJob, |
|||
stockUpJobsubmit |
|||
} from '@/api/request2.js'; |
|||
|
|||
import { |
|||
calc |
|||
} from '@/common/calc.js'; |
|||
|
|||
import { |
|||
goHome, |
|||
navigateBack, |
|||
getRemoveOption, |
|||
getCurrDateTime, |
|||
getDirectoryItemArray, |
|||
getPackingNumberAndBatch, |
|||
deepCopyData |
|||
} from '@/common/basic.js'; |
|||
|
|||
import { |
|||
getDataSource |
|||
} from '@/pages/issue/js/issue.js'; |
|||
|
|||
import { |
|||
getManagementPrecisions |
|||
} from '@/common/balance.js'; |
|||
|
|||
|
|||
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue' |
|||
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|||
import comStockUpDetailCardBatch from '@/pages/stockUp/coms/comStockUpDetailCardBatch.vue' |
|||
import comScanStockUpPackBatch from '@/pages/stockUp/coms/comScanStockUpPackBatch.vue' |
|||
import jobTop from '@/mycomponents/job/jobTop.vue' |
|||
import locationCompare from '@/mycomponents/location/locationCompare.vue' |
|||
|
|||
import { ref, onMounted, watch } from 'vue'; |
|||
import { onShow, onNavigationBarButtonTap, onBackPress } from '@dcloudio/uni-app'; |
|||
|
|||
const id = ref(''); |
|||
const jobContent = ref({}); |
|||
const subList = ref([]); |
|||
const detailSource = ref([]); |
|||
const detailOptions = ref([]); |
|||
const scanOptions = ref([]); |
|||
const status = ref(""); |
|||
const toLocationCode = ref(""); |
|||
const jobStatus = ref(""); |
|||
const toLocationAreaTypeList = ref([]); |
|||
const jobToLocationCode = ref(""); |
|||
const fromLocationCode = ref('') |
|||
const managementList = ref([]); |
|||
const dataContent = ref({}); |
|||
|
|||
const comMessageRef = ref(null); |
|||
const scanPopupRef = ref(null); |
|||
const comScanIssuePackRef = ref(null); |
|||
|
|||
onShow((option) => { |
|||
uni.setNavigationBarTitle({ |
|||
title: option.title + '详情' |
|||
}); |
|||
id.value = option.id; |
|||
if (id.value !== undefined) { |
|||
if (option.status === "1") { |
|||
receive(() => { |
|||
getDetail(); |
|||
}); |
|||
} else { |
|||
getDetail(); |
|||
} |
|||
} |
|||
}); |
|||
|
|||
onNavigationBarButtonTap((e) => { |
|||
if (e.index === 0) { |
|||
goHome(); |
|||
} |
|||
}); |
|||
|
|||
onBackPress((e) => { |
|||
if (e.from === 'backbutton') { |
|||
if (jobStatus.value === "2") { |
|||
cancleTakeStockUpJob(id.value).then(() => { |
|||
uni.navigateBack(); |
|||
}).catch(() => { |
|||
uni.navigateBack(); |
|||
}); |
|||
} else { |
|||
uni.navigateBack(); |
|||
} |
|||
return true; |
|||
} |
|||
}); |
|||
|
|||
const receive = (callback) => { |
|||
if (id.value !== null) { |
|||
takeStockUpJob(id.value).then(() => { |
|||
callback(); |
|||
}).catch((error) => { |
|||
showErrorMessage(error); |
|||
}); |
|||
} |
|||
}; |
|||
|
|||
const getDetail = () => { |
|||
uni.showLoading({ |
|||
title: "加载中....", |
|||
mask: true |
|||
}); |
|||
getStockUpJobDetail(id.value).then((res) => { |
|||
uni.hideLoading(); |
|||
if (res.data == null) { |
|||
showMessage('未获取到详情'); |
|||
} else { |
|||
if (res.data.subList.length > 0) { |
|||
jobContent.value = res.data; |
|||
jobStatus.value = res.data.status; |
|||
subList.value = res.data.subList; |
|||
detailSource.value = res.data; |
|||
fromLocationCode.value = subList.value[0].fromLocationCode; |
|||
jobToLocationCode.value = subList.value[0].toLocationCode; |
|||
toLocationAreaTypeList.value = getDirectoryItemArray(jobContent.value.toAreaTypes); |
|||
resizeCollapse(); |
|||
} else { |
|||
showMessage('列表数据为0'); |
|||
} |
|||
} |
|||
}).catch((error) => { |
|||
uni.hideLoading(); |
|||
showErrorMessage(error); |
|||
}); |
|||
}; |
|||
|
|||
const scanLocationCode = (location, code) => { |
|||
toLocationCode.value = code; |
|||
detailSource.value.subList.forEach((item) => { |
|||
item.toLocationCode = code; |
|||
}); |
|||
}; |
|||
|
|||
const closeScan = () => { |
|||
resizeCollapse(); |
|||
}; |
|||
|
|||
const resizeCollapse = () => { |
|||
// 实现具体逻辑 |
|||
}; |
|||
|
|||
const submit = () => { |
|||
uni.showLoading({ |
|||
title: "提交中....", |
|||
mask: true |
|||
}); |
|||
|
|||
const itemCodes = []; |
|||
const locationCode = detailSource.value.subList[0].toLocationCode; |
|||
detailSource.value.subList.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(); |
|||
if (!params.subList || params.subList.length === 0) { |
|||
uni.hideLoading(); |
|||
showErrorMessage("请扫描您需要提交的备货任务"); |
|||
return; |
|||
} |
|||
|
|||
stockUpJobsubmit(params).then((res) => { |
|||
uni.hideLoading(); |
|||
if (res.data) { |
|||
showCommitSuccessMessage("提交成功\n生成备货记录" + 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.subList.forEach((r) => { |
|||
if (r.scaned) { |
|||
const subItem = { ...r }; |
|||
subItem.recordList = []; |
|||
const record = { |
|||
handleQty: r.handleQty, |
|||
toContainerNumber: r.ContainerNumber, |
|||
toInventoryStatus: r.inventoryStatus, |
|||
toLocationCode: subItem.toLocationCode, |
|||
supplierCode: r.supplierCode, |
|||
...getPackingNumberAndBatch(managementList.value, r.itemCode, r.packingNumber, r.batch) |
|||
}; |
|||
subItem.recordList.push(record); |
|||
subList.push(deepCopyData(subItem)); |
|||
} |
|||
}); |
|||
|
|||
jobContent.value.subList = subList; |
|||
jobContent.value.createTime = createTime; |
|||
jobContent.value.creator = creator; |
|||
return jobContent.value; |
|||
}; |
|||
|
|||
const cancel = () => { |
|||
comMessageRef.value.showQuestionMessage('是否要清空已扫描的物料和目标库位信息?', (res) => { |
|||
if (res) { |
|||
clearInfo(); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
const clearInfo = () => { |
|||
dataContent.value.itemCodeList.forEach((res) => { |
|||
if (res.recommendList != null) { |
|||
res.recommendList.forEach((res1) => { |
|||
if (res1.locationCodeList != null) { |
|||
res1.locationCodeList.forEach((res2) => { |
|||
if (res2.packingCodeList != null) { |
|||
res2.packingCodeList.forEach((res3) => { |
|||
res3.itemCode = ""; |
|||
res3.qty = 0; |
|||
}); |
|||
} |
|||
}); |
|||
} |
|||
}); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
const updateData = (record) => { |
|||
// 实现具体逻辑 |
|||
}; |
|||
|
|||
const scanPopupGetFocus = () => { |
|||
if (scanPopupRef.value != undefined) { |
|||
scanPopupRef.value.getfocus(); |
|||
} |
|||
}; |
|||
|
|||
const showMessage = (message) => { |
|||
comMessageRef.value.showMessage(message, (res) => { |
|||
if (res) { |
|||
afterCloseMessage(); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
const showErrorMessage = (message) => { |
|||
comMessageRef.value.showErrorMessage(message, (res) => { |
|||
if (res) { |
|||
afterCloseMessage(); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
const showScanMessage = (message) => { |
|||
comMessageRef.value.showScanMessage(message); |
|||
}; |
|||
|
|||
const showCommitSuccess = () => { |
|||
comMessageRef.value.showCommitSuccess(); |
|||
}; |
|||
|
|||
const showCommitSuccessMessage = (hint) => { |
|||
comMessageRef.value.showSuccessMessage(hint, (res) => { |
|||
navigateBack(1); |
|||
}); |
|||
}; |
|||
|
|||
const showRescanMessage = (message) => { |
|||
comMessageRef.value.showRescanMessage(message); |
|||
}; |
|||
|
|||
const afterCloseMessage = () => { |
|||
scanPopupGetFocus(); |
|||
}; |
|||
|
|||
const closeScanMessage = () => { |
|||
scanPopupGetFocus(); |
|||
}; |
|||
|
|||
const confirm = (data) => { |
|||
dataContent.value = data; |
|||
}; |
|||
|
|||
const confirmResult = (result) => { |
|||
dataContent.value = result; |
|||
// 使用 forceUpdate 方法更新组件 |
|||
// 注意:Vue 3 不再需要 forceUpdate,因为响应式系统会自动处理 |
|||
}; |
|||
|
|||
const openScanDetailPopup = () => { |
|||
const datacontent = { ...detailSource.value }; // 深度克隆 |
|||
comScanIssuePackRef.value.openScanPopup(detailSource.value, jobContent.value); |
|||
}; |
|||
|
|||
const closeScanPopup = () => { |
|||
updateCommitBtn(); |
|||
}; |
|||
|
|||
const updateCommitBtn = () => { |
|||
// 实现具体逻辑 |
|||
}; |
|||
|
|||
</script> |
|||
|
|||
<style scoped lang="scss"> |
|||
.uni-numbox__value { |
|||
width: 40px; |
|||
} |
|||
|
|||
button[disabled] { |
|||
background-color: #3C9CFF; |
|||
color: #fff; |
|||
opacity: 0.7; |
|||
} |
|||
|
|||
|
|||
// /deep/ .input-value { |
|||
// font-size: 16px; |
|||
// } |
|||
|
|||
// /deep/ .uni-collapse-item__title-text { |
|||
// font-size: 16px; |
|||
// } |
|||
|
|||
// /deep/ .uni-collapse-item--border { |
|||
// border-bottom-width: 0px; |
|||
// border-bottom-color: #ebeef5; |
|||
// } |
|||
|
|||
// /deep/ .uni-collapse-item--border { |
|||
// border-bottom-width: 1px; |
|||
// border-bottom-color: #ebeef5; |
|||
// } |
|||
</style> |
Loading…
Reference in new issue