Browse Source

page/repleinsh/coms 文件迁移 8/8-10/25

hella_vue3
王志国 3 weeks ago
parent
commit
e15df659f0
  1. 4
      src/pages/repleinsh/coms/comRepleinshJobCard.vue
  2. 8
      src/pages/repleinsh/coms/comRepleishDetailCard.vue
  3. 126
      src/pages/repleinsh/coms/comRepleishDetailCardBatch.vue
  4. 115
      src/pages/repleinsh/coms/comScanReplishPack.vue
  5. 624
      src/pages/repleinsh/coms/comScanReplishPackBatch.vue

4
src/pages/repleinsh/coms/comRepleinshJobCard.vue

@ -1,13 +1,15 @@
<template> <template>
<job-com-main-card :dataContent="dataContent"> <job-com-main-card :dataContent="dataContent">
<jobComMainDetailCard :dataContent="dataContent"></jobComMainDetailCard> <jobComMainDetailCard :dataContent="dataContent"></jobComMainDetailCard>
<view class='split_line' v-show="dataContent.acceptUserName"></view>
<jobAccept :dataContent="dataContent" v-show="dataContent.acceptUserName"></jobAccept>
</job-com-main-card> </job-com-main-card>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import jobComMainCard from '@/mycomponents/job/jobComMainCard.vue' import jobComMainCard from '@/mycomponents/job/jobComMainCard.vue'
import jobComMainDetailCard from '@/mycomponents/job/jobComMainDetailCard.vue' import jobComMainDetailCard from '@/mycomponents/job/jobComMainDetailCard.vue'
import jobAccept from '@/mycomponents/job/jobAccept.vue'
const props = defineProps({ const props = defineProps({
dataContent: { dataContent: {
type: Object, type: Object,

8
src/pages/repleinsh/coms/comRepleishDetailCard.vue

@ -21,12 +21,12 @@
<view class="uni-flex" v-if="batch.Records.length > 0"> <view class="uni-flex" v-if="batch.Records.length > 0">
<view class="center" style="width: 20px; background-color: #0cc2b6; color: #fff; padding: 0px 2px"> 实际 </view> <view class="center" style="width: 20px; background-color: #0cc2b6; color: #fff; padding: 0px 2px"> 实际 </view>
<view class="uni-flex uni-column scan_view" style="flex: 1; padding: 10rpx 0rpx 16rpx"> <view class="uni-flex uni-column scan_view" style="flex: 1; padding: 10rpx 0rpx 16rpx">
<u-swipe-action :show="record.show" :index="key" v-for="(record, key) in batch.Records" :key="key" :options="scanOptions" bg-color="rgba(255,255,255,0)" @click="(...event) => swipeClick(event, batch, record)" style="width: 100%"> <u-swipe-action :show="record.show" :index="key" v-for="(record, key) in batch.Records" :key="key" :options="settingParam.allowModifyQty=='TRUE'?scanOptions:removeOptions" bg-color="rgba(255,255,255,0)" @click="(...event) => swipeClick(event, batch, record)" style="width: 100%">
<!-- <view class="card_view" v-if="record.parentPackingNumber"> <!-- <view class="card_view" v-if="record.parentPackingNumber">
<text class="card_packing_code card_content">外包装</text> <text class="card_packing_code card_content">外包装</text>
<text class="card_content">{{ record.parentPackingNumber }}</text> <text class="card_content">{{ record.parentPackingNumber }}</text>
</view> --> </view> -->
<handle-balance :detail="record" :isShowLocation="false" :isShowStatus='true'></handle-balance> <handle-balance :detail="record" :isShowLocation="false" :isShowStatus='true' :isShowBatch="batch.packingNumber!=null"></handle-balance>
<!-- <handle-balance :detail="record" :isShowLocation="false" :isShowBatch="batch.packingNumber != null" :isShowStatus="true"> </handle-balance>--> <!-- <handle-balance :detail="record" :isShowLocation="false" :isShowBatch="batch.packingNumber != null" :isShowStatus="true"> </handle-balance>-->
</u-swipe-action> </u-swipe-action>
</view> </view>
@ -56,7 +56,7 @@ import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue'
import location from '@/mycomponents/balance/location.vue' import location from '@/mycomponents/balance/location.vue'
import detailInfoPopup from '@/pages/productionReceipt/coms/detailInfoPopup.vue' import detailInfoPopup from '@/pages/productionReceipt/coms/detailInfoPopup.vue'
import { getDetailOption, getEditRemoveOption } from '@/common/array.js' import { getDetailOption, getEditRemoveOption,getRemoveOption } from '@/common/array.js'
const props = defineProps({ const props = defineProps({
dataContent: { dataContent: {
@ -79,12 +79,14 @@ const collapse = ref()
const balanceQtyEditRef = ref() const balanceQtyEditRef = ref()
const dataContent = ref(props.dataContent) const dataContent = ref(props.dataContent)
const detailInfoPopupRef = ref() const detailInfoPopupRef = ref()
const removeOptions = ref([])
// dataContent.value.subList.forEach((item) => { // dataContent.value.subList.forEach((item) => {
// item.show = false // item.show = false
// }) // })
onMounted(() => { onMounted(() => {
detailOptions.value = getDetailOption() detailOptions.value = getDetailOption()
scanOptions.value = getEditRemoveOption() scanOptions.value = getEditRemoveOption()
removeOptions.value = getRemoveOption()
}) })
const resizeCollapse = () => { const resizeCollapse = () => {
nextTick((r) => { nextTick((r) => {

126
src/pages/repleinsh/coms/comRepleishDetailCardBatch.vue

@ -0,0 +1,126 @@
<template>
<view>
<view v-for="(item,index) in dataContent.subList">
<u-swipe-action ref="swipeAction"
:class="item.scaned? 'scan_view':''"
:options="(item.scaned&&isEdit)?editAndRemoveOptions : item.scaned? removeOptions:options"
@click="(...event)=>swipeClick(event,item,index)">
<item-qty :dataContent="item" :handleQty="item.handleQty" :isShowBalanceQty="false"></item-qty>
<location :locationCode="item.fromLocationCode"></location>
<recommendBalanceBatch style='margin-left: 20px;' :detail="item" :isShowLocation="false"
:isShowPack="item.packingNumber"></recommendBalanceBatch>
</u-swipe-action>
</view>
</view>
<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 recommendBalanceBatch from '@/mycomponents/balance/recommendBalanceBatch.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 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, watch, onMounted} from 'vue';
const props = defineProps({
dataContent: {
type: Object,
default: () => ({})
},
settingParam: {
type: Object,
default: () => ({})
},
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 options = ref([]);
const removeOptions = ref([]);
const editAndRemoveOptions = ref([]);
const balanceQtyEdit = ref(null);
const receiptHint = ref(null);
const message = ref(null);
onMounted(() => {
removeOptions.value = getRemoveOption();
editAndRemoveOptions.value = getEditRemoveOption();
});
//
const resizeCollapse = () => {
// resizeCollapse
};
const swipeClick = (e, item, index) => {
if (e.content.text === "编辑") {
edit(item);
} else if (e.content.text === "移除") {
remove(item, index);
}
};
const edit = (item) => {
console.log(item);
editItem.value = item;
// that.batchItem = batch;
// record.balance.balanceQty = record.balance.qty;
balanceQtyEdit.value?.openEditPopup(item);
};
const detail = (item) => {
showItem.value = item;
receiptHint.value?.openScanPopup();
};
const remove = (item) => {
message.value?.showQuestionMessage("确定移除扫描信息?", (res) => {
if (res) {
item.handleQty = 0;
item.scaned = false;
// this.$emit('updateData', record)
}
});
};
const confirm = (val) => {
console.log(val);
editItem.value.handleQty = val;
emit('updateData', editItem.value);
// let qty = 0;
// this.batchItem.Records.forEach(r => {
// qty += Number(r.qty);
// })
// this.batchItem.handleQty = qty;
};
</script>
<style>
</style>

115
src/pages/repleinsh/coms/comScanReplishPack.vue

@ -17,7 +17,7 @@
<view class=""> <view class="">
<view class=""> <view class="">
<win-com-scan ref="comscan" placeholder="箱标签" @getResult="onScan" :clearResult="true" :isShowHistory="false"> </win-com-scan> <win-com-scan ref="comscan" placeholder="箱标签" @getResult="onScan" :clearResult="true" headerType="HPQ,HMQ" :isShowHistory="false"> </win-com-scan>
<view style="width: 100%"> <view style="width: 100%">
<view style="width: 100%" v-if="issueRecord.length > 0"> <view style="width: 100%" v-if="issueRecord.length > 0">
@ -107,9 +107,9 @@ const openScanPopup = (content, jobcontent) => {
dataContent.value = content dataContent.value = content
jobContent.value = jobcontent jobContent.value = jobcontent
initData() initData()
positionInfo.value = `${jobContent.value.workShopCode}-${jobContent.value.subList[0].productionLineCode}-${jobContent.value.subList[0].workStationCode}`
setTimeout((res) => {
show.value = true show.value = true
setTimeout((res) => {
getfocus()
}, 500) }, 500)
} }
const openScanPopupForJobSimulate = (content, jobcontent, scanMessage) => { const openScanPopupForJobSimulate = (content, jobcontent, scanMessage) => {
@ -174,7 +174,9 @@ const fromLocationUpdate = (fromlocation) => {
const location = fromLocationList.value.find((r) => r == fromlocation) const location = fromLocationList.value.find((r) => r == fromlocation)
if (location == undefined) { if (location == undefined) {
fromLocationCode.value = '' fromLocationCode.value = ''
showErrorMessage(`发料库位【${fromlocation}】不存在`) showErrorMessage(`发料库位【${fromlocation}】不存在`,()=>{
getfocus()
})
} }
} }
const onScan = (result)=> { const onScan = (result)=> {
@ -189,7 +191,9 @@ const onScan = (result)=> {
if (toLocation.value && result.package.packUnit) { if (toLocation.value && result.package.packUnit) {
let item = toLocation.value.Items.find(r => r.itemCode == result.package.itemCode); let item = toLocation.value.Items.find(r => r.itemCode == result.package.itemCode);
if (!item) { if (!item) {
showErrorMessage('扫描物料代码不属于该任务'); showErrorMessage('扫描物料代码不属于该任务',()=>{
getfocus()
});
return return
} }
if (result.package.packUnit !== item.packUnit) { if (result.package.packUnit !== item.packUnit) {
@ -202,6 +206,8 @@ const onScan = (result)=> {
} else { } else {
getToLocationBalance(result) getToLocationBalance(result)
} }
}else{
getToLocationBalance(result)
} }
} }
// //
@ -252,14 +258,18 @@ const getToLocationBalance = (result)=> {
getBalanceByFilter(params).then(res => { getBalanceByFilter(params).then(res => {
uni.hideLoading() uni.hideLoading()
if (res.data.list.length > 0) { if (res.data.list.length > 0) {
showErrorMessage("包装在库位【" + res.data.list[0].locationCode + "】已有库存余额"); showErrorMessage("包装在库位【" + res.data.list[0].locationCode + "】已有库存余额",()=>{
getfocus()
});
} else { } else {
queryBalance(result); queryBalance(result);
} }
// callback(res.data) // callback(res.data)
}).catch(err => { }).catch(err => {
uni.hideLoading() uni.hideLoading()
showErrorMessage(err.message); showErrorMessage(err.message,()=>{
getfocus()
});
}) })
} }
const queryBalance = (result) => { const queryBalance = (result) => {
@ -301,13 +311,15 @@ const queryBalance = (result) => {
let status = getInventoryStatusDesc(params.inventoryStatus) let status = getInventoryStatusDesc(params.inventoryStatus)
let areaType = getListLocationAreaTypeDesc(params.areaType) let areaType = getListLocationAreaTypeDesc(params.areaType)
let hint = let hint =
"按物料号 [" + params.itemCode + "] <br>" + "按物料号 [" + params.itemCode + "] \n" +
"包装号 [" + params.packingNumber + "] <br>" + "包装号 [" + params.packingNumber + "] \n" +
"批次 [" + params.batch + "] <br>" + "批次 [" + params.batch + "] \n" +
"状态 [" + status + "] <br>" + "状态 [" + status + "] \n" +
"库区 [" + areaType + "] <br>" + "库区 [" + areaType + "] \n" +
"未查找到库存余额" "未查找到库存余额"
showErrorMessage(hint) showErrorMessage(hint,()=>{
getfocus()
})
} else if (res.data.length == 1) { } else if (res.data.length == 1) {
result.balance = res.data[0] result.balance = res.data[0]
@ -324,7 +336,9 @@ const queryBalance = (result) => {
uni.hideLoading() uni.hideLoading()
}).catch(error => { }).catch(error => {
uni.hideLoading() uni.hideLoading()
showErrorMessage(error) showErrorMessage(error,()=>{
getfocus()
})
}) })
// getBalance(result.label, packageInfoParams, (balances) => { // getBalance(result.label, packageInfoParams, (balances) => {
// packageInfo.value = packageInfoParams // packageInfo.value = packageInfoParams
@ -386,7 +400,9 @@ const queryBalance = (result) => {
// uni.hideLoading() // uni.hideLoading()
// }) // })
} catch (e) { } catch (e) {
showErrorMessage(e.stack) showErrorMessage(e.stack,()=>{
getfocus()
})
uni.hideLoading() uni.hideLoading()
} }
} }
@ -445,7 +461,7 @@ const queryBalance = (result) => {
// } // }
const selectBalanceItem = (balanceParams) => { const selectBalanceItem = (balanceParams) => {
afterGetBalance(label.value, balanceParams, packageInfo.value) afterGetBalance(balanceParams, balanceParams, packageInfo.value)
} }
const afterGetBalance = (labelParams, balanceParams, packageInfo) => { const afterGetBalance = (labelParams, balanceParams, packageInfo) => {
@ -457,7 +473,7 @@ const afterGetBalance = (labelParams, balanceParams, packageInfo) => {
fromLocationCode.value = balanceParams.locationCode; fromLocationCode.value = balanceParams.locationCode;
const fromLocation = item.Locations.find((l) => l.fromLocationCode == fromLocationCode.value) const fromLocation = item.Locations.find((l) => l.fromLocationCode == fromLocationCode.value)
// //
if (fromLocation != undefined) { if (fromLocation) {
const batch = fromLocation.Batchs.find((r) => r.batch == lot) const batch = fromLocation.Batchs.find((r) => r.batch == lot)
if (batch != undefined) { if (batch != undefined) {
if (batch.Records == undefined) { if (batch.Records == undefined) {
@ -497,6 +513,7 @@ const afterGetBalance = (labelParams, balanceParams, packageInfo) => {
batch.detail = fromLocation.Batchs[0].detail batch.detail = fromLocation.Batchs[0].detail
} }
fromLocation.Batchs.unshift(batch) fromLocation.Batchs.unshift(batch)
getfocus()
} }
}) })
} else { } else {
@ -505,11 +522,21 @@ const afterGetBalance = (labelParams, balanceParams, packageInfo) => {
}) })
} }
} else { } else {
let locaion = createLocationInfo(labelParams, balanceParams, packageInfo); if (jobContent.value.allowModifyLocation == "TRUE") {
this.showQuestionMessage("扫描物料[" + itemCode + "]的库位【" + fromLocationCode.value +
"】与推荐的库位不一致,是否要继续发料?", res => {
if (res) {
let locaion = createLocationInfo(label, balance, packageInfo);
item.Locations.push(locaion); item.Locations.push(locaion);
// showErrorMessage(`${fromLocationCode.value}`, (res) => { getfocus();
// getfocus() emit("afterScan");
// }) }
})
} else {
showErrorMessage("扫描物料[" + itemCode + "]的库位【" + fromLocationCode.value +
"】与推荐的库位不一致,不允许继续发料?")
}
} }
} catch (e) { } catch (e) {
showErrorMessage(e.stack, (res) => { showErrorMessage(e.stack, (res) => {
@ -524,6 +551,7 @@ const createLocationInfo = (labelParams, balanceParams, packageInfo)=> {
qty: balanceParams.qty, qty: balanceParams.qty,
uom: balanceParams.uom, uom: balanceParams.uom,
handleQty: 0, handleQty: 0,
isNewAdd: true,
Batchs: [] Batchs: []
} }
let batch = createBatchInfo(labelParams, balanceParams, packageInfo); let batch = createBatchInfo(labelParams, balanceParams, packageInfo);
@ -537,6 +565,7 @@ const createBatchInfo = (labelParams, balanceParams, packageInfo) => {
batch: labelParams.batch, batch: labelParams.batch,
qty: 0, qty: 0,
uom: labelParams.uom, uom: labelParams.uom,
handleQty: Number(balanceParams.qty),
Records: [] Records: []
} }
let record = {} let record = {}
@ -625,13 +654,53 @@ const addRecord = (batch, labelParams, balanceParams, packageInfo) => {
console.log(8888) console.log(8888)
record = creatRecordByBalance(balanceParams, packageInfo) record = creatRecordByBalance(balanceParams, packageInfo)
} }
if (packageInfo.parentNumber) {
let checkData = batch.Records.find(r => {
if (r.packingNumber == packageInfo.parentNumber &&
r.batch == packageInfo.batch) {
return r;
}
})
if (checkData) {
//
showErrorMessage("箱码[" + packageInfo.number + "]批次[" + packageInfo.batch +
"]的父包装已经扫描")
} else {
batch.Records.push(record) batch.Records.push(record)
console.log(34989, record)
issueRecord.value.unshift(record) issueRecord.value.unshift(record)
calcBatchHandleQty(batch) calcBatchHandleQty(batch)
getfocus() getfocus()
} }
} else {
//
let checkData = batch.Records.find(r => {
if (r.parentPackingNumber == packageInfo.number &&
r.batch == packageInfo.batch) {
return r;
}
})
if (checkData) {
//
comMessageRef.value.showQuestionMessage("扫描箱码[" + checkData.parentPackingNumber + "]" + "批次[" +
packageInfo
.batch + "]是父包装,是否移除子包装", res => {
if (res) {
batch.Records = []
batch.Records.push(record);
issueRecord.value.unshift(record)
calcBatchHandleQty(batch);
getfocus();
}
})
console.log("扫描的是父包装,是否移除子包装")
} else {
batch.Records.push(record);
issueRecord.value.unshift(record)
calcBatchHandleQty(batch);
getfocus();
}
}
}
const getfocus = () => { const getfocus = () => {
if (comscan.value != undefined) { if (comscan.value != undefined) {

624
src/pages/repleinsh/coms/comScanReplishPackBatch.vue

@ -0,0 +1,624 @@
<template>
<view>
<u-popup v-model="show" mode="bottom" :maskClick='false'>
<view class="">
<view class="popup_box">
<view class="pop_title">
扫描箱码
<text class="fr" @click="closeScanPopup()">关闭</text>
</view>
<!-- <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="comscan" placeholder="箱标签" @getResult="onScan" :clearResult="true"
headerType="HPQ,HMQ" :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%;">
<uni-swipe-action ref="swipeAction">
<uni-swipe-action-item @click="swipeClick($event,record,index)"
:right-options="scanOptions">
<view style="padding: 0px 10px">
<balance :dataContent="record" :isShowFromLocation="false"
:isShowStatus='true' :isShowStdPack="false"></balance>
</view>
</uni-swipe-action-item>
</uni-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 {
getWorkShopLineStation,
getBalanceByFilter,
getBalanceByParams,
} from '@/api/request2.js';
import {
calc
} from '@/common/calc.js';
import {
uniqueArray
} from '@/common/basic.js';
import {
getBalanceByManagementPrecision
} from '@/common/balance.js';
import {
getDirectoryItemArray,getInventoryStatusDesc,getListLocationAreaTypeDesc
} from '@/common/directory.js';
import {
getLabelInfo
} from '@/common/label.js';
import {ref, onMounted} from 'vue';
const props = defineProps({
title: {
type: String,
default: ''
}
})
const emit = defineEmits(['closeScan','updateData','afterScan',])
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 positionList = ref([]);
const defaultValueList = ref([]);
const label = ref({});
const fromInventoryStatuses = ref("");
const packageInfo = ref({});
const toLocationAreaTypeList = ref([]);
const headerType = ref('')
const showItem = ref({})
const balanceSelect = ref(null);
const comscan = ref(null);
const receiptHint = ref(null);
const comMessage = ref(null);
const detailOptions = ref(null)
onMounted(() => {
detailOptions.value = getDetailOption();
scanOptions.value = getDetailEditRemoveOption();
});
//
const openScanPopup = (content, jobcontent) => {
issueRecord.value = [];
dataContent.value = content;
jobContent.value = jobcontent;
initData();
show.value = true;
setTimeout(() => {
getfocus();
}, 500);
};
const openScanPopupForJobSimulate = (content, jobcontent, scanMessage) => {
issueRecord.value = [];
dataContent.value = content;
jobContent.value = jobcontent;
initData();
getLabelInfo(scanMessage, headerType.value, (callback) => {
if (callback.success) {
onScan(callback);
} else {
showErrorMessage(callback.message);
}
});
};
const closeScanPopup = () => {
losefocus();
show.value = false
emit("closeScan");
};
const initData = () => {
fromLocationList.value = [];
if (dataContent.value != null) {
fromInventoryStatuses.value = jobContent.value.outInventoryStatuses;
toLocation.value = dataContent.value.subList;
toLocationCode.value = dataContent.value.subList[0].toLocationCode;
toLocationAreaTypeList.value = getDirectoryItemArray(jobContent.value.toAreaTypes);
}
};
const showBalanceSelect = (items) => {
balanceSelect.value.openPopup(items);
};
const fromLocationUpdate = (fromlocation) => {
const location = fromLocationList.value.find(r => r === fromlocation);
if (location === undefined) {
fromLocationCode.value = '';
showErrorMessage(`发料库位【${fromlocation}】不存在`, () => {
getfocus();
});
}
};
const onScan = (result) => {
console.log(11, result);
if (!result.package) {
showErrorMessage(`扫描数据错误[${result.label.code}]`, () => {
getfocus();
});
return;
}
if (toLocation.value && result.package.packUnit) {
const item = toLocation.value.find(r => r.itemCode === result.package.itemCode);
if (!item) {
showErrorMessage('扫描物料代码不属于该任务', () => {
getfocus();
});
return;
}
if (result.package.packUnit !== item.packUnit) {
getToLocationBalance(result);
} else {
getToLocationBalance(result);
}
} else {
getToLocationBalance(result);
}
};
const getToLocationBalance = (result) => {
uni.showLoading({
title: '查询中',
mask: true
});
const filters = [];
if (result.package.parentNumber) {
const packingNumber = `${result.package.parentNumber},${result.package.number}`;
filters.push({
column: "packingNumber",
action: "in",
value: packingNumber
});
} else {
filters.push({
column: "packingNumber",
action: "==",
value: result.package.number
});
}
filters.push({
column: "itemCode",
action: "==",
value: result.package.itemCode
});
filters.push({
column: "batch",
action: "==",
value: result.package.batch
});
filters.push({
column: "areaType",
action: "in",
value: toLocationAreaTypeList.value.join(',')
});
const params = {
filters: filters,
pageNo: 1,
pageSize: 100,
};
getBalanceByFilter(params).then(res => {
uni.hideLoading();
queryBalance(result);
}).catch(err => {
uni.hideLoading();
showErrorMessage(err.message, () => {
getfocus();
});
});
};
const queryBalance = (result) => {
try {
const packageInfo = 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 {
item.scaned = true;
const params = {
itemCode: result.package.itemCode,
batch: result.label.batch,
packingNumber: result.label.packingNumber,
parentPackingNumber: result.package.parentNumber,
inventoryStatus: jobContent.value.outInventoryStatuses.split(','),
areaType: jobContent.value.fromAreaTypes.split(','),
bussinessCode: jobContent.value.businessType
};
uni.showLoading({
title: '查询中',
mask: true
});
getBalanceByParams(params).then(res => {
if (res.data.length === 0) {
const status = getInventoryStatusDesc(params.inventoryStatus);
const areaType = getListLocationAreaTypeDesc(params.areaType);
const hint = `按物料号 [${params.itemCode}] \n` +
`包装号 [${params.packingNumber}] \n` +
`批次 [${params.batch}] \n` +
`状态 [${status}] \n` +
`库区 [${areaType}] \n` +
`未查找到库存余额`;
showErrorMessage(hint, () => {
getfocus();
});
} else if (res.data.length === 1) {
result.balance = res.data[0];
if (result.label.packingNumber !== result.balance.packingNumber) {
result.balance.qty = Number(result.label.qty);
} else {
result.balance.qty = Number(result.balance.qty);
}
afterGetBalance(result.label, result.balance, result.package);
} else {
//
balanceSelect.value.openPopup(res.data);
}
uni.hideLoading();
}).catch(error => {
uni.hideLoading();
showErrorMessage(error, () => {
getfocus();
});
});
}
} catch (e) {
uni.hideLoading();
showErrorMessage(e.stack, () => {
getfocus();
});
}
};
const selectBalanceItem = (balance) => {
afterGetBalance(balance, balance, packageInfo.value);
};
const afterGetBalance = (label, balance, packageInfo) => {
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;
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) {
const batch = createBatchInfo(label, balance, packageInfo);
if (fromLocation.Batchs.length > 0) {
batch.detail = fromLocation.Batchs[0].detail;
}
fromLocation.Batchs.unshift(batch);
getfocus();
}
});
} else {
showErrorMessage(`未查找到批次【${lot}】的发料明细`, () => {
getfocus();
});
}
}
} else {
if (jobContent.value.allowModifyLocation === "TRUE") {
showQuestionMessage(`扫描物料[${itemCode}]的库位【${fromLocationCode.value}】与推荐的库位不一致,是否要继续发料?`, (res) => {
if (res) {
const locaion = createLocationInfo(label, balance, packageInfo);
item.Locations.push(locaion);
getfocus();
emit("afterScan");
}
});
} else {
showErrorMessage(`扫描物料[${itemCode}]的库位【${fromLocationCode.value}】与推荐的库位不一致,不允许继续发料?`);
}
}
} catch (e) {
showErrorMessage(e.stack, () => {
getfocus();
});
}
};
const createLocationInfo = (label, balance, packageInfo) => {
const location = {
fromLocationCode: balance.locationCode,
qty: balance.qty,
uom: balance.uom,
handleQty: 0,
isNewAdd: true,
Batchs: []
};
const batch = createBatchInfo(label, balance, packageInfo);
batch.detail = balance;
batch.detail.fromLocationCode = balance.locationCode;
location.Batchs.push(batch);
return location;
};
const createBatchInfo = (label, balance, packageInfo) => {
const batch = {
batch: label.batch,
qty: 0,
uom: label.uom,
handleQty: Number(balance.qty),
Records: []
};
let record = {};
if (balance !== null) {
record = creatRecordByBalance(balance, packageInfo);
batch.handleQty = Number(label.qty);
} else {
record = creatRecordByLabel(label, packageInfo);
batch.handleQty = Number(balance.qty);
}
batch.Records.push(record);
issueRecord.value.unshift(record);
return batch;
};
const creatRecordByLabel = (label, packageInfo) => {
const record = {
scaned: true,
itemCode: label.itemCode,
packingNumber: label.packingNumber,
parentPackingNumber: packageInfo.parentNumber,
batch: label.batch,
qty: Number(label.qty),
uom: label.uom,
inventoryStatus: "OK",
balance: null,
toLocationCode: toLocationCode.value,
supplierCode: label.supplierCode,
packUnit: packageInfo.packUnit,
packQty: packageInfo.packQty,
};
return record;
};
const creatRecordByBalance = (balance, packageInfo) => {
balance.packQty = packageInfo.packQty;
balance.packUnit = packageInfo.packUnit;
const record = {
scaned: true,
itemCode: balance.itemCode,
packingNumber: packageInfo.number,
parentPackingNumber: packageInfo.parentNumber,
batch: packageInfo.batch,
qty: Number(balance.qty),
uom: balance.uom,
inventoryStatus: balance.inventoryStatus,
balance: balance,
toLocationCode: toLocationCode.value,
supplierCode: balance.supplierCode
};
return record;
};
const calcBatchHandleQty = (balance) => {
dataContent.value.subList.forEach(item => {
if (item.itemCode === balance.itemCode) {
item.handleQty = balance.qty;
}
});
};
const addRecord = (batch, label, balance, packageInfo) => {
let record = {};
if (balance == null) {
record = creatRecordByLabel(label, packageInfo);
} else {
record = creatRecordByBalance(balance, packageInfo);
}
if (packageInfo.parentNumber) {
let checkData = batch.Records.find(r => {
if (r.packingNumber === packageInfo.parentNumber && r.batch === packageInfo.batch) {
return r;
}
});
if (checkData) {
//
showErrorMessage(`箱码[${packageInfo.number}]批次[${packageInfo.batch}]的父包装已经扫描`);
} else {
calcBatchHandleQty(balance);
getfocus();
}
} else {
calcBatchHandleQty(balance);
getfocus();
}
};
const getfocus = () => {
if (comscan.value) {
comscan.value.getfocus();
}
};
const losefocus = () => {
if (comscan.value) {
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 = (item, index) => {
showQuestionMessage("确定移除扫描信息?", (res) => {
if (res) {
item.handleQty = 0;
item.scaned = false;
emit('updateData', item);
}
});
};
const packGetFocus = () => {
if (comscan.value) {
comscan.value.getfocus();
}
};
const packLoseFocus = () => {
if (comscan.value) {
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>
Loading…
Cancel
Save