diff --git a/src/api/inbound.js b/src/api/inbound.js index e80d8d3b0e17a7aabdb74ab311598df4a05afd7f..21b12e806e0384dd34e65a7cc888991b7dde76fa 100644 --- a/src/api/inbound.js +++ b/src/api/inbound.js @@ -1,6 +1,8 @@ import axios from "axios"; -const API_BASE_URL = "http://192.168.43.128:8000"; +//const API_BASE_URL = "http://192.168.43.128:8000"; +const API_BASE_URL = "http://192.168.136.86:8000"; +//const API_BASE_URL = "http://localhost:8000"; //const API_BASE_URL = "https://e1797793-87d4-4690-b69a-a91ae37d8a0e.mock.pstmn.io"; export const getInboundList = () => { @@ -12,15 +14,23 @@ export const getSupplierNames = () => { }; export const deleteInboundItem = (id) => { - return axios.delete(`${API_BASE_URL}/wmsInbound/deleteInboundById`, { - data: { id }, - }); + return axios.delete(`${API_BASE_URL}/wmsInbound/deleteInboundById?id=${id}`); }; export const getInboundItemInfo = (id) => { return axios.post(`${API_BASE_URL}/wmsInboundDetail/inboundItemsInfo`, { id, }); }; +export const fetchPartsByid = (id) => { + return axios.post(`${API_BASE_URL}/wmsInboundDetail/inboundItemsInfo`, { + id, + }); +}; +export const saveform2 = (singleDetail) => { + return axios.post( + `${API_BASE_URL}/wmsInboundDetail/addRealQuantity?ibdId=${singleDetail.id}&quantity=${singleDetail.realQuantity}` + ); +}; export const saveOrUpdateItem = async (item) => { try { diff --git a/src/api/outbound.js b/src/api/outbound.js index 7f1dc44d5f3c78f979805a1bcc23978f535f3766..cca006f562ba022f0858fc9ae2215f7ad0309cd9 100644 --- a/src/api/outbound.js +++ b/src/api/outbound.js @@ -1,21 +1,35 @@ import axios from "axios"; -const API_BASE_URL = "http://192.168.43.128:8000"; +//const API_BASE_URL = "http://localhost:8000"; +//const API_BASE_URL = "http://192.168.43.128:8000"; +const API_BASE_URL = "http://192.168.136.86:8000"; //const API_BASE_URL ="https://e1797793-87d4-4690-b69a-a91ae37d8a0e.mock.pstmn.io"; export const getOutboundList = () => { return axios.get(`${API_BASE_URL}/wmsOutbound/getOutbound`); }; -export const getclientNames = () => { - return axios.get(`${API_BASE_URL}/wmsclient/getclientName`); -}; +// export const getclientNames = () => { +// return axios.get(`${API_BASE_URL}/wmsclient/getclientName`); +// }; export const deleteOutboundItem = (id) => { - return axios.delete(`${API_BASE_URL}/wmsOutbound/deleteOutboundById`, { - data: { id }, + return axios.delete( + `${API_BASE_URL}/wmsOutbound/deleteOutboundById?id=${id}` + ); +}; + +export const fetchPartsByid = (id) => { + return axios.post(`${API_BASE_URL}/wmsOutboundDetail/outboundItemsInfo`, { + id, }); }; +export const saveform2 = (singleDetail) => { + return axios.post( + `${API_BASE_URL}/wmsOutboundDetail/addRealQuantity?obdId=${singleDetail.id}&quantity=${singleDetail.realQuantity}` + ); +}; + export const getOutboundItemOutfo = (id) => { return axios.post(`${API_BASE_URL}/wmsOutboundDetail/outboundItemsInfo`, { id, @@ -34,41 +48,51 @@ export const saveOrUpdateItem = async (item) => { }; export const fetchItems = async () => { - try { - const response = await axios.get(`${API_BASE_URL}/wmsItem`); - return response.data; - } catch (error) { - console.error("Error fetching items:", error); - throw error; // 重新抛出错误,以便调用方处理 - } + try { + const response = await axios.get(`${API_BASE_URL}/wmsItem`); + return response.data; + } catch (error) { + console.error("Error fetching items:", error); + throw error; // 重新抛出错误,以便调用方处理 + } }; export const fetchItemById = async (id) => { - try { - const response = await axios.get(`${API_BASE_URL}/wmsItem/${id}`); - return response.data; - } catch (error) { - console.error("Error fetching item by ID:", error); - throw error; // 重新抛出错误,以便调用方处理 - } + try { + const response = await axios.get(`${API_BASE_URL}/wmsItem/${id}`); + return response.data; + } catch (error) { + console.error("Error fetching item by ID:", error); + throw error; // 重新抛出错误,以便调用方处理 + } }; export const getItemsBySupplier = async (supplierId) => { - try { - const response = await axios.get( - `${API_BASE_URL}/wmsItem/itemsBySupplier?supplierId=${supplierId}` - ); - return response.data; - } catch (error) { - console.error("Error fetching item by ID:", error); - throw error; // 重新抛出错误,以便调用方处理 - } + try { + const response = await axios.get( + `${API_BASE_URL}/wmsItem/itemsBySupplier?supplierId=${supplierId}` + ); + return response.data; + } catch (error) { + console.error("Error fetching item by ID:", error); + throw error; // 重新抛出错误,以便调用方处理 + } +}; +// 此处获取的是物料编号不重复的所有items +export const getItems = async () => { + try { + const response = await axios.get(`${API_BASE_URL}/wmsItem/getItems`); + return response.data; + } catch (error) { + console.error("Error fetching item by ID:", error); + throw error; // 重新抛出错误,以便调用方处理 + } }; export const getBox1 = async (formData) => { try { console.log("SavOutg form data:", formData); const response = await axios.get( - `${API_BASE_URL}/wmsContaOuter/contaOuterCount`, + `${API_BASE_URL}/wmsContainer/containerCount`, { params: formData, } @@ -107,20 +131,23 @@ export const getclientIdByName1 = async (clientName) => { }; export const getSupplierIdByName = async (supplierName) => { - try { - const response = await axios.get( - `${API_BASE_URL}/wmsSupplier/idByName?supplierName=${supplierName}` - ); - return response.data; - } catch (error) { - console.error("Error fetching supplier ID by name:", error); - throw error; - } + try { + const response = await axios.get( + `${API_BASE_URL}/wmsSupplier/idByName?supplierName=${supplierName}` + ); + return response.data; + } catch (error) { + console.error("Error fetching supplier ID by name:", error); + throw error; + } }; export const saveForm1 = async (formData) => { try { - const response = await axios.post(`${API_BASE_URL}/Outbound`, formData); + const response = await axios.post( + `${API_BASE_URL}/wmsOutbound/outbound`, + formData + ); return response.data; } catch (error) { console.error("Error Out save", error); diff --git a/src/utils/useTabs.js b/src/utils/useTabs.js index afad283b30026af34e6dd8de30c474e21635520b..e57d4f7321e3ff56ef13f6265f7e7759cfe3ea9f 100644 --- a/src/utils/useTabs.js +++ b/src/utils/useTabs.js @@ -44,7 +44,9 @@ const useTabs = () => { tabs.value.push({ name: path, label }); } activeTab.value = path; - router.push(path); + router.push(path).catch((err) => { + console.error("导航错误:", err); + }); console.log("增加标签"); }; diff --git a/src/views/receiptorder/InWarehouse.vue b/src/views/receiptorder/InWarehouse.vue index 665ba54d23f55e64d2f5340e97beabcc01ee7c76..fb88ad2546bc0360815eb9b731833a7f661860fb 100644 --- a/src/views/receiptorder/InWarehouse.vue +++ b/src/views/receiptorder/InWarehouse.vue @@ -3,7 +3,8 @@ @@ -18,6 +19,7 @@ import { ref, onMounted } from 'vue'; import { useRoute } from 'vue-router'; import axios from 'axios'; +import { fetchPartsByid, saveform2 } from '@/api/inbound.js' export default { setup() { @@ -26,7 +28,7 @@ export default { const fetchPartsById = async (inboundID) => { try { - const response = await axios.post('http://192.168.43.128:8000/wmsInboundDetail/inboundItemsInfo', { id: inboundID }); + const response = await fetchPartsByid(inboundID) parts.value = response.data; console.log('Response from server:', response.data); } catch (error) { @@ -38,7 +40,7 @@ export default { const saveForm2 = async () => { for (const singleDetail of parts.value) { try { - const response = await axios.post(`http://192.168.43.128:8000/wmsInboundDetail/addRealQuantity?ibdId=${singleDetail.id}&quantity=${singleDetail.realQuantity}`); + const response = await saveform2(singleDetail) console.log(`Data saved successfully for id ${singleDetail.id}`); // 可以在保存成功后进行一些反馈或页面跳转 } catch (error) { diff --git a/src/views/receiptorder/IndexView.vue b/src/views/receiptorder/IndexView.vue index 08703434eea4d65e0a2fa2cc5418082947346aa3..51e48e5b873c3195fbbd097b4c3186f3f38b8fc7 100644 --- a/src/views/receiptorder/IndexView.vue +++ b/src/views/receiptorder/IndexView.vue @@ -4,11 +4,10 @@ - - - + + + - @@ -66,14 +65,14 @@ - + - - + diff --git a/src/views/receiptorder/WarehouseEntry.vue b/src/views/receiptorder/WarehouseEntry.vue index 6f3b76fc4fd09526fb15cbb0ebd9d80d062d51af..804b0aee784069e8d6069302dd55f56f6080838d 100644 --- a/src/views/receiptorder/WarehouseEntry.vue +++ b/src/views/receiptorder/WarehouseEntry.vue @@ -48,12 +48,18 @@ import { ref, onMounted } from 'vue'; import { getBox, getNames, getSupplierIdByName, saveForm } from '@/api/inbound.js'; import ItemList from './ItemList.vue'; +import { useRouter, useRoute } from 'vue-router'; +import { ElMessageBox, ElMessage } from 'element-plus' +import useTabs from '@/utils/useTabs'; +const { addTab, removeTab } = useTabs(); export default { components: { ItemList }, setup() { + const router = useRouter(); + const route = useRoute(); const generateEntryNumber = () => { const date = new Date(); const year = date.getFullYear(); @@ -172,14 +178,31 @@ export default { // 调用后端保存数据的函数 const response = await saveForm(postData); console.log('Form data saved:', response); + ElMessage({ + type: 'success', + message: '保存成功!', + }); + //addTab('/receiptorder', '入库单'); + console.log("删除路由名字", route.path) + removeTab(route.path); + //addTab('/receiptorder', '入库单'); + router.replace('/receiptorder').catch(err => { + console.error('导航到 /receiptorder 失败:', err) + }); } catch (error) { console.error('Error saving form data:', error); + ElMessage({ + type: 'error', + message: '保存失败!', + }); } + }; const cancelForm = () => { console.log('Cancelled'); + }; onMounted(() => { diff --git a/src/views/shipmentorder/IndexView.vue b/src/views/shipmentorder/IndexView.vue index fb019b2a346c88c092dc075f8210b3659c1029a1..74af7bbd49f7be6b2d0db3707dd2df9655fd4d01 100644 --- a/src/views/shipmentorder/IndexView.vue +++ b/src/views/shipmentorder/IndexView.vue @@ -4,22 +4,13 @@ - - - + + + - - - - - - - - - @@ -29,8 +20,9 @@ - + 华南理工大学 + 中山大学 + 华南师范大学 @@ -68,8 +60,8 @@ @@ -84,16 +76,17 @@ - + - - + diff --git a/src/views/shipmentorder/OutItemList.vue b/src/views/shipmentorder/OutItemList.vue index eeb0cdde7dff82eb226db39b8a1ff78bf014c2cf..42c429c32a53966c00a4ff04f76aadbd4b4fbf09 100644 --- a/src/views/shipmentorder/OutItemList.vue +++ b/src/views/shipmentorder/OutItemList.vue @@ -13,12 +13,12 @@ - + 零件名: @@ -39,7 +39,7 @@ - +