add mainpage

This commit is contained in:
Kana
2024-01-24 12:06:17 +09:00
parent 8e38a3f520
commit fcbea8e503
5 changed files with 103 additions and 6 deletions

View File

@@ -1,5 +1,7 @@
package com.no1.wms.base;
import com.no1.wms.in.InDto;
import com.no1.wms.in.InService;
import com.no1.wms.stock.StockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@@ -7,6 +9,8 @@ import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -15,7 +19,10 @@ public class MainPageController {
@Autowired
StockService service;
@Autowired
InService inService;
@GetMapping("/main")
public String mainPage(@RequestParam(name = "searchn2", defaultValue = "0") int searchn2,
@RequestParam(name = "search2", defaultValue = "") String search2,
@@ -27,6 +34,15 @@ public class MainPageController {
List<Map<String, Object>> dto2 = service.list2(searchn2, search2, startRow2 ,perPage2);
m.addAttribute("slist2", dto2);
System.out.println("리스트 확인 : : " + dto2);
Date today = new Date();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
String formattedDate = dateFormat.format(today);
List<InDto> dto = inService.inListMain(formattedDate);
m.addAttribute("inDto", dto);
return "base/main";
}
}

View File

@@ -8,6 +8,7 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface InMapper {
List<InDto> inList(Map<String, Object> m);
List<InDto> inListMain(Map<String, Object> m);
int count(Map<String, Object> m);
int createProcess(InDto dto);
int createProcess2(InDto dto);
@@ -22,4 +23,6 @@ public interface InMapper {
int deactivateById(String id);
String selectWarehouseQuantity(String warehouseId);
int updateWarehouseQuantity(Map<String, Object> m);
}

View File

@@ -1,5 +1,6 @@
package com.no1.wms.in;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -23,6 +24,12 @@ public class InService {
return mapper.inList(m);
}
public List<InDto> inListMain(String today){//메인페이지에서 활용
Map<String, Object> m = new HashMap<String, Object>();
m.put("today",today);
return mapper.inListMain(m);
}
public int count(int searchn, String search) {
Map<String,Object> m = new HashMap<String, Object>();
m.put("searchn",searchn);

View File

@@ -139,6 +139,26 @@
</where>
ORDER BY proin.in_date desc LIMIT #{start} , #{perPage}
</select>
<select id="inListMain" parameterType="map" resultMap="inResultMap">
SELECT
proin.id, proin.group_number, proin.product_id, proin.in_date, proin.quantity, proin.warehouse_id, proin.manager_id, proin.note, proin.activation,
planin.view_group_number,
pro.name as product_name,
w.name as warehouse_name,
a.name as account_name,
(SELECT price FROM prices WHERE product_id = proin.product_id ORDER BY registration_date DESC LIMIT 1) as latest_price
FROM
product_in as proin
LEFT JOIN plan_In as planin on proin.group_number = planin.group_number and proin.product_id = planin.product_id
LEFT JOIN product as pro on proin.product_id = pro.id
LEFT JOIN warehouse as w on proin.warehouse_id = w.id
LEFT JOIN account as a on proin.manager_id = a.id
WHERE proin.in_date = #{today} and proin.activation = 1
ORDER BY proin.in_date desc LIMIT 5
</select>
<select id="selectById" parameterType="String" resultMap="inResultMap">
SELECT
proin.id, proin.group_number, proin.product_id, proin.in_date, proin.quantity, proin.warehouse_id, proin.manager_id, proin.note, proin.activation,

View File

@@ -1,5 +1,6 @@
<%@ page contentType="text/html; charset=UTF-8" %>3
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
@@ -55,8 +56,41 @@
</div>
<div class="col-md-6">
<!-- 네 번째 공간 -->
<div>네 번째 공간</div>
<!--네 번째 공간 -->
<div>
<div class=" text-center">
<h5>오늘의 입고</h5>
</div>
<table class="table">
<thead class="table-dark">
<tr>
<th>번호</th>
<th>제품명</th>
<th>입고예정그룹번호</th>
<th>수량</th>
<th>창고</th>
</tr>
</thead>
<tbody>
<c:forEach items="${inDto }" var="dto" varStatus="status">
<tr class="detailTr2 col-5" data-id="${dto.id}" style="font-size: small;" >
<td class="col-1">${status.count }</td>
<td class="col-1">${dto.productDto.name }</td>
<c:if test="${not empty dto.planInDto.viewGroupNumber}">
<td class="col-1">${dto.planInDto.viewGroupNumber}</td>
</c:if>
<c:if test="${empty dto.planInDto.viewGroupNumber}">
<td class="col-1"></td>
</c:if>
<td class="col-1">${dto.quantity }</td>
<td class="col-1">${dto.warehouseDto.name}</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</div>
</div>
</div>
@@ -78,9 +112,9 @@
center: 'title',
right: 'dayGridMonth,timeGridWeek,timeGridDay,listMonth'
},
googleCalendarApiKey: 'AIzaSyBKWDNnFEMpuNCPubU3pkkmB1F6XLX_bSo',
googleCalendarApiKey: '',
events: {
googleCalendarId: '7a3e7ae86281b8e995e4db0402865fb947ceb73c7d633f3a629a0068ac0ca66c@group.calendar.google.com',
googleCalendarId: '@group.calendar.google.com',
className: 'gcal-event' // an option!
},
eventClick: function (info) {
@@ -145,6 +179,23 @@
form.submit();
});
$("body").on("click", ".detailTr2", function () {
var id = $(this).data("id");
var form = document.createElement("form");
form.action = "/in/read";
form.method = "POST";
document.body.appendChild(form);
var input = document.createElement("input");
input.type = "hidden";
input.name = "id";
input.value = id;
form.appendChild(input);
form.submit();
});
});
</script>
</body>