Просмотр исходного кода

상품상세 옵션재고탭 작업

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

+ 10 - 9
style24.admin/src/main/java/com/style24/admin/biz/dao/TsaGoodsDao.java

@@ -12,6 +12,7 @@ import com.style24.persistence.domain.GoodsNotiInfo;
 import com.style24.persistence.domain.GoodsSearch;
 import com.style24.persistence.domain.Itemkind;
 import com.style24.persistence.domain.NotiInfo;
+import com.style24.persistence.domain.Option;
 
 import com.gagaframework.web.parameter.GagaMap;
 
@@ -163,15 +164,15 @@ public interface TsaGoodsDao {
 	 */
 	Collection<GoodsHst> getGoodsHstList(Goods goods);
 
-//	/**
-//	 * 상품 옵션 조회
-//	 *
-//	 * @param goods
-//	 * @return
-//	 * @author eskim
-//	 * @since 2019. 08. 14
-//	 */
-//	Collection<TsaStock> getGoodsSizeList(TsaGoods goods);
+	/**
+	 * 상품 옵션 조회
+	 *
+	 * @param goods
+	 * @return
+	 * @author eskim
+	 * @since 2020. 10. 26
+	 */
+	Collection<Option> getGoodsSizeList(Goods goods);
 
 
 	/**

+ 12 - 11
style24.admin/src/main/java/com/style24/admin/biz/service/TsaGoodsService.java

@@ -23,6 +23,7 @@ import com.style24.persistence.domain.GoodsNotiInfo;
 import com.style24.persistence.domain.GoodsSearch;
 import com.style24.persistence.domain.Itemkind;
 import com.style24.persistence.domain.NotiInfo;
+import com.style24.persistence.domain.Option;
 import com.style24.persistence.domain.SearchData;
 
 import lombok.extern.slf4j.Slf4j;
@@ -389,17 +390,17 @@ public class TsaGoodsService {
 		return goodsDao.getGoodsHstList(goods);
 	}
 
-//	/**
-//	 * 상품 옵션 조회
-//	 *
-//	 * @param goods
-//	 * @return
-//	 * @author eskim
-//	 * @since 2019. 12. 12
-//	 */
-//	public Collection<TsaStock> getGoodsSizeList(TsaGoods goods) {
-//		return goodsDao.getGoodsSizeList(goods);
-//	}
+	/**
+	 * 상품 옵션 조회
+	 *
+	 * @param goods
+	 * @return
+	 * @author eskim
+	 * @since 2020. 10. 26
+	 */
+	public Collection<Option> getGoodsSizeList(Goods goods) {
+		return goodsDao.getGoodsSizeList(goods);
+	}
 
 	/**
 	 * 상품 정보고시 조회

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

@@ -594,28 +594,27 @@ public class TsaGoodsController extends TsaBaseController {
 		return goodsService.getGoodsHstList(goods);
 	}
 
-//	/**
-//	 * 컬러 옵셥 재고
-//	 *
-//	 * @param goods
-//	 * @return
-//	 * @author eskim
-//	 * @since 2019. 12. 12
-//	 */
-//	@PostMapping("/detail/sizeStock/form")
-//	public ModelAndView getGoodsDetailSizeStockForm(Goods goods) {
-//
-//		ModelAndView mav = new ModelAndView();
-//		mav.addObject("goods", goodsService.getGoods(goods));
-//		mav.addObject("goodsSizeList", goodsService.getGoodsSizeList(goods));
-//		// mav.addObject("params", goodsService.getGoods(goods));
-//		// 사용여부
-//		mav.addObject("useYnList", rendererService.getAvailCommonCodeList("G002"));
-//
-//		mav.setViewName("goods/GoodsDetailSizeStockForm");
-//
-//		return mav;
-//	}
+	/**
+	 * 컬러 옵셥 재고
+	 *
+	 * @param goods
+	 * @return
+	 * @author eskim
+	 * @since 2020. 10. 26
+	 */
+	@PostMapping("/detail/sizeStock/form")
+	public ModelAndView getGoodsDetailSizeStockForm(Goods goods) {
+
+		ModelAndView mav = new ModelAndView();
+		mav.addObject("goods", goodsService.getGoods(goods));
+		mav.addObject("goodsSizeList", goodsService.getGoodsSizeList(goods));
+		// 사용여부
+		mav.addObject("useYnList", rendererService.getAvailCommonCodeList("G002"));
+
+		mav.setViewName("goods/GoodsDetailSizeStockForm");
+
+		return mav;
+	}
 
 	/**
 	 * 상품 정보고시 조회
@@ -926,4 +925,5 @@ public class TsaGoodsController extends TsaBaseController {
 		return result;
 	}
 
+
 }

+ 45 - 0
style24.admin/src/main/java/com/style24/persistence/domain/GoodsCompose.java

@@ -0,0 +1,45 @@
+package com.style24.persistence.domain;
+
+import com.style24.persistence.TscBaseDomain;
+
+import lombok.Data;
+
+/**
+ * 상품 세트/딜 구성상품
+ *
+ * @author eskim
+ * @since 2020. 06. 11
+ */
+@SuppressWarnings("serial")
+@Data
+public class GoodsCompose extends TscBaseDomain {
+
+	private String goodsCd;
+	private String goodsType;
+	private String goodsTypeNm;
+	private String compsGoodsCd;
+	private int dispOrd;
+	private int qty;
+	private int compsCurrPrice;
+	private String compsGoodsOptNm;
+	private String baseYn;
+	private String useYn;
+
+	private int currPrice;
+	private int goodsStat;
+	private String imgPath1;
+	private String imgPath6;
+	private String imgType;
+	private String crud;
+	private String compsGoodsCdNm;
+
+//	private String optionTitle;
+//	private String optionNm;
+//	private String optionInfo;
+//	private String setDetail;
+//	private int level;
+
+	private String selfGoodsYn;
+	private String supplyCompCd;
+
+}

+ 35 - 0
style24.admin/src/main/java/com/style24/persistence/domain/Option.java

@@ -0,0 +1,35 @@
+package com.style24.persistence.domain;
+
+import com.style24.persistence.TscBaseDomain;
+
+import lombok.Data;
+
+/**
+ * 상품 재고 Domain
+ *
+ * @author eskim
+ * @since 2020. 10. 26
+ */
+@SuppressWarnings("serial")
+@Data
+public class Option extends TscBaseDomain {
+
+	private String goodsCd;
+	private String optCd;
+	private String optNm;
+	private String optNm1;
+	private String optNm2;
+	private int baseStockQty;
+	private int currStockQty;
+	private int addPrice;
+	private String soldoutYn;
+	private String dispOrd;
+	private String dispYn;
+
+	private int rnum;
+	private int rcount;
+	private int saleStockQty;
+	private int ableStockQty;
+	private String compsGoodsCd;
+
+}

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

@@ -1168,4 +1168,49 @@
 		ORDER BY A.DISP_ORD
 	</select>
 	
+	<!-- 상품 사이즈 조회 -->
+	<select id="getGoodsSizeList" parameterType="Goods" resultType="Option">
+		/* TsaGoods.getGoodsSizeList */
+		WITH RECURSIVE TMP_GOODS AS (
+		    SELECT A.GOODS_CD 
+		         , A.GOODS_TYPE 
+		         , IFNULL(B.COMPS_GOODS_CD, A.GOODS_CD) AS COMPS_GOODS_CD
+		         , IFNULL(B.DISP_ORD,1) AS DISP_ORD
+		         , A.SELF_GOODS_YN
+		    FROM TB_GOODS A 
+		    LEFT OUTER JOIN TB_GOODS_COMPOSE B ON A.GOODS_CD = B.GOODS_CD
+		    WHERE A.GOODS_CD = #{goodsCd}
+		    )
+		SELECT #{goodsCd} AS GOODS_CD
+		     , A.GOODS_CD AS COMPS_GOODS_CD
+		     , A.OPT_CD
+		     , A.OPT_NM1
+		     , A.OPT_NM2
+		     , A.BASE_STOCK_QTY
+		     , A.CURR_STOCK_QTY
+		     , IFNULL(B.STOCK_QTY,0) AS SALE_STOCK_QTY
+		     , GREATEST(GREATEST(A.CURR_STOCK_QTY - A.BASE_STOCK_QTY, 0) - IFNULL(B.STOCK_QTY, 0), 0) AS ABLE_STOCK_QTY
+		     , A.SOLDOUT_YN
+		     , A.DISP_ORD
+		     , COUNT(*) OVER(PARTITION BY A.GOODS_CD ) AS RCOUNT
+		     , ROW_NUMBER() OVER(PARTITION BY A.GOODS_CD ORDER BY A.DISP_ORD) AS RNUM
+		FROM  TMP_GOODS C 
+		INNER JOIN TB_OPTION A ON C.COMPS_GOODS_CD = A.GOODS_CD 
+		LEFT OUTER JOIN (
+		                 SELECT Z.GOODS_CD
+		                      , Z.OPT_CD
+		                      , SUM((CASE Z.SELL_GB WHEN '10' THEN 1
+		                                            WHEN '20' THEN 1
+		                                            ELSE -1 END) * Z.SELL_QTY) AS STOCK_QTY
+		                 FROM TB_SELL_QTY Z
+		                 INNER JOIN TMP_GOODS Y ON Z.GOODS_CD = Y.COMPS_GOODS_CD
+		                 GROUP BY Z.GOODS_CD, Z.OPT_CD
+		                ) B
+		           ON (  A.GOODS_CD = B.GOODS_CD
+		             AND A.OPT_CD = B.OPT_CD)
+		WHERE 1 = 1
+		AND C.GOODS_CD = #{goodsCd}
+		ORDER BY C.DISP_ORD, A.DISP_ORD
+	</select>
+	
 </mapper>

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

@@ -880,7 +880,7 @@
 			params.erpPriceLinkYn = result.erpPriceLinkYn;
 
 			//옵셥 재고(ajax html)
-			//fnGoodsDetailSizeStockSearch(params);
+			fnGoodsDetailSizeStockSearch(params);
 			//정보고시
 			fnGoodsDetailNotiInfoSearch(params);
 			//코디상품

+ 132 - 0
style24.admin/src/main/webapp/WEB-INF/views/goods/GoodsDetailSizeStockForm.html

@@ -0,0 +1,132 @@
+<!DOCTYPE html>
+<html lang="ko"
+	xmlns:th="http://www.thymeleaf.org">
+<!--
+ *******************************************************************************
+ * @source  : GoodsSizeStockForm.html
+ * @desc    : 상품 옵셥/재고 화면
+ *============================================================================
+ * SISUN
+ * Copyright(C) 2020 TSIT, All rights reserved.
+ *============================================================================
+ * VER  DATE         AUTHOR      DESCRIPTION
+ * ===  ===========  ==========  =============================================
+ * 1.0  2020.10.26   eskim       수정
+ *******************************************************************************
+ -->
+	<table class="frmStyle">
+		<colgroup>
+			<col width="8%"/>
+			<col width="8%"/>
+			<col width="10%"/>
+			<col width="15%"/>
+			<col width="16%"/>
+			<col width="5%"/>
+			<col width="5%"/>
+			<col width="7%"/>
+			<col width="7%"/>
+			<col width="7%"/>
+			<col width="7%"/>
+			<col width="5%"/>
+		</colgroup>
+		<tr th:if="${goods.selfGoodsYn == 'Y' and goods.goodsType == 'G056_N'}">
+			<th colspan="2">ERP재고연동여부<i class="star"></i></th>
+			<td colspan="2">
+				<label class="rdoBtn"><input type="radio" name="erpStockLinkYn" id="erpStockLinkYnY" value="Y" th:checked="${goods.erpStockLinkYn == 'Y'}"/>Y</label>
+				<label class="rdoBtn"><input type="radio" name="erpStockLinkYn" id="erpStockLinkYnN" value="N" th:checked="${goods.erpStockLinkYn == 'N'}"/>N</label>
+				<input type="hidden" id="erpStockLinkYnOrg" name="erpStockLinkYnOrg" th:value="${goods.erpStockLinkYn}"/>
+			</td>
+			<td colspan="8"></td>
+		</tr>
+		<th:block th:if="${goods.selfGoodsYn == 'N' or goods.goodsType != 'G056_N'}">
+			<input type="hidden" id="erpStockLinkYnOrg" name="erpStockLinkYnOrg" th:value="${goods.erpStockLinkYn}"/>
+			<input type="hidden" id="erpStockLinkYn" name="erpStockLinkYn"  th:value="${goods.erpStockLinkYn}"/>
+		</th:block>
+		<tr>
+			<th>상품코드</th>
+			<th>사이즈</th>
+			<th>사이즈명</th>
+			<th>옵션1</th>
+			<th>옵션2</th>
+			<th>노출순서</th>
+			<th>노출여부</th>
+			<th>가용재고</th>
+			<th>안전재고</th>
+			<th>출고대기</th>
+			<th>판매가능재고</th>
+			<th>품절여부</th>
+		</tr>
+		<tbody id="optionList" >
+		<th:block th:each="goodsSize, sizeStatus : ${goodsSizeList}">
+		<tr>
+			<td th:rowspan="${goodsSize.rcount}" th:text="${goodsSize.compsGoodsCd}" th:if="${goodsSize.rnum == 1}"></td>
+			<td><th:block th:text="${goodsSize.optCd}"></th:block><input type="hidden" name="optCd" th:value="${goodsSize.optCd}" />
+				<input type="hidden" name="compsGoodsCd" th:value="${goodsSize.compsGoodsCd}" />
+			</td>
+			<td><th:block th:text="${goodsSize.optNm}"></th:block>
+				<input type="hidden" name="hidOptNm" th:value="${goodsSize.optNm}" />
+			</td>
+			<td><input type="text" class="w100p aL" name="optNm1" th:value="${goodsSize.optNm1}"  maxlength="70" th:disabled="${goods.selfGoodsYn == 'Y'}"/>
+				<input type="hidden" name="hidOptNm1" th:value="${goodsSize.optNm1}" />
+			</td>
+			<td><input type="text" class="w100p aL" name="optNm2" th:value="${goodsSize.optNm2}"  maxlength="70" th:disabled="${goods.selfGoodsYn == 'Y'}"/>
+				<input type="hidden" name="hidOptNm2" th:value="${goodsSize.optNm2}" />
+			</td>
+			<td><input type="text" class="w100p aC" name="dispOrd" th:value="${goodsSize.dispOrd}"  maxlength="10" data-valid-type="integer"/>
+				<input type="hidden" name="hidDispOrd" th:value="${goodsSize.dispOrd}" />
+			</td>
+			<td><select name="dispYn">
+					<option th:if="${useYnList}" th:each="oneData, status : ${useYnList}" th:value="${oneData.cd}" th:text="${oneData.cdNm}" th:selected="${goodsSize.dispYn == oneData.cd}"></option>
+				</select>
+				<input type="hidden" name="hidDispYn" th:value="${goodsSize.dispYn}"/>
+			</td>
+			<td><input type="text" class="w100p aC" name="editCurrStockQty" th:value="${goodsSize.currStockQty}" maxlength="10" data-valid-type="numeric" th:disabled="${goods.selfGoodsYn == 'Y'}"/>
+				<input type="hidden" name="currStockQty" th:value="${goodsSize.currStockQty}"/>
+			</td>
+			<td><input type="text" class="w100p aC"  name=baseStockQty th:value="${goodsSize.baseStockQty}" maxlength="10" data-valid-type="integer">
+				<input type="hidden" name="hidBaseStockQty" th:value="${goodsSize.baseStockQty}"/>
+			</td>
+			<td><input type="text" class="w100p aC" name="saleStockQty" th:value="${goodsSize.saleStockQty}" maxlength="10" data-valid-type="numeric" th:disabled="disabled"/>
+			</td>
+			<td><input type="text" class="w100p aC"  name="ableStockQty" maxlength="10" data-valid-type="numeric" th:disabled="disabled" th:value="${goodsSize.ableStockQty}" /></td>
+			<td><select name="soldoutYn">
+					<option th:if="${useYnList}" th:each="oneData, status : ${useYnList}" th:value="${oneData.cd}" th:text="${oneData.cdNm}" th:selected="${goodsSize.soldoutYn == oneData.cd}"></option>
+				</select>
+				<input type="hidden" name="hidSoldoutYn" th:value="${goodsSize.soldoutYn}"/>
+			</td>	
+		</tr>
+		</th:block>
+	</table>
+<script th:inline="javascript">
+/*<![CDATA[*/
+	
+	$(document).ready(function() {
+		
+		//옵션/재곡 변경여부
+		$('#goodsDetailForm').find('#goodstab2').find("input, select, textarea").on('change', function() {
+			$('#goodsDetailForm').find('.tabs .tabsNav li:eq(1) a').attr("style", "color:red;");
+		});
+		
+	});
+	
+	//ERP재고연동여부 변경시
+	/* $('#goodsDetailForm input:radio[name=erpStockLinkYn]').click(function() {
+		
+		if ( $('#goodsDetailForm input[name=erpStockLinkYn]:checked').val() == "Y"){
+			
+			$('#goodsDetailForm input[name=editCurrStockQty]').prop("disabled", true);
+			$('#goodsDetailForm input[name=editCurrStockQty]').attr("disabled", true);
+			$('#goodsDetailForm input[name=editCurrStockQty]').addClass("formControl");
+			
+		}else{
+			$('#goodsDetailForm input[name=editCurrStockQty]').prop("disabled", false);
+			$('#goodsDetailForm input[name=editCurrStockQty]').attr("disabled", false);
+			$('#goodsDetailForm input[name=editCurrStockQty]').removeClass("formControl");
+		}
+		
+	}); */
+	
+	
+/*]]>*/
+</script>
+</html>