浏览代码

wms 시즌 매핑

eskim 5 年之前
父节点
当前提交
651245df7f

+ 19 - 0
style24.admin/src/main/java/com/style24/admin/biz/dao/TsaGoodsDao.java

@@ -19,6 +19,7 @@ import com.style24.persistence.domain.Notice;
 import com.style24.persistence.domain.NoticeGoods;
 import com.style24.persistence.domain.Option;
 import com.style24.persistence.domain.WmsColorMapping;
+import com.style24.persistence.domain.WmsSeasonMapping;
 import com.style24.persistence.domain.WmsStyleYearMapping;
 
 import com.gagaframework.web.parameter.GagaMap;
@@ -137,6 +138,24 @@ public interface TsaGoodsDao {
 	 */
 	void saveWmsStyleYearMapping(WmsStyleYearMapping wmsStyleYearMapping);
 
+	/**
+	 * WMS 시즌 매핑목록 조회
+	 *
+	 * @param wmsStyleYearMapping
+	 * @return
+	 * @author eskim
+	 * @since 2020. 11. 13
+	 */
+	Collection<WmsSeasonMapping> getWmsSeasonMappingList(WmsSeasonMapping wmsSeasonMapping);
+
+	/**
+	 * WMS 시즌 매핑 저장
+	 * @param wmsStyleYearMapping
+	 * @author eskim
+	 * @since 2020. 11. 13
+	 */
+	void saveWmsSeasonMapping(WmsSeasonMapping wmsSeasonMapping);
+
 	/**
 	 * 상품 목록 건수
 	 *

+ 35 - 2
style24.admin/src/main/java/com/style24/admin/biz/service/TsaGoodsService.java

@@ -33,6 +33,7 @@ import com.style24.persistence.domain.NoticeGoods;
 import com.style24.persistence.domain.Option;
 import com.style24.persistence.domain.SearchData;
 import com.style24.persistence.domain.WmsColorMapping;
+import com.style24.persistence.domain.WmsSeasonMapping;
 import com.style24.persistence.domain.WmsStyleYearMapping;
 
 import lombok.extern.slf4j.Slf4j;
@@ -254,7 +255,7 @@ public class TsaGoodsService {
 	/**
 	 * WMS 스타일년도 매핑목록 조회
 	 *
-	 * @param color
+	 * @param wmsStyleYearMapping
 	 * @return
 	 * @author eskim
 	 * @since 2020. 11. 13
@@ -266,7 +267,7 @@ public class TsaGoodsService {
 	/**
 	 * WMS 스타일년도 매핑 저장
 	 *
-	 * @param colorList
+	 * @param wmsStyleYearMappingList
 	 * @return
 	 * @author eskim
 	 * @since 2020. 11. 13
@@ -283,6 +284,38 @@ public class TsaGoodsService {
 		}
 	}
 
+	/**
+	 * WMS 시즌 매핑목록 조회
+	 *
+	 * @param wmsSeasonMapping
+	 * @return
+	 * @author eskim
+	 * @since 2020. 11. 13
+	 */
+	public Collection<WmsSeasonMapping> getWmsSeasonMappingList(WmsSeasonMapping wmsSeasonMapping) {
+		return goodsDao.getWmsSeasonMappingList(wmsSeasonMapping);
+	}
+
+	/**
+	 * WMS 시즌 매핑 저장
+	 *
+	 * @param wmsSeasonMappingList
+	 * @return
+	 * @author eskim
+	 * @since 2020. 11. 13
+	 */
+	@Transactional("shopTxnManager")
+	public void saveWmsSeasonMapping(Collection<WmsSeasonMapping> wmsSeasonMappingList) {
+
+		for (WmsSeasonMapping wmsSeasonMapping : wmsSeasonMappingList) {
+
+			wmsSeasonMapping.setRegNo(TsaSession.getInfo().getUserNo());
+			wmsSeasonMapping.setUpdNo(TsaSession.getInfo().getUserNo());
+
+			goodsDao.saveWmsSeasonMapping(wmsSeasonMapping);
+		}
+	}
+
 	/**
 	 * 상품 목록 건수
 	 *

+ 40 - 4
style24.admin/src/main/java/com/style24/admin/biz/web/TsaGoodsController.java

@@ -41,6 +41,7 @@ import com.style24.persistence.domain.NotiInfo;
 import com.style24.persistence.domain.Notice;
 import com.style24.persistence.domain.NoticeGoods;
 import com.style24.persistence.domain.WmsColorMapping;
+import com.style24.persistence.domain.WmsSeasonMapping;
 import com.style24.persistence.domain.WmsStyleYearMapping;
 
 import lombok.extern.slf4j.Slf4j;
@@ -189,21 +190,56 @@ public class TsaGoodsController extends TsaBaseController {
 	}
 
 	/**
-	 * 시즌관리 화면
+	 * WMS 시즌매핑 화면
 	 *
 	 * @return
 	 * @author eskim
-	 * @since 2020. 10. 16
+	 * @since 2020. 11. 13
 	 */
-	@GetMapping("/season/form")
+	@GetMapping("/wms/season/form")
 	public ModelAndView seasonForm() {
 		ModelAndView mav = new ModelAndView();
 
-		mav.setViewName("goods/SeasonForm");
+		// 시즌
+		mav.addObject("seasonList", rendererService.getAvailCommonCodeList("G006"));
+
+		mav.setViewName("goods/WmsSeasonMappingForm");
 
 		return mav;
 	}
 
+	/**
+	 * WMS 시즌 매핑 조회
+	 *
+	 * @param color
+	 * @return
+	 * @author eskim
+	 * @since 2020. 11. 13
+	 */
+	@PostMapping("/wms/season/mapping/list")
+	@ResponseBody
+	public Collection<WmsSeasonMapping> getWmsSeasonMappingList(@RequestBody WmsSeasonMapping wmsSeasonMapping) {
+		return goodsService.getWmsSeasonMappingList(wmsSeasonMapping);
+	}
+
+	/**
+	 * WMS 시즌 매핑 저장
+	 *
+	 * @param color
+	 * @return
+	 * @author eskim
+	 * @since 2020. 11. 13
+	 */
+	@PostMapping("/wms/season/mapping/save")
+	@ResponseBody
+	public GagaResponse saveWmsSeasonMapping(@RequestBody Collection<WmsSeasonMapping> wmsSeasonMappingList) {
+
+		goodsService.saveWmsSeasonMapping(wmsSeasonMappingList);
+
+		return super.ok(message.getMessage("SUCC_0001"));
+	}
+
+
 	/**
 	 * 고시정보관리 화면
 	 *

+ 23 - 0
style24.admin/src/main/java/com/style24/persistence/domain/WmsSeasonMapping.java

@@ -0,0 +1,23 @@
+package com.style24.persistence.domain;
+
+import com.style24.persistence.TscBaseDomain;
+
+import lombok.Data;
+
+/**
+ * WMS 시즌 매핑  Domain
+ *
+ * @author eskim
+ * @since 2020. 11. 13
+ */
+@SuppressWarnings("serial")
+@Data
+public class WmsSeasonMapping extends TscBaseDomain {
+
+	private String supplyCompCd;
+	private String wmsSeasonCd;
+	private String wmsSeasonNm;
+	private String seasonCd;
+	private String useYn;
+
+}

+ 49 - 0
style24.admin/src/main/java/com/style24/persistence/mybatis/shop/TsaGoods.xml

@@ -293,6 +293,55 @@
 		     , UPD_DT = NOW()
 	</update>
 	
+	<!-- WMS 시즌 매핑 조회 -->
+	<select id="getWmsSeasonMappingList" parameterType="WmsSeasonMapping" resultType="WmsSeasonMapping" >
+		/* TsaGoods.getWmsSeasonMappingList */
+		SELECT SUPPLY_COMP_CD
+		     , WMS_SEASON_CD
+		     , WMS_SEASON_NM
+		     , SEASON_CD
+		     , USE_YN
+		     , FN_GET_USER_NM(REG_NO) AS REG_NM
+		     , DATE_FORMAT(REG_DT, '%Y%m%d%H%i%S') AS REG_DT
+		     , FN_GET_USER_NM(UPD_NO) AS UPD_NM
+		     , DATE_FORMAT(UPD_DT, '%Y%m%d%H%i%S') AS UPD_DT
+		FROM TB_WMS_SEASON_MAPPING
+		WHERE SUPPLY_COMP_CD = #{supplyCompCd}
+		ORDER BY WMS_SEASON_CD
+	</select>
+	
+	<!-- WMS 시즌 매핑 저장 -->
+	<update id="saveWmsSeasonMapping" parameterType="WmsSeasonMapping">
+		/* TsaGoods.saveWmsSeasonMapping */
+		INSERT INTO TB_WMS_STYLE_YEAR_MAPPING (
+		       SUPPLY_COMP_CD
+		     , WMS_SEASON_CD
+		     , WMS_SEASON_NM
+		     , SEASON_CD
+		     , USE_YN
+		     , REG_NO
+		     , REG_DT
+		     , UPD_NO
+		     , UPD_DT
+		)
+		VALUES (
+		       #{supplyCompCd}
+		     , #{wmsSeasonCd}
+		     , #{wmsSeasonNm}
+		     , #{seasonCd}
+		     , #{useYn}
+		     , #{regNo}
+		     , NOW()
+		     , #{updNo}
+		     , NOW()
+		)
+		ON DUPLICATE KEY UPDATE
+		       SEASON_CD = #{seasonCd}
+		     , USE_YN = #{useYn}
+		     , UPD_NO = #{updNo}
+		     , UPD_DT = NOW()
+	</update>
+	
 	<!-- 상품 목록 건수 -->
 	<select id="getGoodsListCount" parameterType="GoodsSearch" resultType="int">
 		/* TsaGoods.getGoodsListCount */

+ 186 - 0
style24.admin/src/main/webapp/WEB-INF/views/goods/WmsSeasonMappingForm.html

@@ -0,0 +1,186 @@
+<!DOCTYPE html>
+<html lang="ko"
+	xmlns:th="http://www.thymeleaf.org">
+<!--
+ *******************************************************************************
+ * @source  : WmsSeasonMappingForm.html
+ * @desc    : WMS 시슨 매핑
+ *============================================================================
+ * STYLE24
+ * Copyright(C) 2020 TSIT, All rights reserved.
+ *============================================================================
+ * VER  DATE         AUTHOR      DESCRIPTION
+ * ===  ===========  ==========  =============================================
+ * 1.0  2020.11.13   eskim       최초 작성
+ *******************************************************************************
+ -->
+	<div id="main">
+		<!-- 메인타이틀 영역 -->
+		<div class="main-title">
+		</div>
+		<!-- //메인타이틀 영역 -->
+		
+		<!-- 메뉴 설명 -->
+		<div class="infoBox menu-desc">
+		</div>
+		<!-- //메뉴 설명 -->
+		<form id="searchForm" name="searchForm" action="#" th:action="@{'/goods/wms/season/mapping/list'}" th:method="post">
+			<div class="panelStyle">
+				<!-- 버튼 배치 영역 -->
+				<ul class="panelBar">
+					<li>
+						<h3>업체명</h3>
+						<select name="supplyCompCd" id="supplyCompCd">
+							<option value="S0001" selected="selected">한세엠케이</option>
+							<option value="S0002">한세드림</option>
+							<option value="S006">FRJ</option>
+						</select>
+						<button type="button" class="btn btn-dark btn-sm" id="btnAddRow">행추가</button>
+					</li>
+					<li  class="right">
+						<button type="button" class="btn btn-success btn-lg" id="btnSave">저장</button>
+					</li>
+				</ul>
+				<!-- //버튼 배치 영역 -->
+				
+				<div id="gridList" style="width: 100%; height: 650px" class="ag-theme-balham"></div>
+			</div>
+		</form>
+	</div>
+
+<script th:inline="javascript">
+/*<![CDATA[*/
+	var useYnList = { "Y":"Yes", "N":"No" };
+	var seasonList = gagajf.convertToArray([[${seasonList}]]);
+	// specify the columns
+	var columnDefs = [
+		{width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
+		{headerName: 'No', width: 60, cellClass: 'text-center', valueGetter: function(params) { return params.node.rowIndex + 1 }},
+		{headerName: "WMS시즌코드", field: "wmsSeasonCd", width: 150, cellClass: 'text-center',editable: true,
+			editable : function(params){return params.data.crud=='C' ? true : false;},
+			cellEditor: 'textCellEditor',
+			cellEditorParams: { maxlength: 2, required: true, onblur: '$(this).val($(this).val().toUpperCase())' }
+		},
+		{headerName: "WMS시즌명", field: "wmsSeasonNm", width: 150, cellClass: 'text-center',editable: true,
+			cellEditor: 'textCellEditor',
+			cellEditorParams: { maxlength: 50, required: true }
+		},
+		{headerName: "시즌코드", field: "seasonCd", width: 100, cellClass: 'text-center',editable: true,
+			cellEditor: 'agRichSelectCellEditor',
+			cellEditorParams: { values: gagaAgGrid.extractValues(seasonList) },
+			valueFormatter: function (params) { return gagaAgGrid.lookupValue(seasonList, params.value); },
+			valueParser: function (params) { return gagaAgGrid.lookupKey(seasonList, params.newValue); }
+		},
+		{headerName: "사용여부", field: "useYn", width: 100, minWidth: 75, cellClass: 'text-center',
+			cellEditor: 'agRichSelectCellEditor',
+			cellEditorParams: { values: gagaAgGrid.extractValues(useYnList) },
+			valueFormatter: function (params) { return gagaAgGrid.lookupValue(useYnList, params.value); },
+			valueParser: function (params) { return gagaAgGrid.lookupKey(useYnList, params.newValue); }
+		},
+		{headerName: "등록자", field: "regNm" , width: 100, cellClass: 'text-center', editable: false},
+		{headerName: "등록일시", field: "regDt", width: 150, cellClass: 'text-center', editable: false,
+			cellRenderer: function(params) {
+				return !gagajf.isNull(params.value) ? params.value.toDate("YYYYMMDDHHmmss").format("YYYY-MM-DD HH:mm:ss") : '';
+			}
+		},
+		{headerName: "수정자", field: "updNm" , width: 100, cellClass: 'text-center', editable: false},
+		{headerName: "수정일시", field: "updDt", width: 150, cellClass: 'text-center', editable: false,
+			cellRenderer: function(params) {
+				return !gagajf.isNull(params.value) ? params.value.toDate("YYYYMMDDHHmmss").format("YYYY-MM-DD HH:mm:ss") : '';
+			}
+		}
+	];
+
+	// Get GridOptions
+	var gridOptions = gagaAgGrid.getGridOptions(columnDefs);
+
+	// Grid editable
+	gridOptions.defaultColDef.editable = true;
+
+	//그리드 셀에디트 하는 화면에 옵션 추가해 주면 포커스 잃을 시 에디트 바로 중지(데이터 변경후 엔터 안쳐도 됩)
+	gridOptions.stopEditingWhenGridLosesFocus = true;
+
+	// Add on options
+	gridOptions.suppressRowClickSelection = true;
+	gridOptions.rowSelection = 'multiple';
+
+	// 행추가
+	$('#btnAddRow').on('click', function() {
+		var data = { wmsSeasonCd: null, wmsSeasonNm: null, seasonCd: null, useYn: "Y", supplyCompCd: $('#supplyCompCd').val() };
+		gagaAgGrid.addRowData(gridOptions, data, "wmsSeasonCd");
+	});
+
+	// 저장
+	$('#btnSave').on('click', function() {
+		// 변경된 데이터
+		var changedData = gagaAgGrid.getChangedData(gridOptions);
+		var loopRowData = gagaAgGrid.getAllRowData(gridOptions);
+
+		if (changedData.length == 0) {
+			mcxDialog.alert('선택된 데이터가 없습니다.');
+			return;
+		}
+
+		// Validation
+		if (!gagaAgGrid.validation(gridOptions, changedData))
+			return;
+
+		var checkFlag = false;
+		var selIndex = 0;
+		changedData.forEach(function(item, index) {
+			
+			if(checkFlag) return false;
+			
+			if (item.crud == "C"){
+				selIndex = index;
+				loopRowData.forEach(function(loopItem, loopIndex) {
+					if (selIndex != loopIndex){
+						if(item.wmsSeasonCd == loopItem.wmsSeasonCd){
+							checkFlag = true;
+							mcxDialog.alertC("WMS시즌코드가 중복됩니다. 확인해주세요.", {
+								sureBtnText: "확인",
+								sureBtnClick: function() {
+									gridOptions.api.setFocusedCell(selIndex, "wmsSeasonCd", null);
+								}
+							});
+							return;
+						}
+					}
+				});	
+			}
+		});
+		
+		if(checkFlag) return false;
+		
+		mcxDialog.confirm('저장하시겠습니까?', {
+			cancelBtnText: "취소",
+			sureBtnText: "확인",
+			sureBtnClick: function(){
+				var jsonData = JSON.stringify(changedData);
+				gagajf.ajaxJsonSubmit('/goods/wms/season/mapping/save', jsonData, fnSearch);
+			}
+		});
+	});
+	
+	//업체변경시
+	$("#supplyCompCd").on("change", function(){
+		fnSearch();
+	});
+	
+	//조회
+	var fnSearch = function() {
+		var formId = "#searchForm";
+		gagaAgGrid.fetch($(formId).prop('action'), gridOptions, formId);
+	}
+
+	$(document).ready(function() {
+		// Create a agGrid
+		gagaAgGrid.createGrid('gridList', gridOptions);
+		
+		fnSearch();
+	});
+		
+/*]]>*/
+</script>
+
+</html>

+ 1 - 1
style24.admin/src/main/webapp/WEB-INF/views/goods/WmsStyleYearMappingForm.html

@@ -140,7 +140,7 @@
 							mcxDialog.alertC("WMS스타일년도코드가 중복됩니다. 확인해주세요.", {
 								sureBtnText: "확인",
 								sureBtnClick: function() {
-									gridOptions.api.setFocusedCell(selIndex, "wmsColorCd", null);
+									gridOptions.api.setFocusedCell(selIndex, "wmsStyleYearCd", null);
 								}
 							});
 							return;