-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
709 additions
and
247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,22 @@ | ||
// porderAxios.js | ||
|
||
import axios from 'axios'; | ||
import axios from "axios"; | ||
|
||
//발주리스트에서 select하면 통신 | ||
//입고리스트에서 select하면 통신 | ||
const ReceiveAxios = (selectedProducts, dispatch) => { | ||
|
||
if (selectedProducts.length === 1) { | ||
const productId = selectedProducts[0]; | ||
console.log(productId); | ||
axios.get(`receiveAxios`) | ||
.then((response) => { | ||
console.log(response.data); | ||
dispatch({type : "seletedReceiveDetails", payload: response.data}) | ||
|
||
}) | ||
.catch((error) => { | ||
console.error(error); | ||
}); | ||
} | ||
}; | ||
if (selectedProducts.length === 1) { | ||
const productId = selectedProducts[0]; | ||
console.log(productId); | ||
axios | ||
.get(`receiveAxios`) | ||
.then((response) => { | ||
console.log(response.data); | ||
dispatch({ type: "seletedReceiveDetails", payload: response.data }); | ||
}) | ||
.catch((error) => { | ||
console.error(error); | ||
}); | ||
} | ||
}; | ||
|
||
export default ReceiveAxios; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import axios from "axios"; | ||
|
||
//입고 등록시 발주 "wait", "ing" 리스트 조회 | ||
// const pOrderWaitIngAxios = (searchPOrders) => { | ||
// console.log("porders_Data : " + JSON.stringify(searchPOrders)); | ||
// axios | ||
// .get("http://localhost:8888/api/receive/insertWaiting", { data: searchPOrders }) | ||
// .then((response) => { | ||
// console.log(response.data); | ||
// }) | ||
// .catch((error) => { | ||
// console.error(error); | ||
// }); | ||
// }; | ||
|
||
const pOrderWaitIngAxios = async (searchPOrders) => { | ||
console.log("porders_Data : " + JSON.stringify(searchPOrders)); | ||
try { | ||
const response = await axios.get("http://localhost:8888/api/receive/insertWaiting", { | ||
data: searchPOrders, | ||
}); | ||
return response.data; | ||
} catch (error) { | ||
console.error(error); | ||
throw error; | ||
} | ||
}; | ||
|
||
export default pOrderWaitIngAxios; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import axios from "axios"; | ||
import swal from "sweetalert2"; | ||
|
||
//입고리스트에서 delete하면 통신 | ||
const pOrderDeleteAxios = (selectedProducts) => { | ||
axios | ||
.delete("http://localhost:8888/api/receive/delete", { | ||
data: selectedProducts, | ||
}) | ||
.then((response) => { | ||
console.log(response.data); | ||
swal.fire({ | ||
title: "삭제 완료", | ||
text: "재고가 삭제되었습니다.", | ||
icon: "success", | ||
}); | ||
}) | ||
.catch((error) => { | ||
swal.fire({ | ||
title: "삭제 실패", | ||
text: `Error: ${error.message}`, | ||
icon: "error", | ||
}); | ||
}); | ||
}; | ||
|
||
export default pOrderDeleteAxios; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import axios from "axios"; | ||
import swal from "sweetalert2"; | ||
|
||
// 입고품목 리스트에서 delete하면 통신 | ||
const receiveItemDeleteAxios = (selectedProducts) => { | ||
console.log("선택된데이터 : " + JSON.stringify(selectedProducts)); | ||
|
||
axios | ||
.delete("http://localhost:8888/api/receive-item/delete", { | ||
data: selectedProducts, | ||
}) | ||
.then((response) => { | ||
console.log(response.data); | ||
swal.fire({ | ||
title: "삭제 완료", | ||
text: "재고가 삭제되었습니다.", | ||
icon: "success", | ||
}); | ||
}) | ||
.catch((error) => { | ||
swal.fire({ | ||
title: "삭제 실패", | ||
text: `Error: ${error.message}`, | ||
icon: "error", | ||
}); | ||
}); | ||
}; | ||
|
||
export default receiveItemDeleteAxios; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import axios from "axios"; | ||
import swal from "sweetalert2"; | ||
|
||
//입고품목 수정하면 통신 | ||
const receiveItemUpdateAxios = (indexData) => { | ||
axios | ||
.put(`http://localhost:8888/api/receive-item/delete/${indexData}`) | ||
.then((response) => { | ||
console.log(response.data); | ||
swal.fire({ | ||
title: "수정 완료", | ||
text: "입고품목이 수정되었습니다.", | ||
icon: "success", | ||
}); | ||
}) | ||
.catch((error) => { | ||
swal.fire({ | ||
title: "수정 실패", | ||
text: `Error: ${error.message}`, | ||
icon: "error", | ||
}); | ||
}); | ||
}; | ||
export default receiveItemUpdateAxios; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,26 @@ | ||
import { combineReducers } from '@reduxjs/toolkit'; | ||
import porderModalDuck from './slices/porderModalDuck' | ||
import selectedProductsReducer from './slices/selectedProductsReducer' | ||
import selectedPOrderReducer from './slices/selectedPOrderReducer' | ||
import pOrderListReducer from './slices/pOrderListReducer' | ||
import receiveListReducer from './slices/receiveListReducer' | ||
import warehouseListReducer from './slices/warehouseListReducer'; | ||
import SelectedPOrderListReducer from './slices/SelectedPOrderListReducer'; | ||
import loginResponseReducer from './slices/loginResponseReducer'; | ||
import logoutResponseReducer from './slices/logoutResponseReducer'; | ||
import { combineReducers } from "@reduxjs/toolkit"; | ||
import porderModalDuck from "./slices/porderModalDuck"; | ||
import selectedProductsReducer from "./slices/selectedProductsReducer"; | ||
import selectedPOrderReducer from "./slices/selectedPOrderReducer"; | ||
import pOrderListReducer from "./slices/pOrderListReducer"; | ||
import receiveListReducer from "./slices/receiveListReducer"; | ||
import warehouseListReducer from "./slices/warehouseListReducer"; | ||
import SelectedPOrderListReducer from "./slices/SelectedPOrderListReducer"; | ||
import loginResponseReducer from "./slices/loginResponseReducer"; | ||
import logoutResponseReducer from "./slices/logoutResponseReducer"; | ||
import receiveModalDuck from "./slices/receiveModalDuck"; | ||
|
||
const rootReducer = combineReducers({ | ||
porderModal: porderModalDuck, | ||
selectedProduct: selectedProductsReducer, | ||
selectedPOrder: selectedPOrderReducer, | ||
pOrderList: pOrderListReducer, | ||
receiveList: receiveListReducer, | ||
warehouseList: warehouseListReducer, | ||
selectedPOrderList: SelectedPOrderListReducer | ||
loginResponse: loginResponseReducer, | ||
logoutResponse: logoutResponseReducer | ||
porderModal: porderModalDuck, | ||
selectedProduct: selectedProductsReducer, | ||
selectedPOrder: selectedPOrderReducer, | ||
pOrderList: pOrderListReducer, | ||
receiveList: receiveListReducer, | ||
warehouseList: warehouseListReducer, | ||
selectedPOrderList: SelectedPOrderListReducer, | ||
loginResponse: loginResponseReducer, | ||
logoutResponse: logoutResponseReducer, | ||
receiveModal: receiveModalDuck, | ||
}); | ||
|
||
|
||
export default rootReducer; | ||
export default rootReducer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { createSlice } from "@reduxjs/toolkit"; | ||
|
||
// 초기 상태 | ||
const initialState = { | ||
openModal: false, | ||
modalData: [], | ||
editedProducts: {}, | ||
}; | ||
|
||
// 리듀서 | ||
const receiveModalReducer = createSlice({ | ||
name: "receiveModal", | ||
initialState, | ||
reducers: { | ||
open_Modal: (state) => { | ||
state.openModal = true; | ||
console.log("모달오픈()"); | ||
}, | ||
close_Modal: (state) => { | ||
state.openModal = false; | ||
}, | ||
SAVE_MODAL_DATA: (state, action) => { | ||
state.modalData.push(action.payload); | ||
console.log("reducer에서: " + state.modalData); | ||
state.openModal = false; | ||
state.modalData = null; | ||
}, | ||
}, | ||
}); | ||
|
||
export const { open_Modal, close_Modal, SAVE_MODAL_DATA } = receiveModalReducer.actions; | ||
|
||
export default receiveModalReducer.reducer; |
Oops, something went wrong.