eskim 5 лет назад
Родитель
Сommit
09938a269f

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

@@ -3,6 +3,7 @@ package com.style24.admin.biz.dao;
 import java.util.Collection;
 
 import com.style24.core.support.annotation.ShopDs;
+import com.style24.persistence.domain.Color;
 import com.style24.persistence.domain.Itemkind;
 
 /**
@@ -39,5 +40,21 @@ public interface TsaGoodsDao {
 	 */
 	void deleteItemkindInfo(Itemkind itemkind);
 
+	/**
+	 * 색상목록 조회
+	 *
+	 * @param color
+	 * @return
+	 * @author eskim
+	 * @since 2020. 10. 16
+	 */
+	Collection<Color> getColorList(Color color);
 
+	/**
+	 * 색상 저장
+	 * @param color
+	 * @author eskim
+	 * @since 2020. 10. 16
+	 */
+	void saveColor(Color color);
 }

+ 20 - 9
style24.admin/src/main/java/com/style24/admin/biz/dao/TsaRendererDao.java

@@ -3,12 +3,13 @@ package com.style24.admin.biz.dao;
 import java.util.Collection;
 
 import com.style24.core.support.annotation.ShopDs;
+import com.style24.persistence.domain.Color;
 import com.style24.persistence.domain.CommonCode;
 import com.style24.persistence.domain.SupplyCompany;
 
 /**
  * 콤보박스, 체크박스, 라디오버튼 구성 시 필요한 Renderer Dao
- * 
+ *
  * @author gagamel
  * @since 2020. 10. 7
  */
@@ -122,14 +123,14 @@ public interface TsaRendererDao {
 //	 */
 //	Collection<CommonCode> getBrandGroupList();
 //
-//	/**
-//	 * 컬러 목록
-//	 * @param color
-//	 * @return
-//	 * @author eskim
-//	 * @since 2019. 12. 11
-//	 */
-//	Collection<CommonCode> getColorList(AdmColor color);
+	/**
+	 * 컬러 목록
+	 * @param color
+	 * @return
+	 * @author eskim
+	 * @since 2020. 10. 16
+	 */
+	Collection<CommonCode> getColorList(Color color);
 //
 //	/**
 //	 * 사용중 대카테고리 목록
@@ -208,4 +209,14 @@ public interface TsaRendererDao {
 //	 */
 //	Collection<CommonCode> getAflinkList(String afChannel);
 
+	/**
+	 * 코드설명 목록
+	 *
+	 * @param cdGb - 공통코드 정보
+	 * @return 코드설명 목록
+	 * @author eskim
+	 * @since 2020. 10. 16
+	 */
+	Collection<CommonCode> getCommonCodeDescList(String cdGb);
+
 }

+ 34 - 0
style24.admin/src/main/java/com/style24/admin/biz/service/TsaGoodsService.java

@@ -9,6 +9,7 @@ import org.springframework.transaction.annotation.Transactional;
 import com.style24.admin.biz.dao.TsaGoodsDao;
 import com.style24.admin.support.security.session.TsaSession;
 import com.style24.core.support.message.TscMessageByLocale;
+import com.style24.persistence.domain.Color;
 import com.style24.persistence.domain.Itemkind;
 
 import lombok.extern.slf4j.Slf4j;
@@ -73,4 +74,37 @@ public class TsaGoodsService {
 			goodsDao.deleteItemkindInfo(itemkind);
 		}
 	}
+
+	/**
+	 * 색상목록 조회
+	 *
+	 * @param color
+	 * @return
+	 * @author eskim
+	 * @since 2020. 10. 16
+	 */
+	public Collection<Color> getColorList(Color color) {
+		return goodsDao.getColorList(color);
+	}
+
+	/**
+	 * 색상 저장
+	 *
+	 * @param colorList
+	 * @return
+	 * @author eskim
+	 * @since 2020. 10. 16
+	 */
+	@Transactional("shopTxnManager")
+	public void saveColor(Collection<Color> colorList) {
+
+		for (Color color : colorList) {
+
+			color.setRegNo(TsaSession.getInfo().getUserNo());
+			color.setUpdNo(TsaSession.getInfo().getUserNo());
+
+			goodsDao.saveColor(color);
+		}
+	}
+
 }

+ 23 - 10
style24.admin/src/main/java/com/style24/admin/biz/service/TsaRendererService.java

@@ -6,6 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.style24.admin.biz.dao.TsaRendererDao;
+import com.style24.persistence.domain.Color;
 import com.style24.persistence.domain.CommonCode;
 import com.style24.persistence.domain.SupplyCompany;
 
