Browse Source

page/stockUp 文件迁移 8/8-10/25

hella_vue3
王志国 3 weeks ago
parent
commit
b8bdbac627
  1. 8
      src/pages/stockUp/coms/comScanStockUpPack.vue
  2. 475
      src/pages/stockUp/coms/comScanStockUpPackBatch.vue
  3. 6
      src/pages/stockUp/coms/comStockUpDetailCard.vue
  4. 129
      src/pages/stockUp/coms/comStockUpDetailCardBatch.vue
  5. 18
      src/pages/stockUp/job/stockUpJob.vue
  6. 10
      src/pages/stockUp/job/stockUpJobDetail.vue
  7. 408
      src/pages/stockUp/job/stockUpJobDetailBatch.vue

8
src/pages/stockUp/coms/comScanStockUpPack.vue

@ -136,8 +136,9 @@ const openScanPopup = (content, jobcontent) => {
jobContent.value = jobcontent jobContent.value = jobcontent
initData() initData()
positionInfo.value = `${jobContent.value.workShopCode}-${jobContent.value.subList[0].productionLineCode}-${jobContent.value.subList[0].workStationCode}` 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 closeScanPopup = () => { const closeScanPopup = () => {
@ -340,15 +341,14 @@ const addRecord = (batch, label, balance, packageInfo) => {
batch.Records.push(record) batch.Records.push(record)
issueRecord.value.unshift(record) issueRecord.value.unshift(record)
calcBatchHandleQty(batch) calcBatchHandleQty(batch)
getfocus()
} }
const getfocus = () => { const getfocus = () => {
if (!comscan.value) { if (comscan.value) {
comscan.value.getfocus() comscan.value.getfocus()
} }
} }
const losefocus = () => { const losefocus = () => {
if (comscan.value != undefined) { if (comscan.value) {
comscan.value.losefocus() comscan.value.losefocus()
} }
} }

475
src/pages/stockUp/coms/comScanStockUpPackBatch.vue

@ -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>

6
src/pages/stockUp/coms/comStockUpDetailCard.vue

@ -22,7 +22,7 @@
<view class="uni-flex u-m-t-10 u-m-b-10" v-if="batch.Records.length > 0"> <view class="uni-flex u-m-t-10 u-m-b-10" v-if="batch.Records.length > 0">
<view class="center" style="width: 20px; background-color: #0cc2b6; color: #fff; padding: 0px 2px; font-size: 24rpx; text-align: center"> 实际 </view> <view class="center" style="width: 20px; background-color: #0cc2b6; color: #fff; padding: 0px 2px; font-size: 24rpx; text-align: center"> 实际 </view>
<view class="uni-flex uni-column" style="flex: 1; width: 0px"> <view class="uni-flex uni-column" style="flex: 1; width: 0px">
<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%">
<handle-balance :detail="record" :isShowLocation="false" :isShowBatch="batch.packingNumber != null"> </handle-balance> <handle-balance :detail="record" :isShowLocation="false" :isShowBatch="batch.packingNumber != null"> </handle-balance>
</u-swipe-action> </u-swipe-action>
</view> </view>
@ -53,7 +53,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: {
@ -75,6 +75,7 @@ const collapse = ref()
const comMessageRef = ref() const comMessageRef = ref()
const dataContent = ref(props.dataContent) const dataContent = ref(props.dataContent)
const balanceQtyEditRef = ref() const balanceQtyEditRef = ref()
const removeOptions = ref([])
dataContent.value.Items.forEach((item) => { dataContent.value.Items.forEach((item) => {
item.Locations.forEach((cur) => { item.Locations.forEach((cur) => {
cur.Batchs.forEach((ele) => { cur.Batchs.forEach((ele) => {
@ -87,6 +88,7 @@ dataContent.value.Items.forEach((item) => {
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) => {

129
src/pages/stockUp/coms/comStockUpDetailCardBatch.vue

@ -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>

18
src/pages/stockUp/job/stockUpJob.vue

@ -23,7 +23,7 @@ import { getStockUpJobList, cancleTakeStockUpJob } from '@/api/request2.js'
import { goHome, updateTitle } from '@/common/basic.js' import { goHome, updateTitle } from '@/common/basic.js'
import { getDetailOption, getDetailGiveupOption } from '@/common/array.js' import { getDetailOption, getDetailGiveupOption } from '@/common/array.js'
import {getManagementPrecisions} from '@/common/balance.js';
import comEmptyView from '@/mycomponents/common/comEmptyView.vue' import comEmptyView from '@/mycomponents/common/comEmptyView.vue'
import jobFilter from '@/mycomponents/job/jobFilter.vue' import jobFilter from '@/mycomponents/job/jobFilter.vue'
import comStockUpJobCard from '@/pages/stockUp/coms/comStockUpJobCard.vue' import comStockUpJobCard from '@/pages/stockUp/coms/comStockUpJobCard.vue'
@ -47,6 +47,8 @@ const title = ref('')
const comMessageRef = ref() const comMessageRef = ref()
const jobInfoPopupRef = ref() const jobInfoPopupRef = ref()
const jobListPopupRef = ref() const jobListPopupRef = ref()
const managementType = ref('')
const managementList = ref([])
onShow(() => { onShow(() => {
nextTick(() => { nextTick(() => {
getList('refresh') getList('refresh')
@ -142,7 +144,19 @@ const getList = (type) => {
}) })
} }
const openJobDetail = (item) => { const openJobDetail = (item) => {
proxy.$tab.navigateTo(`./stockUpJobDetail?id=${item.masterId}&status=${item.status}`) getManagementPrecisions([item.itemCode], item.fromLocationCode, ret => {
if (ret.success) {
managementList.value = ret.list;
managementType.value = managementList.value.some(cur => cur.ManagementPrecision == 'BY_BATCH') ?
'BY_BATCH' : ''
this.managementType.value ='BY_BATCH'
if (managementType.value == 'BY_BATCH') {
proxy.$tab.navigateTo(`./stockUpJobDetailBatch?id=${item.masterId}&status=${item.status}&title=${title.value}`)
} else {
proxy.$tab.navigateTo(`./stockUpJobDetail?id=${item.masterId}&status=${item.status}&title=${title.value}`)
}
}
})
} }
const selectedItem = (item) => { const selectedItem = (item) => {
openJobDetail(item) openJobDetail(item)

10
src/pages/stockUp/job/stockUpJobDetail.vue

@ -13,7 +13,13 @@
<view class="page-main"> <view class="page-main">
<scroll-view scroll-y="true" class=""> <scroll-view scroll-y="true" class="">
<view v-for="(toLocation, index) in detailSource" :key="index"> <view v-for="(toLocation, index) in detailSource" :key="index">
<comStockUpDetailCard ref="comIssueDetailCardRef" :dataContent="toLocation" @updateData="updateData"> </comStockUpDetailCard> <comStockUpDetailCard
ref='comIssueDetailCard'
:dataContent="toLocation"
@updateData='updateData'
:settingParam="jobContent"
>
</comStockUpDetailCard>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
@ -223,7 +229,7 @@ const submitJob = () => {
.then((res) => { .then((res) => {
uni.hideLoading() uni.hideLoading()
if (res.data) { if (res.data) {
showCommitSuccessMessage(`提交成功<br>生成备货记录${res.data}`) showCommitSuccessMessage(`提交成功\n生成备货记录${res.data}`)
} else { } else {
showErrorMessage(`提交失败[${res.msg}]`) showErrorMessage(`提交失败[${res.msg}]`)
} }

408
src/pages/stockUp/job/stockUpJobDetailBatch.vue

@ -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…
Cancel
Save