This commit is contained in:
sungsu
2024-01-24 12:08:15 +09:00
9 changed files with 137 additions and 16 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;
@@ -16,6 +20,9 @@ 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

@@ -33,10 +33,9 @@ public class PlanInController {
@GetMapping("/list")
public ModelAndView list(ModelAndView mav,@RequestParam(defaultValue = "0") int searchn, @RequestParam(defaultValue = "") String search, @RequestParam(defaultValue = "1") int page){
int perPage = 15;
int perPage = 10;
int startRow = (page - 1) * perPage;
int count = planinservice.count(searchn, search);
int count = planinservice.count(searchn, search, startRow, perPage);
int pageNum = 4;//보여질 페이지 번호 수

View File

@@ -20,11 +20,13 @@ public class PlanInService {
return mapper.selectAll(map);
}
int count(int searchn, String search){
int count(int searchn, String search, int start, int perPage){
System.out.printf("searchn : %d, search : %s, start : %d, perpage : %d", searchn, search, start, perPage);
HashMap<String, Object> m = new HashMap<>();
m.put("searchn", searchn);
m.put("search", search);
m.put("start", start);
m.put("perPage", perPage);
return mapper.count(m);
}
@@ -47,7 +49,4 @@ public class PlanInService {
return mapper.selectByQRHash(qrHash);
}
}

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

@@ -128,8 +128,9 @@
select count(*) from ( SELECT 1 from plan_In i join product p
<where>
<choose>
<when test="searchn == 0"> i.product_id = p.id and i.activation = 1 and i.view_group_number like concat('%',#{search},'%') </when>
<when test="searchn == 1"> i.product_id = p.id and i.activation = 1 and p.name like concat('%',#{search},'%')</when>
<when test="searchn == 0"> i.product_id = p.id and i.activation = 1 and i.group_number like concat('%',#{search},'%') </when>
<when test="searchn == 2"> i.product_id = p.id and i.activation = 1 and i.quantity like concat(#{search})</when>
</choose>
</where>
) t

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>

View File

@@ -32,6 +32,14 @@
}
function onPaging(target){
const p = $(target).data("p");
$("#pPage").val(p);
const $form = $("#search_form");
$form.attr("action", "/plan_in/list");
$form.trigger("submit");
}
</script>
<div class="container">
<div class="row">
@@ -77,6 +85,23 @@
</table>
</div>
</div>
<div class="row">
<div class="col-12">
<div id="page">
<ul class="pagination justify-content-center">
<c:if test="${begin > pageNum }">
<li class="page-item"><a class="page-link" data-p='${begin-1 }' href="#" onclick="onPaging(this)">[<]</a></li>
</c:if>
<c:forEach begin="${begin }" end="${end}" var="i" varStatus="status">
<li class="page-item <c:if test="${page eq status.count}">active</c:if> "><a class="page-link" data-p='${i}' href="#" onclick="onPaging(this)" >${i}</a></li>
</c:forEach>
<c:if test="${end < totalPages }">
<li class="page-item"><a class="page-link" data-p='${end+1}' href="#" onclick="onPaging(this)">[>]</a></li>
</c:if>
</ul>
</div>
</div>
</div>
</div>
<form id="form" action='/plan_in/read' method="post">
<input name="groupNumber" id="groupId" hidden>