出站优化:判断是否为末站点

This commit is contained in:
tao
2026-01-14 09:21:15 +08:00
parent 1728ed1b3a
commit 09b921009e
2 changed files with 25 additions and 7 deletions

View File

@@ -28,6 +28,14 @@ export function getStation(id: ID) {
});
}
// 判断站点是否为最后一个站点
export function isLastStation(id: ID) {
return request({
url: '/mes/station/' + id + '/isLast',
method: 'get'
})
}
// 新增站点
export function addStation(data: MesStationData) {
return request({

View File

@@ -3,7 +3,7 @@ import { ref, computed, reactive } from 'vue';
import { useRouter, useRoute } from 'vue-router';
import { message } from 'ant-design-vue';
import { listStorageLocation } from '@/api/traceOrderManage/location';
import { completeStation } from '@/api/traceOrderManage/station';
import { completeStation, isLastStation as getIsLastStation } from '@/api/traceOrderManage/station';
import { useTraceOrderStore } from '@/store';
const router = useRouter();
@@ -34,9 +34,15 @@ const fetchLocationList = async () => {
};
const openSelectLocation = ref(false);
const handleSelectLocation = () => {
fetchLocationList();
openSelectLocation.value = true;
const handleOutfeed = async () => {
// 判断是否为末站点
const { data: isLastStation } = await getIsLastStation(traceOrderStore.currentStationId);
if (isLastStation || outfeedChildRef.value?.totals.ngNum) {
fetchLocationList();
openSelectLocation.value = true;
} else {
submitOutfeed();
}
};
const storage = reactive({});
@@ -44,9 +50,13 @@ const handleChangeLocation = (value: any, option: any) => {
Object.assign(storage, option);
};
const closeOutfeed = () => {
openSelectLocation.value = false;
};
// 确认出站
const outfeeding = ref(false);
const handleOutfeed = async () => {
const submitOutfeed = async () => {
outfeeding.value = true;
try {
await completeStation(traceOrderStore.currentStationId, storage);
@@ -95,12 +105,12 @@ fetchLocationList();
:stroke-color="activeKey === item.key ? '#1890ff' : undefined" class="menu-progress" />
</div>
</div>
<a-button type="primary" size="large" @click="handleSelectLocation">确认出站</a-button>
<a-button type="primary" size="large" @click="handleOutfeed">确认出站</a-button>
</div>
</a-col>
</a-row>
<a-modal title="选择出站库位" :open="openSelectLocation" @ok="handleOutfeed" >
<a-modal title="选择出站库位" :open="openSelectLocation" @ok="submitOutfeed" @cancel="closeOutfeed">
<a-select style="width: 100%" @change="handleChangeLocation" :options="locationOptions" :fieldNames="{ label: 'storageLocationCode', value: 'id' }" />
</a-modal>
</a-spin>