出站优化:判断是否为末站点
This commit is contained in:
@@ -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({
|
||||
|
||||
@@ -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 = () => {
|
||||
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>
|
||||
|
||||
Reference in New Issue
Block a user