@@ -355,16 +356,16 @@ public class TsaRendererService {
 //		return rendererDao.getBrandGroupList();
 //	}
 //
-//	/**
-//	 * 컬러 목록
-//	 * @param color - 색상 정보
-//	 * @return 컬러 목록
-//	 * @author eskim
-//	 * @since 2019. 12. 11
-//	 */
-//	public Collection<CommonCode> getColorList(AdmColor color) {
-//		return rendererDao.getColorList(color);
-//	}
+	/**
+	 * 컬러 목록
+	 * @param color - 색상 정보
+	 * @return 컬러 목록
+	 * @author eskim
+	 * @since 2020. 10. 16
+	 */
+	public Collection<CommonCode> getColorList(Color color) {
+		return rendererDao.getColorList(color);
+	}
 //
 //	/**
 //	 * 사용중 대카테고리 목록
@@ -462,4 +463,16 @@ public class TsaRendererService {
 //		return rendererDao.getAflinkList(afChannel);
 //	}
 
+	/**
+	 * 코드설명 목록
+	 *
+	 * @param cdGb - 공통코드
+	 * @return
+	 * @author eskim
+	 * @since 2020. 10. 16
+	 */
+	public Collection<CommonCode> getCommonCodeDescList(String cdGb) {
+		return rendererDao.getCommonCodeDescList(cdGb);
+	}
+
 }

+ 36 - 0
style24.admin/src/main/java/com/style24/admin/biz/web/TsaGoodsController.java

@@ -15,6 +15,7 @@ import com.style24.admin.biz.service.TsaGoodsService;
 import com.style24.admin.biz.service.TsaRendererService;
 import com.style24.admin.support.controller.TsaBaseController;
 import com.style24.core.support.message.TscMessageByLocale;
+import com.style24.persistence.domain.Color;
 import com.style24.persistence.domain.Itemkind;
 
 import lombok.extern.slf4j.Slf4j;
@@ -113,11 +114,46 @@ public class TsaGoodsController extends TsaBaseController {
 	public ModelAndView colorForm() {
 		ModelAndView mav = new ModelAndView();
 
+		// 대표컬러목록
+		mav.addObject("groupColorCodeList", rendererService.getCommonCodeDescList("G072"));
+		// 대표컬러명목록
+		mav.addObject("groupColorCodeNmList", rendererService.getCommonCodeList("G072"));
+
 		mav.setViewName("goods/ColorForm");
 
 		return mav;
 	}
 
+	/**
+	 * 색상 조회
+	 *
+	 * @param color
+	 * @return
+	 * @author eskim
+	 * @since 2020. 10. 16
+	 */
+	@PostMapping("/color/list")
+	@ResponseBody
+	public Collection<Color> getColorList(@RequestBody Color color) {
+		return goodsService.getColorList(color);
+	}
+
+	/**
+	 * 색상 저장
+	 *
+	 * @param color
+	 * @return
+	 * @author eskim
+	 * @since 2020. 10. 16
+	 */
+	@PostMapping("/color/save")
+	@ResponseBody
+	public GagaResponse saveColor(@RequestBody Collection<Color> colorList) {
+
+		goodsService.saveColor(colorList);
+
+		return super.ok(message.getMessage("SUCC_0001"));
+	}
 	/**
 	 * 시즌관리 화면
 	 *

+ 1 - 3
style24.admin/src/main/java/com/style24/persistence/domain/Color.java

@@ -6,7 +6,7 @@ import lombok.Data;
 
 /**
  * 색상 Domain
- * 
+ *
  * @author gagamel
  * @since 2020. 10. 7
  */
@@ -14,13 +14,11 @@ import lombok.Data;
 @Data
 public class Color extends TsaBaseDomain {
 
-	private String supplyCompCd;	// 공급업체코드
 	private String colorCd;			// 색상코드
 	private String colorEnm;		// 색상영문명
 	private String colorKnm;		// 색상한글명
 	private String colorFile;		// 색상파일
 	private String colorGrpNm;		// 색상그룹명
-	private String colorGrpFile;	// 색상그룹파일
 	private String useYn;			// 사용여부
 
 }

+ 63 - 1
style24.admin/src/main/java/com/style24/persistence/mybatis/shop/TsaGoods.xml

@@ -50,7 +50,6 @@
 		     , USE_YN = #{useYn}
 		     , UPD_NO = #{updNo}
 		     , UPD_DT = NOW()
-		     
 	</insert>
 	
 	<!-- 품목 삭제 -->
@@ -59,4 +58,67 @@
 		DELETE FROM TB_ITEMKIND
 		 WHERE ITEMKIND_CD = #{itemkindCd}
 	</delete>
+	
+	<!-- 색상 조회 -->
+	<select id="getColorList" parameterType="Color" resultType="Color" >
+		/* TsaGoods.getColorList */
+		SELECT COLOR_CD
+		     , COLOR_ENM
+		     , COLOR_KNM
+		     , COLOR_FILE
+		     , COLOR_GRP_NM
+		     , USE_YN
+		     /*, FN_GET_USER_NM(REG_NO) AS REG_NM*/
+		     , TO_CHAR(REG_DT, 'YYYYMMDDHH24MISS') AS REG_DT
+		     /*, FN_GET_USER_NM(UPD_NO) AS UPD_NM*/
+		     , TO_CHAR(UPD_DT, 'YYYYMMDDHH24MISS') AS UPD_DT
+		     , GROUP_COLOR_CD
+		FROM TB_COLOR
+		WHERE 1 = 1
+		<if test='colorCd != null and colorCd != ""'>
+		AND COLOR_CD = #{colorCd}
+		</if>
+		<if test='useYn != null and useYn != ""'>
+		AND USE_YN = #{useYn}
+		</if>
+		ORDER BY COLOR_CD
+	</select>
+	
+	<!-- 색상 저장 -->
+	<update id="saveColor" parameterType="Color">
+		/* TsaGoods.saveColor */
+		INSERT INTO TB_COLOR (
+		       COLOR_CD
+		     , COLOR_ENM
+		     , COLOR_KNM
+		     , COLOR_FILE
+		     , COLOR_GRP_NM
+		     , USE_YN
+		     , REG_NO
+		     , REG_DT
+		     , UPD_NO
+		     , UPD_DT
+		)
+		VALUES (
+		       #{colorCd}
+		     , #{colorEnm}
+		     , #{colorKnm}
+		     , #{colorFile}
+		     , #{colorGrpNm}
+		     , #{useYn}
+		     , #{regNo}
+		     , NOW()
+		     , #{updNo}
+		     , NOW()
+		)
+		ON DUPLICATE KEY UPDATE
+		       COLOR_ENM = #{colorEnm}
+		     , COLOR_KNM = #{colorKnm}
+		     , COLOR_FILE = UPPER(#{colorFile})
+		     , COLOR_GRP_NM = UPPER(#{colorGrpNm})
+		     , USE_YN = #{useYn}
+		     , UPD_NO = #{updNo}
+		     , UPD_DT = NOW()
+	</update>
+	
 </mapper>

+ 12 - 2
style24.admin/src/main/java/com/style24/persistence/mybatis/shop/TsaRenderer.xml

@@ -240,8 +240,7 @@
 		     , COLOR_KNM AS CD_DESC
 		     , USE_YN
 		FROM   TB_COLOR
-		WHERE  SUPPLY_COMP_CD = #{supplyCompCd}
-		AND    USE_YN = 'Y'
+		WHERE  USE_YN = 'Y'
 		<if test='colorCd != null and colorCd != ""'>
 		AND    COLOR_CD = #{colorCd}
 		</if>
@@ -351,5 +350,16 @@
 		WHERE  AF_CHANNEL = #{afChannel}
 		AND    USE_YN = 'Y'
 	</select>
+	
+	<!-- 코드설명 목록 -->
+	<select id="getCommonCodeDescList" parameterType="String" resultType="CommonCode">
+		/* TsaRenderer.getCommonCodeDescList */
+		SELECT CD
+			 , CD_DESC AS CD_NM
+		FROM TB_COMMON_CODE
+		WHERE 1=1
+		AND CD_GB = #{cdGb}
+		AND USE_YN = 'Y'
+	</select>
 
 </mapper>

+ 200 - 0
style24.admin/src/main/webapp/WEB-INF/views/goods/ColorForm.html

@@ -0,0 +1,200 @@
+<!DOCTYPE html>
+<html lang="ko"
+	xmlns:th="http://www.thymeleaf.org">
+<!--
+ *******************************************************************************
+ * @source  : ColorForm.html
+ * @desc    : 색상관리 Page
+ *============================================================================
+ * STYLE24
+ * Copyright(C) 2020 TSIT, All rights reserved.
+ *============================================================================
+ * VER  DATE         AUTHOR      DESCRIPTION
+ * ===  ===========  ==========  =============================================
+ * 1.0  2020.10.16   eskim     최초 작성
+ *******************************************************************************
+ -->
+	<div id="main">
+		<!-- 메인타이틀 영역 -->
+		<div class="main-title">
+		</div>
+		<!-- //메인타이틀 영역 -->
+		
+		<!-- 메뉴 설명 -->
+		<div class="infoBox menu-desc">
+		</div>
+		<!-- //메뉴 설명 -->
+		<form id="searchForm" name="searchForm" action="#" th:action="@{'/goods/color/list'}" th:method="post">
+			<div class="panelStyle">
+				<!-- 버튼 배치 영역 -->
+				<ul class="panelBar">
+					<li>
+						<button type="button" class="btn btn-dark btn-sm" id="btnAddRow">행추가</button>
+						<button type="button" class="btn btn-danger btn-sm" id="btnDeleteRow">행삭제</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 groupColorCodeList = gagajf.convertToArray([[${groupColorCodeList}]]);
+	var groupColorCodeNmList = gagajf.convertToArray([[${groupColorCodeNmList}]]);
+
+	// specify the columns
+	// 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: "색상코드", field: "colorCd", width: 100, cellClass: 'text-center',
+			editable : function(params){return params.data.crud=='C' ? true : false;},
+			cellEditor: 'textCellEditor',
+			cellEditorParams: { maxlength: 2, required: true, onblur: '$(this).val($(this).val().toUpperCase())' }
+		},
+		{headerName: "색상영문명", field: "colorEnm", width: 200, cellClass: 'text-left',
+			cellEditor: 'textCellEditor',
+			cellEditorParams: { maxlength: 50, required: true }
+		},
+		{headerName: "색상국문명", field: "colorKnm", width: 200, cellClass: 'text-left',
+			cellEditor: 'textCellEditor',
+			cellEditorParams: { maxlength: 50, required: true }
+		},
+		{headerName: "RGB색상코드", field: "colorGrpFile", width: 100, cellClass: 'text-center',
+			cellEditor: 'textCellEditor',
+			cellEditorParams: { maxlength: 7, required: true, onblur: '$(this).val($(this).val().toUpperCase())' }
+		},
+		{headerName: "색상", width: 60, cellClass: 'text-center', editable: false,
+			cellStyle : function(params){
+				return { 'background-color': params.data.colorGrpFile};
+			}
+		},
+		{headerName: "그룹색상명", field: "groupColorCd", width: 180, cellClass: 'text-left',
+			cellEditor: 'agRichSelectCellEditor',
+			cellEditorParams: { values: gagaAgGrid.extractValues(groupColorCodeList), required: true },
+			valueFormatter: function (params) { return gagaAgGrid.lookupValue(groupColorCodeNmList, params.value); }
+		},
+		{headerName: "그룹색상", width: 80, cellClass: 'text-center', editable: false,
+			cellStyle : function(params){
+				return { 'background-color': gagaAgGrid.lookupValue(groupColorCodeList, params.data.groupColorCd)};
+			}
+		},
+		{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 = { itemkindCd: null, itemkindNm: null, itemkindEnm: null, erpItemkindCd: null, useYn: "Y" };
+		gagaAgGrid.addRowData(gridOptions, data, "itemkindCd");
+	});
+
+	// 저장
+	$('#btnSave').on('click', function() {
+		// 변경된 데이터
+		var changedData = gridOptions.api.getSelectedRows();
+
+		if (changedData.length == 0) {
+			mcxDialog.alert('선택된 데이터가 없습니다.');
+			return;
+		}
+
+		// Validation
+		if (!gagaAgGrid.validation(gridOptions, changedData))
+			return;
+
+		// 숫자 확인
+		var optCheck = false;
+		$.each(changedData, function(idx, item) {
+
+			if (item.colorGrpFile.indexOf("#") !=0 ) {
+				optCheck = true;
+				mcxDialog.alertC("RGB색상코드는 #으로 시작해주세요.", {
+					sureBtnText: "확인",
+					sureBtnClick: function() {
+						gridOptions.api.setFocusedCell(idx, "colorGrpFile", null);
+					}
+				});
+				return false;
+			}
+			if (item.colorGrpFile.length != 7 ) {
+				optCheck = true;
+				mcxDialog.alertC("RGB색상코드는 #포함 7자리로 입력해주세요.", {
+					sureBtnText: "확인",
+					sureBtnClick: function() {
+						gridOptions.api.setFocusedCell(idx, "colorGrpFile", null);
+					}
+				});
+				return false;
+			}
+
+		});
+
+		if(optCheck) {
+			return false;
+		}
+
+		mcxDialog.confirm('저장하시겠습니까?', {
+			cancelBtnText: "취소",
+			sureBtnText: "확인",
+			sureBtnClick: function(){
+				var jsonData = JSON.stringify(changedData);
+				gagajf.ajaxJsonSubmit('/goods/color/save', jsonData, 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>

+ 7 - 6
style24.admin/src/main/webapp/WEB-INF/views/goods/ItemkindBaseForm.html

@@ -152,18 +152,19 @@
 
 	});
 
+	// 조회
+	var fnSearch = function() {
+		var formId = "#searchForm";
+		gagaAgGrid.fetch($(formId).prop('action'), gridOptions, formId);
+	}
+	
 	$(document).ready(function() {
 		// Create a agGrid
 		gagaAgGrid.createGrid('gridList', gridOptions);
 		
 		fnSearch();
 	});
-
-	var fnSearch = function() {
-		var formId = "#searchForm";
-		gagaAgGrid.fetch($(formId).prop('action'), gridOptions, formId);
-	}
-
+	
 /*]]>*/
 </script>