change inController

This commit is contained in:
Kana
2024-01-22 10:12:52 +09:00
parent fbc2470c98
commit 3cb86ba7b3
3 changed files with 80 additions and 68 deletions

View File

@@ -79,37 +79,7 @@ public class InController {
@PostMapping("/create_process")
@ResponseBody
public boolean createProcess(InDto dto) {
int j = inService.checkIfExistsStock(dto);
if(j == 1) {
int k = inService.updateStockProcess(dto);
if(k == 1) {
int i = inService.createProcess(dto);
if(i == k) {
System.out.println("달라서 새로만듬");
return true;
}else {
return false;
}
}else {
return false;
}
}else if(j == 0) {
int k = inService.createStockProcess(dto);
if(k == 1) {
int i = inService.createProcess(dto);
if(i == k) {
System.out.println("같아서 합침");
return true;
}else {
return false;
}
}else {
return false;
}
}else {
return false;
}
return inService.chechAndUpdateOrCreateProcess(dto);
}
@PostMapping("/read")
@@ -202,8 +172,8 @@ public class InController {
List<Map<String, Object>> list = null;
int count = 0;
list = stockservice.warehousesSelect(searchn, search, startRow, perPage, product_id);
count = stockservice.warehouseCount(searchn, search, product_id);
list = stockservice.warehousesSelect(searchn, search, startRow, perPage);
count = stockservice.warehouseCount(searchn, search);
mav.addObject("list", list);

View File

@@ -58,4 +58,45 @@ public class InService {
return mapper.createStockProcess(dto);
}
//createProcess
public boolean chechAndUpdateOrCreateProcess(InDto dto) {
int j = mapper.checkIfExistsStock(dto);
if(j == 1) {
int k = mapper.updateStockProcess(dto);
if(k == 1) {
int i = mapper.createProcess(dto);
if(i == k) {
System.out.println("달라서 새로만듬");
return true;
}else {
return false;
}
}else {
return false;
}
}else if(j == 0) {
int k = mapper.createStockProcess(dto);
if(k == 1) {
int i = mapper.createProcess(dto);
if(i == k) {
System.out.println("같아서 합침");
return true;
}else {
return false;
}
}else {
return false;
}
}else {
return false;
}
}
}

View File

@@ -103,6 +103,7 @@
<c:set var="userData" value="${sessionScope.userData}" />
<input type='hidden' id="manager_id" value="${userData.id}">
<input type='hidden' id="id" value="${dto.id}">
</div>
</div>
</div>
@@ -216,41 +217,41 @@
});//submitBtn
});//ready
function showSearchModal(title, val){
$("#searchModalLabel").text(title);
const data = { name : val};
$.ajax({
type : 'post', // 타입 (get, post, put 등등)
url : '/product/show_modal', // 요청할 서버url
dataType : 'html', // 데이터 타입 (html, xml, json, text 등등)
data : data,
success : function(result) { // 결과 성공 콜백함수
$("#search_modal_body").html(result);
searchModalBootStrap.show();
},
error : function(request, status, error) {
alert(error)
}
});
}
function showSearchModal2(title, val){
$("#searchModalLabel").text(title);
const data = { name : val};
$.ajax({
type : 'post', // 타입 (get, post, put 등등)
url : '/product/show_modal2', // 요청할 서버url
dataType : 'html', // 데이터 타입 (html, xml, json, text 등등)
data : data,
success : function(result) { // 결과 성공 콜백함수
$("#search_modal_body").html(result);
searchModalBootStrap.show();
},
error : function(request, status, error) {
alert(error)
}
});
}
function showSearchModal_product(title, val){
$("#searchModalLabel").text(title);
const data = { name : val};
$.ajax({
type : 'post', // 타입 (get, post, put 등등)
url : '/in/show_modal_product', // 요청할 서버url
dataType : 'html', // 데이터 타입 (html, xml, json, text 등등)
data : data,
success : function(result) { // 결과 성공 콜백함수
$("#search_modal_body").html(result);
searchModalBootStrap.show();
},
error : function(request, status, error) {
alert(error)
}
});
}//showSearchModal_products
function showSearchModal_warehouse(title, val){
$("#searchModalLabel").text(title);
const data = { name : val};
$.ajax({
type : 'post', // 타입 (get, post, put 등등)
url : '/in/show_modal_warehouse', // 요청할 서버url
dataType : 'html', // 데이터 타입 (html, xml, json, text 등등)
data : data,
success : function(result) { // 결과 성공 콜백함수
$("#search_modal_body").html(result);
searchModalBootStrap.show();
},
error : function(request, status, error) {
alert(error)
}
});
}//showSearchModal_warehouse
</script>
</body>
</html>