9 changed files with 2248 additions and 105 deletions
@ -0,0 +1,176 @@ |
|||||
|
<template> |
||||
|
<view> |
||||
|
<!-- <requiredLocation title="需求库位" :locationCode="dataContent.toLocationCode" |
||||
|
:isShowEdit="dataContent.allowModifyLocation==1"></requiredLocation> --> |
||||
|
<view v-for="(item,index) in dataContent.Items"> |
||||
|
<u-collapse ref="collapse"> |
||||
|
<u-collapse-item :open="true"> |
||||
|
<template v-slot:title> |
||||
|
<view class="split_line"></view> |
||||
|
<!-- 物品 --> |
||||
|
<u-swipe-action ref="swipeAction" @click="(...event)=>itemCoceClick(event,item,index)" :options="removeOptions"> |
||||
|
<item-qty :dataContent="item" :isShowBalanceQty="false" :handleQty="item.handleQty"></item-qty> |
||||
|
</u-swipe-action> |
||||
|
<!-- <com-issue-request-info :workShopCode="dataContent.workShopCode" :dataContent="dataContent"> |
||||
|
</com-issue-request-info> --> |
||||
|
</template> |
||||
|
<view v-for="(loacation,locatonIndex) in item.Locations"> |
||||
|
<view> |
||||
|
<view class="uni-flex uni-row space-between"> |
||||
|
<!-- 推荐库位 --> |
||||
|
<location :locationCode="loacation.fromLocationCode"> |
||||
|
</location> |
||||
|
</view> |
||||
|
<view v-for="(batch,batchIndex) in loacation.Batchs"> |
||||
|
<recommend-balance style='margin-left: 0rpx;' :detail="batch" :isShowLocation="false" |
||||
|
:isShowPack="batch.packingNumber!=null && batch.packingNumber!=''"> |
||||
|
</recommend-balance> |
||||
|
<view class="uni-flex uni-row " v-if='batch.Records.length>0'> |
||||
|
<view class="center " |
||||
|
style=" width: 20px;background-color: #0CC2B6; color: #fff; margin-left: 40px;padding: 0px 2px;"> |
||||
|
扫描 |
||||
|
</view> |
||||
|
<view class="uni-flex uni-column scan_view" style="width: 100%;"> |
||||
|
<view v-for="(record,recordIndex) in batch.Records"> |
||||
|
<u-swipe-action ref="swipeAction" |
||||
|
:options="settingParam.allowModifyQty=='TRUE'?scanOptions:removeOptions" |
||||
|
@click="(...event)=>swipeClick(event,batch,record,recordIndex,batchIndex,loacation.Batchs,locatonIndex,item.Locations)"> |
||||
|
<handle-balance :detail="record" :isShowLocation="false" :isShowBatch="false"></handle-balance> |
||||
|
</u-swipe-action> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</u-collapse-item> |
||||
|
</u-collapse> |
||||
|
</view> |
||||
|
</view> |
||||
|
<balance-qty-edit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></balance-qty-edit> |
||||
|
<detail-info-popup ref="detailInfoPopup"></detail-info-popup> |
||||
|
<comMessage ref="message"></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 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 location from '@/mycomponents/balance/location.vue' |
||||
|
import detailInfoPopup from '@/pages/productionReceipt/coms/detailInfoPopup.vue' |
||||
|
import comIssueRequestInfo from '@/pages/issue/coms/comIssueRequestInfo.vue' |
||||
|
import { |
||||
|
getDetailOption, |
||||
|
getEditRemoveOption, |
||||
|
getRemoveOption |
||||
|
} from '@/common/array.js'; |
||||
|
|
||||
|
|
||||
|
import { ref, onMounted, watch, nextTick } from 'vue'; |
||||
|
|
||||
|
const props = defineProps({ |
||||
|
dataContent: { |
||||
|
type: Object, |
||||
|
default: () => ({}) |
||||
|
}, |
||||
|
settingParam: { |
||||
|
type: Object, |
||||
|
default: () => ({}) |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
const option = ref([]); |
||||
|
const showItem = ref({}); |
||||
|
const editItem = ref({}); |
||||
|
const batchItem = ref({}); |
||||
|
const detailOptions = ref([]); |
||||
|
const scanOptions = ref([]); |
||||
|
const removeOptions = ref([]); |
||||
|
|
||||
|
const collapse = ref(null); |
||||
|
const balanceQtyEdit = ref(null); |
||||
|
const receiptHint = ref(null); |
||||
|
const message = ref(null); |
||||
|
|
||||
|
onMounted(() => { |
||||
|
detailOptions.value = getDetailOption(); |
||||
|
scanOptions.value = getEditRemoveOption(); |
||||
|
removeOptions.value = getRemoveOption(); |
||||
|
}); |
||||
|
|
||||
|
const resizeCollapse = () => { |
||||
|
nextTick(() => { |
||||
|
if (collapse.value) { |
||||
|
collapse.value.forEach(r => { |
||||
|
r.childrens.forEach(i => { |
||||
|
i.init(); |
||||
|
}); |
||||
|
r.resize(); |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const swipeClick = (e, batch, record, recordIndex, batchIndex, Batchs, locatonIndex, Locations) => { |
||||
|
if (e.content.text === "编辑") { |
||||
|
edit(batch, record); |
||||
|
} else if (e.content.text === "移除") { |
||||
|
remove(batch, record, recordIndex, batchIndex, Batchs, locatonIndex, Locations); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const itemCoceClick = (e, item, index) => { |
||||
|
if (e.content.text === "移除") { |
||||
|
props.dataContent.Items.splice(index, 1); |
||||
|
emit('removeItemCode'); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const edit = (batch, item) => { |
||||
|
editItem.value = item; |
||||
|
batchItem.value = batch; |
||||
|
item.balance.balanceQty = item.balance.qty; |
||||
|
if (balanceQtyEdit.value) { |
||||
|
balanceQtyEdit.value.openEditPopup(item.balance, item.qty); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const detail = (item) => { |
||||
|
showItem.value = item; |
||||
|
if (receiptHint.value) { |
||||
|
receiptHint.value.openScanPopup(); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const remove = (batch, record, recordIndex, batchIndex, Batchs, locatonIndex, Locations) => { |
||||
|
if (message.value) { |
||||
|
message.value.showQuestionMessage("确定移除扫描信息?", res => { |
||||
|
if (res) { |
||||
|
batch.Records.splice(recordIndex, 1); |
||||
|
if (batch.Records.length === 0 && Batchs[batchIndex].isNewAdd) { |
||||
|
Batchs.splice(batchIndex, 1); |
||||
|
} |
||||
|
if (batch.Records.length === 0 && Locations[locatonIndex].isNewAdd) { |
||||
|
Locations.splice(locatonIndex, 1); |
||||
|
} |
||||
|
resizeCollapse(); |
||||
|
emit('updateData', record); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const confirm = (val) => { |
||||
|
editItem.value.qty = val; |
||||
|
emit('updateData', editItem.value); |
||||
|
}; |
||||
|
|
||||
|
const emit = defineEmits(['removeItemCode', 'updateData']); |
||||
|
</script> |
||||
|
<style> |
||||
|
</style> |
@ -0,0 +1,153 @@ |
|||||
|
<template> |
||||
|
<view> |
||||
|
<view v-for="(item,index) in dataContent.subList"> |
||||
|
|
||||
|
<view class="split_line"></view> |
||||
|
<!-- 物品 --> |
||||
|
<u-swipe-action ref="swipeAction" :class="item.scaned?'scan_view':''" |
||||
|
:options="(item.scaned&&isEdit)?editAndRemoveOptions : item.scaned? removeOptions:options" |
||||
|
@click="(...event)=>itemCoceClick(event,item,index)" > |
||||
|
<item-qty :dataContent="item" :isShowBalanceQty="false" :handleQty="item.handleQty"></item-qty> |
||||
|
<location :locationCode="item.fromLocationCode"> |
||||
|
</location> |
||||
|
<batch :batch="item.batch"></batch> |
||||
|
</u-swipe-action> |
||||
|
</view> |
||||
|
</view> |
||||
|
<!-- <balance-qty-edit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></balance-qty-edit> --> |
||||
|
|
||||
|
<qtyEdit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></qtyEdit> |
||||
|
<detail-info-popup ref="detailInfoPopup"></detail-info-popup> |
||||
|
<comMessage ref="message"></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 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 location from '@/mycomponents/balance/location.vue' |
||||
|
import detailInfoPopup from '@/pages/productionReceipt/coms/detailInfoPopup.vue' |
||||
|
import comIssueRequestInfo from '@/pages/issue/coms/comIssueRequestInfo.vue' |
||||
|
import batch from '@/mycomponents/balance/batch.vue' |
||||
|
import qtyEdit from '@/mycomponents/qty/qtyEdit.vue' |
||||
|
import { |
||||
|
getDetailOption, |
||||
|
getPurchaseReceiptOption, |
||||
|
getRemoveOption, |
||||
|
getEditRemoveOption |
||||
|
} from '@/common/array.js'; |
||||
|
|
||||
|
|
||||
|
import { ref, onMounted, watch, nextTick } from 'vue'; |
||||
|
|
||||
|
const props = defineProps({ |
||||
|
dataContent: { |
||||
|
type: Object, |
||||
|
default: () => ({}) |
||||
|
}, |
||||
|
settingParam: { |
||||
|
type: Object, |
||||
|
default: () => ({}) |
||||
|
}, |
||||
|
isEdit: { |
||||
|
type: Boolean, |
||||
|
default: true |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
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 collapse = ref(null); |
||||
|
const balanceQtyEdit = ref(null); |
||||
|
const receiptHint = ref(null); |
||||
|
const message = ref(null); |
||||
|
|
||||
|
onMounted(() => { |
||||
|
removeOptions.value = getRemoveOption(); |
||||
|
editAndRemoveOptions.value = getEditRemoveOption(); |
||||
|
}); |
||||
|
|
||||
|
const resizeCollapse = () => { |
||||
|
nextTick(() => { |
||||
|
if (collapse.value) { |
||||
|
collapse.value.forEach(r => { |
||||
|
r.childrens.forEach(i => { |
||||
|
i.init(); |
||||
|
}); |
||||
|
r.resize(); |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const swipeClick = (e, batch, record, recordIndex, batchIndex, Batchs, locatonIndex, Locations) => { |
||||
|
if (e.content.text === "编辑") { |
||||
|
edit(batch, record); |
||||
|
} else if (e.content.text === "移除") { |
||||
|
remove(batch, record, recordIndex, batchIndex, Batchs, locatonIndex, Locations); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const itemCoceClick = (e, item, index) => { |
||||
|
if (e.content.text === "编辑") { |
||||
|
edit(item); |
||||
|
} else if (e.content.text === "移除") { |
||||
|
props.dataContent.Items.splice(index, 1); |
||||
|
emit('removeItemCode'); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const edit = (item) => { |
||||
|
editItem.value = item; |
||||
|
if (balanceQtyEdit.value) { |
||||
|
balanceQtyEdit.value.openEditPopup(item); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const detail = (item) => { |
||||
|
showItem.value = item; |
||||
|
if (receiptHint.value) { |
||||
|
receiptHint.value.openScanPopup(); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const remove = (batch, record, recordIndex, batchIndex, Batchs, locatonIndex, Locations) => { |
||||
|
if (message.value) { |
||||
|
message.value.showQuestionMessage("确定移除扫描信息?", res => { |
||||
|
if (res) { |
||||
|
batch.Records.splice(recordIndex, 1); |
||||
|
if (batch.Records.length === 0 && Batchs[batchIndex].isNewAdd) { |
||||
|
Batchs.splice(batchIndex, 1); |
||||
|
} |
||||
|
if (batch.Records.length === 0 && Locations[locatonIndex].isNewAdd) { |
||||
|
Locations.splice(locatonIndex, 1); |
||||
|
} |
||||
|
resizeCollapse(); |
||||
|
emit('updateData', record); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const confirm = (val) => { |
||||
|
editItem.value.handleQty = Number(val); |
||||
|
emit('updateData', editItem.value); |
||||
|
}; |
||||
|
|
||||
|
const emit = defineEmits(['removeItemCode', 'updateData']); |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
</style> |
File diff suppressed because it is too large
@ -0,0 +1,558 @@ |
|||||
|
<template> |
||||
|
<view> |
||||
|
<u-popup ref="popup" :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 v-if='allowModifyLocation' class="" style="width: 75%; padding: 8rpx;"> |
||||
|
<uni-combox :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请选择库位" |
||||
|
|
||||
|
@confirm="fromLocationUpdate"></uni-combox> |
||||
|
</view> |
||||
|
|
||||
|
<view v-else> |
||||
|
<text style="padding: 5px"> |
||||
|
{{fromLocationCode}} |
||||
|
</text> |
||||
|
</view> |
||||
|
</view> --> |
||||
|
|
||||
|
<view class="uni-flex uni-row" style="align-items: center; |
||||
|
background-color: #fff; |
||||
|
margin-left: 20rpx; |
||||
|
margin-right: 20rpx; |
||||
|
border-radius: 8rpx; |
||||
|
height: 30px;"> |
||||
|
<view class="uni-center" style="width: 25%;font-size: 36rpx; "> |
||||
|
来源库位 |
||||
|
</view> |
||||
|
<!-- style="width: 75%;padding: 8rpx" --> |
||||
|
<view class=""> |
||||
|
<!-- <input v-model="fromLocationCode" placeholder="请扫描来源库位" :focus="locationOnFocus" |
||||
|
placeholder-style="font-size:12px" style="padding: 5px;" @confirm="scanLocation" /> --> |
||||
|
|
||||
|
<view v-if='allowModifyLocation'> |
||||
|
<uni-combox :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请扫描来源库位" |
||||
|
@confirm="fromLocationUpdate" |
||||
|
style='height: 30rpx;border:1px solid #fff ;'></uni-combox> |
||||
|
</view> |
||||
|
<view v-else> |
||||
|
<text style="padding: 5px;font-size: 36rpx;"> |
||||
|
{{ fromLocationCode }} |
||||
|
</text> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
<view class=""> |
||||
|
<view class=""> |
||||
|
<win-com-scan ref="comscan" placeholder="箱标签" @getResult="onScan" :clearResult="true" |
||||
|
:headerType="headerType" :isShowHistory="false"> |
||||
|
</win-com-scan> |
||||
|
|
||||
|
<view style="width: 100%;" v-if="false"> |
||||
|
<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="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
<balance-qty-edit ref="balanceQtyEdit" @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 { |
||||
|
getDirectoryItemArray, |
||||
|
} from '@/common/directory.js'; |
||||
|
|
||||
|
import { |
||||
|
calc |
||||
|
} from '@/common/calc.js'; |
||||
|
import { |
||||
|
getWorkShopLineStation |
||||
|
} from '@/api/request2.js'; |
||||
|
|
||||
|
import { |
||||
|
getBalanceByManagementPrecision |
||||
|
} from '@/common/balance.js'; |
||||
|
|
||||
|
import {ref, reactive, onMounted, watch} from 'vue'; |
||||
|
|
||||
|
const props = defineProps({ |
||||
|
title: { |
||||
|
type: String, |
||||
|
default: '' |
||||
|
}, |
||||
|
headerType: { |
||||
|
type: String, |
||||
|
default: "HPQ,HMQ" |
||||
|
}, |
||||
|
allowModifyLocation: { |
||||
|
type: Boolean, |
||||
|
default: false |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
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 popup = ref(null); |
||||
|
const balanceSelect = ref(null); |
||||
|
const comscan = ref(null); |
||||
|
const receiptHint = ref(null); |
||||
|
const comMessage = ref(null); |
||||
|
const toLocationCombox = ref(null) |
||||
|
const balanceQtyEdit = ref(null) |
||||
|
const showItem = 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; |
||||
|
popup.value.open('bottom'); |
||||
|
setTimeout(() => { |
||||
|
getfocus(); |
||||
|
}, 500); |
||||
|
}; |
||||
|
|
||||
|
const closeScanPopup = () => { |
||||
|
losefocus(); |
||||
|
popup.value.close(); |
||||
|
emit("closeScan"); |
||||
|
// 清除数据,恢复默认值 |
||||
|
// Object.assign(dataContent, {}); |
||||
|
}; |
||||
|
|
||||
|
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, packageInfoValue) => { |
||||
|
packageInfo.value = packageInfoValue; |
||||
|
balanceSelect.value.openPopup(items); |
||||
|
}; |
||||
|
|
||||
|
const getFromLocationList = () => { |
||||
|
const list = []; |
||||
|
dataContent.value.subList.forEach(item => { |
||||
|
list.push(item.fromLocationCode); |
||||
|
}); |
||||
|
fromLocationCode.value = list[0]; |
||||
|
return list; |
||||
|
}; |
||||
|
|
||||
|
const fromLocationUpdate = (fromlocation) => { |
||||
|
const location = fromLocationList.value.find(r => r == fromlocation); |
||||
|
// 成品退货任务--同一物料,可以扫描提交不在任务中的库位 |
||||
|
// if (location == undefined) { |
||||
|
fromLocationCode.value = fromlocation; |
||||
|
// this.showErrorMessage('退货库位【' + fromlocation + '】不存在') |
||||
|
// } |
||||
|
}; |
||||
|
|
||||
|
const onScan = (result) => { |
||||
|
try { |
||||
|
if (fromLocationCode.value == '') { |
||||
|
showErrorMessage('请选择来源库位', () => { |
||||
|
toLocationCombox.value.onFocus(); |
||||
|
}); |
||||
|
return; |
||||
|
} |
||||
|
const packageInfoValue = result.package; |
||||
|
const itemCode = result.label.itemCode; |
||||
|
const packingCode = result.label.packingNumber; |
||||
|
const lot = result.label.batch; |
||||
|
const item = toLocation.value.find(r => r.itemCode == itemCode); |
||||
|
if (item == undefined) { |
||||
|
showErrorMessage('未查找到物料【' + itemCode + '】的退货明细', () => { |
||||
|
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 + '],未查找到该包装的库存记录', () => { |
||||
|
packGetFocus(); |
||||
|
}); |
||||
|
} else if (balanceRes.data.list.length == 1) { |
||||
|
console.log(2222); |
||||
|
const balance = balanceRes.data.list[0]; |
||||
|
afterGetBalance(result.label, balance, packageInfoValue); |
||||
|
} else { |
||||
|
label.value = result.label; |
||||
|
showBalanceSelect(balanceRes.data.list, packageInfoValue); |
||||
|
} |
||||
|
} else { |
||||
|
showErrorMessage(balanceRes.message.message); |
||||
|
} |
||||
|
uni.hideLoading(); |
||||
|
}); |
||||
|
} |
||||
|
} catch (e) { |
||||
|
showErrorMessage(e.stack); |
||||
|
uni.hideLoading(); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const selectBalanceItem = (balance) => { |
||||
|
afterGetBalance(balance, balance, packageInfo.value); |
||||
|
}; |
||||
|
|
||||
|
const afterGetBalance = (label, balance, packageInfoValue) => { |
||||
|
try { |
||||
|
const itemCode = label.itemCode; |
||||
|
const packingCode = label.packingNumber; |
||||
|
const lot = label.batch; |
||||
|
const item = toLocation.value.find(r => r.itemCode == itemCode); |
||||
|
item.scaned = true; |
||||
|
let fromLocation = toLocation.value.find(l => l.fromLocationCode == fromLocationCode.value); |
||||
|
// 成品退货任务--同一物料,可以扫描提交不在任务中的库位 |
||||
|
if (!fromLocation) { |
||||
|
fromLocation = { |
||||
|
Batchs: [{ |
||||
|
Recommends: [], |
||||
|
Records: [], |
||||
|
batch: label.batch, |
||||
|
detail: { |
||||
|
...packageInfoValue, |
||||
|
fromLocationCode: balance.locationCode, |
||||
|
toLocationCode: toLocationCode.value |
||||
|
}, |
||||
|
handleQty: 0, |
||||
|
packingNumber: null, |
||||
|
qty: label.qty, |
||||
|
uom: label.uom |
||||
|
}], |
||||
|
toLocationCode: toLocationCode.value, |
||||
|
fromLocationCode: balance.locationCode, |
||||
|
handleQty: 0, |
||||
|
qty: label.qty, |
||||
|
uom: label.uom |
||||
|
}; |
||||
|
item.Locations.push(fromLocation); |
||||
|
} |
||||
|
if (fromLocation != undefined) { |
||||
|
const batch = fromLocation.Batchs.find(b => b.batch == label.batch); |
||||
|
if (batch != undefined) { |
||||
|
addRecord(batch, label, balance, packageInfoValue); |
||||
|
} else { |
||||
|
if (jobContent.value.allowModifyBatch == "TRUE") { |
||||
|
showQuestionMessage('在【' + fromLocationCode.value + '】库位下,未查找到批次【' + lot + |
||||
|
'】的退货明细,是否要继续退货?', (res) => { |
||||
|
if (res) { |
||||
|
const batch = createBatchInfo(label, balance, packageInfoValue); |
||||
|
fromLocation.Batchs.unshift(batch); |
||||
|
} |
||||
|
}); |
||||
|
} else { |
||||
|
showErrorMessage("未查找到\n物料【" + itemCode + "】批次【" + lot + "】的退货明细", () => { |
||||
|
getfocus(); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} else { |
||||
|
showErrorMessage('未查找到推荐库位【' + fromLocationCode.value + '】的退货明细', () => { |
||||
|
getfocus(); |
||||
|
}); |
||||
|
} |
||||
|
} catch (e) { |
||||
|
showErrorMessage(e.stack, () => { |
||||
|
getfocus(); |
||||
|
}); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const createBatchInfo = (data, balance, packageInfoValue) => { |
||||
|
const batch = { |
||||
|
batch: data.lot || data.batch, |
||||
|
qty: 0, |
||||
|
uom: data.uom, |
||||
|
handleQty: Number(data.qty), |
||||
|
Records: [], |
||||
|
detail: { |
||||
|
fromLocationCode: fromLocationCode.value, //balance.locationCode |
||||
|
toLocationCode: toLocationCode.value, |
||||
|
itemCode: data.itemCode, |
||||
|
handleQty: Number(data.qty), |
||||
|
packingNumber: data.packingNumber, |
||||
|
qty: 0, |
||||
|
uom: data.uom, |
||||
|
itemName: packageInfoValue.itemName, |
||||
|
itemDesc1: packageInfoValue.itemDesc1, |
||||
|
itemDesc2: packageInfoValue.itemDesc2, |
||||
|
singlePrice: balance.singlePrice, |
||||
|
amount: balance.amount |
||||
|
} |
||||
|
}; |
||||
|
const record = creatRecord(data, balance, packageInfoValue); |
||||
|
batch.Records.push(record); |
||||
|
issueRecord.value.unshift(record); |
||||
|
return batch; |
||||
|
}; |
||||
|
|
||||
|
const creatRecord = (label, balance, packageInfoValue) => { |
||||
|
balance.packQty = packageInfoValue.packQty; |
||||
|
balance.packUnit = packageInfoValue.packUnit; |
||||
|
let record = { |
||||
|
scaned: true, |
||||
|
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, |
||||
|
packUnit: packageInfoValue.packUnit, |
||||
|
packQty: packageInfoValue.packQty, |
||||
|
singlePrice: balance.singlePrice, |
||||
|
amount: balance.amount |
||||
|
}; |
||||
|
return record; |
||||
|
}; |
||||
|
|
||||
|
const calcBatchHandleQty = (batch, label, balance) => { |
||||
|
dataContent.value.subList.forEach(item => { |
||||
|
if (item.itemCode == balance.itemCode && item.batch == batch) { |
||||
|
item.handleQty = item.handleQty || 0; |
||||
|
item.handleQty = item.handleQty + label.qty; |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const addRecord = (batch, label, balance, packageInfoValue) => { |
||||
|
calcBatchHandleQty(batch, label, balance); |
||||
|
getfocus(); |
||||
|
}; |
||||
|
|
||||
|
const getfocus = () => { |
||||
|
if (comscan.value != undefined) { |
||||
|
comscan.value.getfocus(); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const losefocus = () => { |
||||
|
if (comscan.value != undefined) { |
||||
|
comscan.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; |
||||
|
balanceQtyEdit.value.openEditPopup(item.balance, item.qty); |
||||
|
}; |
||||
|
|
||||
|
const detail = (item) => { |
||||
|
showItem.value = item; |
||||
|
receiptHint.value.openScanPopup(); |
||||
|
}; |
||||
|
|
||||
|
const remove = (record, index) => { |
||||
|
showQuestionMessage("确定移除扫描信息?", (res) => { |
||||
|
if (res) { |
||||
|
record.qty = 0; |
||||
|
issueRecord.value.splice(index, 1); |
||||
|
const item = toLocation.value.Items.find(r => r.itemCode == record.itemCode); |
||||
|
if (item != undefined) { |
||||
|
item.Locations.forEach(l => { |
||||
|
const batch = l.Batchs.find(b => b.packingNumber == record.packingNumber && b.batch == record.batch); |
||||
|
const rIndex = batch.Records.findIndex(r => r.packingNumber == record.packingNumber && r.batch == record.batch); |
||||
|
batch.Records.splice(rIndex, 1); |
||||
|
}); |
||||
|
} |
||||
|
emit('updateData', item); |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const packGetFocus = () => { |
||||
|
comscan.value.getfocus(); |
||||
|
}; |
||||
|
|
||||
|
const packLoseFocus = () => { |
||||
|
comscan.value.losefocus(); |
||||
|
}; |
||||
|
|
||||
|
const showMessage = (message, callback) => { |
||||
|
setTimeout(() => { |
||||
|
packLoseFocus(); |
||||
|
comMessage.value.showMessage(message, callback); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const showErrorMessage = (message, callback) => { |
||||
|
setTimeout(() => { |
||||
|
packLoseFocus(); |
||||
|
comMessage.value.showErrorMessage(message, callback); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const showQuestionMessage = (message, callback) => { |
||||
|
setTimeout(() => { |
||||
|
packLoseFocus(); |
||||
|
comMessage.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,111 @@ |
|||||
|
import { |
||||
|
calc |
||||
|
} from '@/common/calc.js'; |
||||
|
export function getDataSource(list, subList) { |
||||
|
for (var i = 0; i < subList.length; i++) { |
||||
|
let detail = subList[i]; |
||||
|
var location = list.find(r => |
||||
|
r.toLocationCode == detail.toLocationCode) |
||||
|
if (location == undefined) { |
||||
|
location = { |
||||
|
toLocationCode: detail.toLocationCode, |
||||
|
productionLineCode: detail.productionLineCode, |
||||
|
workStationCode: detail.workStationCode, |
||||
|
Items: [] |
||||
|
} |
||||
|
list.push(location); |
||||
|
} |
||||
|
createDetailInfo(location, detail); |
||||
|
} |
||||
|
return list; |
||||
|
} |
||||
|
|
||||
|
//树形结构:需求库位 -> 物料Items -> 库位 Locations-> 批次Batchs -> 记录Records
|
||||
|
export function createDetailInfo(location, detail) { |
||||
|
var item = location.Items.find(r => |
||||
|
r.itemCode == detail.itemCode) |
||||
|
if (item == undefined) { |
||||
|
item = createItemInfo(detail); |
||||
|
location.Items.push(item) |
||||
|
} else { |
||||
|
item.qty = calc.add(item.qty,detail.qty) |
||||
|
//在物料下查找库位
|
||||
|
let location = item.Locations.find(r => r.fromLocationCode == detail.fromLocationCode); |
||||
|
if (location == undefined) { |
||||
|
location = createLocationInfo(detail); |
||||
|
item.Locations.push(location); |
||||
|
} else { |
||||
|
//在库位下查找批次
|
||||
|
let batch = location.Batchs.find(r => r.batch == detail.batch); |
||||
|
if (batch == undefined) { |
||||
|
let batch = createBatchInfo(detail); |
||||
|
location.Batchs.push(batch); |
||||
|
} else { |
||||
|
if (detail.packingNumber != "" && detail.packingNumber != null) { |
||||
|
batch.Recommends.push(detail); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
export function createItemInfo(detail) { |
||||
|
let item = { |
||||
|
itemCode: detail.itemCode, |
||||
|
itemName: detail.itemName, |
||||
|
onTheWayLocationCode:detail.onTheWayLocationCode, |
||||
|
productionLineCode: detail.productionLineCode, |
||||
|
workStationCode: detail.workStationCode, |
||||
|
packQty: detail.packQty, |
||||
|
packUnit: detail.packUnit, |
||||
|
qty: detail.qty, |
||||
|
uom: detail.uom, |
||||
|
handleQty: 0, |
||||
|
Locations: [] |
||||
|
} |
||||
|
let location = createLocationInfo(detail); |
||||
|
item.Locations.push(location); |
||||
|
return item; |
||||
|
} |
||||
|
|
||||
|
export function createLocationInfo(detail) { |
||||
|
let location = { |
||||
|
fromLocationCode: detail.fromLocationCode, |
||||
|
qty: detail.qty, |
||||
|
uom: detail.uom, |
||||
|
handleQty: 0, |
||||
|
Batchs: [] |
||||
|
} |
||||
|
let batch = createBatchInfo(detail); |
||||
|
location.Batchs.push(batch); |
||||
|
return location; |
||||
|
} |
||||
|
|
||||
|
export function createBatchInfo(detail) { |
||||
|
let batch = { |
||||
|
detail: detail, |
||||
|
batch: detail.batch, |
||||
|
packingNumber: detail.packingNumber, |
||||
|
qty: detail.qty, |
||||
|
uom: detail.uom, |
||||
|
handleQty: 0, |
||||
|
Recommends: [], |
||||
|
Records: [], |
||||
|
} |
||||
|
|
||||
|
//推荐到了箱码和批次
|
||||
|
if (detail.packingNumber != "" && detail.packingNumber != null) { |
||||
|
batch.Recommends.push(detail); |
||||
|
} |
||||
|
return batch; |
||||
|
} |
||||
|
|
||||
|
export function createRecordInfo(detail) { |
||||
|
var record = {} |
||||
|
detail.scaned = true; |
||||
|
// let record = JSON.parse(JSON.stringify(detail));
|
||||
|
//克隆对象,深度克隆,防止双向绑定同一个变量
|
||||
|
Object.assign(record, detail) |
||||
|
record.toLocationCode = this.toLocationCode; |
||||
|
return record; |
||||
|
} |
Loading…
Reference in new issue