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

+ 499 - 0
style24.scm/src/main/java/com/style24/persistence/mybatis/shop/TssStock.xml

@@ -0,0 +1,499 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.style24.scm.biz.dao.TssStockDao">
+	
+	<!-- 상품 목록 조건 정보 -->
+	<sql id="getGoodsListCondition_sql">
+		        <if test='conditionList != null and conditionList.length>0'>
+		            <choose>
+		              <when test='search != null and search == "searchGoodsCd"'>
+		        AND (
+		              <foreach collection="conditionList" item="item" index="index" separator="or">
+		               UPPER(G.GOODS_CD) LIKE CONCAT('%',UPPER(#{item}),'%') 
+		              </foreach>
+		             )
+		              </when>
+		              <when test='search != null and search == "searchGoodsNum"'>
+		        AND (
+		              <foreach collection="conditionList" item="item" index="index" separator="or">
+		               UPPER(G.GOODS_NUM) LIKE CONCAT('%',UPPER(#{item}),'%')
+		              </foreach>
+		             )
+		              </when>
+		              <when test='search != null and search == "searchSupplyGoodsCd"'>
+		        AND (
+		              <foreach collection="conditionList" item="item" index="index" separator="or">
+		               UPPER(G.SUPPLY_GOODS_CD) LIKE CONCAT('%',UPPER(#{item}),'%')
+		              </foreach>
+		             )
+		              </when>
+		              <when test='search != null and search == "searchExtendGoodsCd"'>
+		        AND 1 = 1
+		              </when>
+		              <when test='search != null and search == "searchMasterGoodsCd"'>
+		        AND 1 = 1
+		              </when>
+		              <otherwise>
+		        AND UPPER(G.REG_ID) LIKE CONCAT('%',UPPER(#{item}),'%')
+		              </otherwise>
+		            </choose>
+		        </if>
+		        <if test="goodsCd != null and goodsCd != ''">
+		        AND UPPER(G.GOODS_CD) LIKE CONCAT('%',UPPER(#{goodsCd}),'%')
+		        </if>
+		         <if test="goodsNm != null and goodsNm != ''">
+		        AND UPPER(G.GOODS_NM) LIKE CONCAT('%',UPPER(#{goodsNm}),'%')
+		        </if>
+		        <if test="goodsType != null and goodsType != ''">
+		        AND G.GOODS_TYPE = #{goodsType}
+		        </if>
+		        <if test="supplyCompCd != null and supplyCompCd != ''">
+		        AND G.SUPPLY_COMP_CD = #{supplyCompCd}
+		        </if>
+		        <if test="brandCd != null and brandCd != ''">
+		        AND G.BRAND_CD = #{brandCd}
+		        </if>
+		        <if test="multiBrand != null and multiBrand != ''">
+		        AND G.BRAND_CD IN
+		            <foreach collection="multiBrand" item="item" index="index"  open="(" close=")" separator=",">
+		        #{item}
+		            </foreach>
+		        </if>
+		        <if test="selfMallYn != null and selfMallYn != ''">
+		        AND G.SELF_MALL_YN = #{selfMallYn}
+		        </if>
+		        <if test="itemkindCd != null and itemkindCd != ''">
+		        AND G.ITEMKIND_CD = #{itemkindCd}
+		        </if>
+		        <if test="multiItemkindCd != null and multiItemkindCd != ''">
+		        AND G.ITEMKIND_CD IN
+		            <foreach collection="multiItemkindCd" item="item" index="index"  open="(" close=")" separator=",">
+		        #{item}
+		            </foreach>
+		        </if>
+		        <if test="goodsStat != null and goodsStat != ''">
+		        AND G.GOODS_STAT = #{goodsStat}
+		        </if>
+		        <if test="multiGoodsStat != null and multiGoodsStat != ''">
+		        AND G.GOODS_STAT IN
+		            <foreach collection="multiGoodsStat" item="item" index="index"  open="(" close=")" separator=",">
+		        #{item}
+		            </foreach>
+		        </if>
+		        <if test="styleYear != null and styleYear != ''">
+		        AND G.STYLE_YEAR = (SELECT CD_NM FROM TB_COMMON_CODE WHERE CD = #{styleYear} AND CD_GB='G023')
+		        </if>
+		        <if test="multiStyleYear != null and multiStyleYear != ''">
+		        AND G.STYLE_YEAR IN (SELECT CD_NM 
+		                             FROM TB_COMMON_CODE 
+		                             WHERE CD_GB='G023' 
+		                             AND CD IN 
+		                             <foreach collection="multiStyleYear" item="item" index="index"  open="(" close=")" separator=",">
+		                             #{item}
+		                             </foreach>
+		                             )
+		        </if>
+		        <if test="seasonCd != null and seasonCd != ''">
+		        AND G.SEASON_CD = #{seasonCd}
+		        </if>
+		        <if test="multiSeasonCd != null and multiSeasonCd != ''">
+		        AND G.SEASON_CD IN
+		            <foreach collection="multiSeasonCd" item="item" index="index"  open="(" close=")" separator=",">
+		        #{item}
+		            </foreach>
+		        </if>
+		        <if test="sexGb != null and sexGb != ''">
+		        AND G.SEX_GB = #{sexGb}
+		        </if>
+		        <if test="changeableYn != null and changeableYn != ''">
+		        AND G.CHANGEABLE_YN = #{changeableYn}
+		        </if>
+		        <if test="returnableYn != null and returnableYn != ''">
+		        AND G.RETURNABLE_YN = #{returnableYn}
+		        </if>
+		        <if test="returnFeeFreeYn != null and returnFeeFreeYn != ''">
+		        AND G.RETURN_FEE_FREE_YN = #{returnFeeFreeYn}
+		        </if>
+		        <if test="changeFeeFreeYn != null and changeFeeFreeYn != ''">
+		        AND G.CHANGE_FEE_FREE_YN = #{changeFeeFreeYn}
+		        </if>
+		        <if test="formalGb != null and formalGb != ''">
+		        AND G.FORMAL_GB = #{formalGb}
+		        </if>
+		        <if test='soldOutYn != null and soldOutYn == "Y"'>
+		        AND EXISTS (
+		                    SELECT GOODS_CD 
+		                    FROM VW_STOCK
+		                    WHERE SOLDOUT_YN = 'Y'
+		                    AND GOODS_CD = G.GOODS_CD
+		                   )
+		        </if>
+		        <if test='soldOutYn != null and soldOutYn == "N"'>
+		        AND NOT EXISTS (
+		                    SELECT GOODS_CD 
+		                    FROM VW_STOCK
+		                    WHERE SOLDOUT_YN = 'Y'
+		                    AND GOODS_CD = G.GOODS_CD
+		                   )
+		        </if>
+		        <if test="erpStockLinkYn != null and erpStockLinkYn != ''">
+		        AND G.ERP_STOCK_LINK_YN = #{erpStockLinkYn}
+		        </if>
+		        <if test="erpPriceLinkYn != null and erpPriceLinkYn != ''">
+		        AND G.ERP_PRICE_LINK_YN = #{erpPriceLinkYn}
+		        </if>
+		        <if test="mdNo != null and mdNo != ''">
+		        AND G.BRAND_CD IN (
+		            SELECT DISTINCT BRAND_CD
+		            FROM   TB_BRAND_MD
+		            WHERE  MD_NO = CAST(#{mdNo} AS UNSIGNED)
+		        )
+		        </if>
+		        <if test="currPriceSt != null and currPriceSt != ''">
+		        AND G.CURR_PRICE >= #{currPriceSt}
+		        </if>
+		        <if test="currPriceEd != null and currPriceEd != ''">
+		        <![CDATA[
+		        AND G.CURR_PRICE <= #{currPriceEd}
+		         ]]>
+		        </if>
+		        <if test="dcRateSt != null and dcRateSt != ''">
+		        AND G.DC_RATE >= #{dcRateSt}
+		        </if>
+		        <if test="dcRateEd != null and dcRateEd != ''">
+		        <![CDATA[
+		        AND G.DC_RATE <= #{dcRateEd}
+		        ]]>
+		        </if>
+		        <if test='dateGbn != null and dateGbn == "P"'>
+		            <if test="stDate != null and stDate != ''">
+		        AND G.PRICE_UPD_DT >= DATE_FORMAT(#{stDate}, '%Y-%m-%d %H:%i:%S')
+		            </if>
+		            <if test="edDate != null and edDate != ''">
+		            <![CDATA[
+		        AND G.PRICE_UPD_DT < DATE_FORMAT(DATE_ADD(#{edDate}, INTERVAL 1 DAY), '%Y-%m-%d %H:%i:%S')
+		            ]]>
+		            </if>
+		        </if>
+		        <if test='dateGbn != null and dateGbn == "R"'>
+		            <if test="stDate != null and stDate != ''">
+		        AND G.REG_DT >= DATE_FORMAT(#{stDate}, '%Y-%m-%d %H:%i:%S')
+		            </if>
+		            <if test="edDate != null and edDate != ''">
+		            <![CDATA[
+		        AND G.REG_DT < DATE_FORMAT(DATE_ADD(#{edDate}, INTERVAL 1 DAY), '%Y-%m-%d %H:%i:%S')
+		            ]]>
+		            </if>
+		        </if>
+		        <if test='dateGbn != null and dateGbn == "S"'>
+		            <if test="stDate != null and stDate != ''">
+		        AND G.FRST_CFRM_DT >= DATE_FORMAT(#{stDate}, '%Y-%m-%d %H:%i:%S')
+		            </if>
+		            <if test="edDate != null and edDate != ''">
+		            <![CDATA[
+		        AND G.FRST_CFRM_DT < DATE_FORMAT(DATE_ADD(#{edDate}, INTERVAL 1 DAY), '%Y-%m-%d %H:%i:%S')
+		            ]]>
+		            </if>
+		        </if>
+		        <if test="stockQtySt != null and stockQtySt != ''">
+		        AND ST.CURR_STOCK_QTY >= #{stockQtySt}
+		        </if>
+		        <if test="stockQtyEd != null and stockQtyEd != ''">
+		        <![CDATA[
+		        AND ST.CURR_STOCK_QTY <= #{stockQtyEd}
+		        ]]>
+		        </if>
+		        <if test="ageGrpCd != null and ageGrpCd != ''">
+		        AND G.AGE_GRP_CD = #{ageGrpCd}
+		        </if>
+		        <if test="cateCd != null and cateCd != ''">
+		        AND G.GOODS_CD IN (
+		            SELECT GOODS_CD
+		            FROM   TB_CATEGORY_GOODS
+		            WHERE  CATE_CD = #{cateCd}
+		        )
+		        </if>
+	</sql>
+	
+	<!-- 목록 페이징 정보 -->
+	<sql id="getListPagingCondition_sql">
+		<choose>
+		<when test="pageable != null">
+		    ) A
+		    JOIN ( SELECT @rownum := 0) R
+		)Z WHERE RNUM BETWEEN  #{pageable.startRow} AND #{pageable.endRow}
+		</when>
+		<otherwise>
+		    ) A
+		    JOIN ( SELECT @rownum := 0) R
+		)Z
+		</otherwise>
+		</choose>
+	</sql>
+	
+	<!-- 상품 사이즈별 재고 현황 목록 건수 -->
+	<select id="getGoodsSizeStockCount" parameterType="GoodsSearch" resultType="int">
+		/* TsaStock.getGoodsSizeStockCount */
+		SELECT COUNT(*) AS TOTCNT
+		FROM (
+		      SELECT Y.*
+		      FROM (
+		            SELECT G.GOODS_CD
+		                 , ST.OPT_CD
+		                 , GREATEST(GREATEST(ST.CURR_STOCK_QTY - ST.BASE_STOCK_QTY, 0) - IFNULL(SQ.STOCK_QTY, 0), 0) AS STOCK_QTY
+		            FROM TB_GOODS G
+		            INNER JOIN TB_BRAND B ON G.BRAND_CD = B.BRAND_CD
+		            INNER JOIN TB_SUPPLY_COMPANY S ON G.SUPPLY_COMP_CD = S.SUPPLY_COMP_CD
+		            INNER JOIN TB_OPTION ST ON G.GOODS_CD = ST.GOODS_CD
+		            <if test="searchGb == null or searchGb =='BASIC'">
+		                                    <if test="optCd1 == null or optCd1 != ''">
+		                                    AND ST.OPT_CD1 = #{optCd1}
+		                                    </if>
+		                                    <if test="optCd2 == null or optCd2 != ''">
+		                                    AND ST.OPT_CD2 = #{optCd2}
+		                                    </if>
+		            </if>
+		            LEFT OUTER JOIN  (SELECT GOODS_CD,
+		                                     OPT_CD,
+		                                     SUM((CASE SELL_GB WHEN '10' THEN 1
+		                                                       WHEN '20' THEN -1
+		                                           END) * SELL_QTY) AS STOCK_QTY
+		                              FROM TB_SELL_QTY
+		                              GROUP BY GOODS_CD, OPT_CD
+		                              ) SQ
+		                           ON (    ST.GOODS_CD = SQ.GOODS_CD
+		                               AND ST.OPT_CD = SQ.OPT_CD
+		                              )
+		            <if test="searchGb != null and searchGb =='EXCEL' ">
+		            INNER JOIN (
+		                        SELECT SEARCH_CD
+		                             , TMP_DISP_ORD
+		                        FROM (
+		                              SELECT SEARCH_CD
+		                                   , MIN(DISP_ORD) AS TMP_DISP_ORD
+		                              FROM TB_SEARCH_DATA
+		                              WHERE REG_NO = #{regNo}
+		                              GROUP BY SEARCH_CD) T
+		                      ) SD
+		                   ON ( (G.GOODS_CD LIKE CONCAT(SD.SEARCH_CD,'%')
+		                        OR G.SUPPLY_GOODS_CD LIKE CONCAT(SD.SEARCH_CD,'%')) 
+		                        <if test="mdNo != null and mdNo != ''">
+		                        AND G.BRAND_CD IN (
+		                                           SELECT DISTINCT BRAND_CD
+		                                           FROM TB_BRAND_MD
+		                                           WHERE MD_NO = CAST(#{mdNo} AS UNSIGNED)
+		                                           )
+		                       </if>
+		                   )
+		            </if>
+		            <if test="searchGb != null and searchGb =='EXCELRESULT'">
+		            INNER JOIN (
+		                        SELECT SEARCH_CD
+		                             , TMP_DISP_ORD
+		                             , OPT_CD
+		                        FROM (
+		                              SELECT SEARCH_CD
+		                                   , DUMMY1 AS OPT_CD
+		                                   , MIN(DISP_ORD) AS TMP_DISP_ORD
+		                              FROM TB_SEARCH_DATA
+		                              WHERE REG_NO = #{regNo}
+		                              GROUP BY SEARCH_CD, DUMMY1) T
+		                      ) SD
+		                   ON ( (G.GOODS_CD LIKE CONCAT(SD.SEARCH_CD,'%')
+		                        OR G.SUPPLY_GOODS_CD LIKE CONCAT(SD.SEARCH_CD,'%')) 
+		                        <if test="mdNo != null and mdNo != ''">
+		                        AND G.BRAND_CD IN (
+		                                           SELECT DISTINCT BRAND_CD
+		                                           FROM TB_BRAND_MD
+		                                           WHERE MD_NO = CAST(#{mdNo} AS UNSIGNED)
+		                                           )
+		                        </if>
+		                        AND ST.GOODS_CD = SD.SEARCH_CD
+		                        AND ST.OPT_CD = SD.OPT_CD
+		                   )
+		            </if>
+		            WHERE 1=1
+		            AND G.GOODS_TYPE = 'G056_N' /*일반상품만 조회*/
+		            <if test="searchGb == null or searchGb =='BASIC'">
+		            <include refid="getGoodsListCondition_sql"/>
+		            </if>
+		            
+		           ) Y
+		      ) X
+		WHERE 1 = 1
+		<if test="searchGb == null or searchGb =='BASIC'">
+		    <if test="stockQtySt != null and stockQtySt != ''">
+		AND X.STOCK_QTY >= #{stockQtySt}
+		    </if>
+		    <if test="stockQtyEd != null and stockQtyEd != ''">
+		    <![CDATA[
+		AND X.STOCK_QTY <= #{stockQtyEd}
+		    ]]>
+		    </if> 
+		</if>
+	</select>
+
+	<!-- 상품 사이즈별 재고 현황 목록  -->
+	<select id="getGoodsSizeStockList" parameterType="GoodsSearch" resultType="Option">
+		/* TsaStock.getGoodsSizeStockList */
+		<include refid="getGoodsSizeStockList_sql"/>
+	</select>
+	
+	<!-- 사이즈별재고현황 - 엑셀다운로드 -->
+	<select id="getGoodsSizeStockExcelList" parameterType="GoodsSearch" resultType="paramMap">
+		/* TsaStock.getGoodsSizeStockExcelList */
+		<include refid="getGoodsSizeStockList_sql"/>
+	</select>
+	
+	<!--  사이즈별 재고현황 정보 -->
+	<sql id="getGoodsSizeStockList_sql">
+		SELECT Z.*
+		    , (SELECT ITEMKIND_NM FROM TB_ITEMKIND WHERE ITEMKIND_CD = Z.ITEMKIND_CD) AS ITEMKIND_NM
+		    , FN_GET_CODE_NM('G008', Z.GOODS_STAT) AS GOODS_STAT_NM
+		FROM (
+		    SELECT A.*, @rownum := @rownum + 1  RNUM 
+		    FROM (
+		        SELECT  X.GOODS_CD
+		              , X.BRAND_ENM
+		              , X.BRAND_GRP_NM
+		              , X.BRAND_CD
+		              , X.ITEMKIND_CD
+		              , X.SUPPLY_COMP_CD
+		              , X.SUPPLY_GOODS_CD
+		              , X.GOODS_NM
+		              , X.GOODS_STAT
+		              , X.OPT_CD
+		              , X.OPT_CD1
+		              , X.OPT_CD2
+		              , X.SOLDOUT_YN
+		              , X.CURR_STOCK_QTY
+		              , X.BASE_STOCK_QTY
+		              , X.SALE_STOCK_QTY /*출고대기*/
+		              , X.ABLE_STOCK_QTY /*판매가능재고*/
+		              , X.REG_DT
+		        FROM (
+		              
+		                    SELECT
+		                            G.GOODS_CD
+		                          , B.BRAND_ENM
+		                          , B.BRAND_GRP_NM
+		                          , G.BRAND_CD
+		                          , G.ITEMKIND_CD
+		                          , G.SUPPLY_COMP_CD
+		                          , G.SUPPLY_GOODS_CD
+		                          , G.GOODS_NM
+		                          , G.GOODS_STAT
+		                          , ST.OPT_CD
+		                          , ST.OPT_CD1
+		                          , ST.OPT_CD2
+		                          , ST.SOLDOUT_YN
+		                          , ST.CURR_STOCK_QTY
+		                          , ST.BASE_STOCK_QTY
+		                          , NVL(SQ.STOCK_QTY,0) AS SALE_STOCK_QTY
+		                          , GREATEST(GREATEST(ST.CURR_STOCK_QTY - ST.BASE_STOCK_QTY, 0) - IFNULL(SQ.STOCK_QTY, 0), 0) AS ABLE_STOCK_QTY
+		                          , G.REG_DT
+		                    FROM TB_GOODS G
+		                    INNER JOIN TB_BRAND B ON G.BRAND_CD = B.BRAND_CD
+		                    INNER JOIN TB_SUPPLY_COMPANY S ON G.SUPPLY_COMP_CD = S.SUPPLY_COMP_CD
+		                    INNER JOIN TB_OPTION ST ON G.GOODS_CD = ST.GOODS_CD
+		                    <if test="searchGb == null or searchGb =='BASIC'">
+		                                            <if test="optCd1 == null or optCd1 != ''">
+		                                            AND ST.OPT_CD1 = #{optCd1}
+		                                            </if>
+		                                            <if test="optCd2 == null or optCd2 != ''">
+		                                            AND ST.OPT_CD2 = #{optCd2}
+		                                            </if>
+		                    </if>
+		                    LEFT OUTER JOIN  (SELECT GOODS_CD,
+		                                             OPT_CD,
+		                                             SUM((CASE SELL_GB WHEN '10' THEN 1
+		                                                               WHEN '20' THEN -1
+		                                                   END) * SELL_QTY) AS STOCK_QTY
+		                                      FROM TB_SELL_QTY
+		                                      GROUP BY GOODS_CD, OPT_CD
+		                                      ) SQ
+		                                   ON (    ST.GOODS_CD = SQ.GOODS_CD
+		                                       AND ST.OPT_CD = SQ.OPT_CD
+		                                      )
+		                    <if test="searchGb != null and searchGb =='EXCEL'">
+		                    INNER JOIN (
+		                                SELECT SEARCH_CD
+		                                     , TMP_DISP_ORD
+		                                FROM (
+		                                      SELECT SEARCH_CD
+		                                           , MIN(DISP_ORD) AS TMP_DISP_ORD
+		                                      FROM TB_SEARCH_DATA
+		                                      WHERE REG_NO = #{regNo}
+		                                      GROUP BY SEARCH_CD) T
+		                              ) SD
+		                           ON ( (G.GOODS_CD LIKE CONCAT(SD.SEARCH_CD,'%')
+		                                OR G.SUPPLY_GOODS_CD LIKE CONCAT(SD.SEARCH_CD,'%')) 
+		                                <if test="mdNo != null and mdNo != ''">
+		                                AND G.BRAND_CD IN (
+		                                                   SELECT DISTINCT BRAND_CD
+		                                                   FROM TB_BRAND_MD
+		                                                   WHERE MD_NO = CAST(#{mdNo} AS UNSIGNED)
+		                                                   )
+		                               </if>
+		                           )
+		                    </if>
+		                    <if test="searchGb != null and searchGb =='EXCELRESULT'">
+		                    INNER JOIN (
+		                                SELECT SEARCH_CD
+		                                     , TMP_DISP_ORD
+		                                     , OPT_CD
+		                                FROM (
+		                                      SELECT SEARCH_CD
+		                                           , DUMMY1 AS OPT_CD
+		                                           , MIN(DISP_ORD) AS TMP_DISP_ORD
+		                                      FROM TB_SEARCH_DATA
+		                                      WHERE REG_NO = #{regNo}
+		                                      GROUP BY SEARCH_CD, DUMMY1) T
+		                              ) SD
+		                           ON ( (G.GOODS_CD LIKE CONCAT(SD.SEARCH_CD,'%')
+		                                OR G.SUPPLY_GOODS_CD LIKE CONCAT(SD.SEARCH_CD,'%')) 
+		                                <if test="mdNo != null and mdNo != ''">
+		                                AND G.BRAND_CD IN (
+		                                                   SELECT DISTINCT BRAND_CD
+		                                                   FROM TB_BRAND_MD
+		                                                   WHERE MD_NO = CAST(#{mdNo} AS UNSIGNED)
+		                                                   )
+		                               </if>
+		                                AND ST.GOODS_CD = SD.SEARCH_CD
+		                                AND ST.OPT_CD = SD.OPT_CD
+		                           )
+		                    </if>
+		                    WHERE 1=1
+		                    AND G.GOODS_TYPE = 'G056_N' /*일반상품만 조회*/
+		                    <if test="searchGb == null or searchGb =='BASIC'">
+		                    <include refid="getGoodsListCondition_sql"/>
+		                    </if>
+		              ) X
+		        WHERE 1 = 1
+		        <if test="searchGb == null or searchGb =='BASIC'">
+		            <if test="stockQtySt != null and stockQtySt != ''">
+		        AND X.CURR_STOCK_QTY >= #{stockQtySt}
+		            </if>
+		            <if test="stockQtyEd != null and stockQtyEd != ''">
+		            <![CDATA[
+		        AND X.CURR_STOCK_QTY <= #{stockQtyEd}
+		            ]]>
+		            </if>
+		        ORDER BY X.GOODS_CD, X.OPT_CD, X.REG_DT DESC
+		        </if>
+		<include refid="getListPagingCondition_sql"/>
+	</sql>
+	
+	<!-- 상품 사이즈별 품절여부 변경 -->
+	<update id="updateStockSoldOut" parameterType="Option">
+		/* TsaStock.updateStockSoldOut */
+		UPDATE TB_OPTION
+		SET BASE_STOCK_QTY = #{baseStockQty}
+		  , UPD_NO = #{updNo}
+		  , UPD_DT = NOW()
+		  , SOLDOUT_YN = #{soldoutYn}
+		WHERE GOODS_CD = #{goodsCd}
+		AND OPT_CD = #{optCd}
+	</update>
+	
+</mapper>

+ 59 - 0
style24.scm/src/main/java/com/style24/scm/biz/dao/TssStockDao.java

@@ -0,0 +1,59 @@
+package com.style24.scm.biz.dao;
+
+import java.util.Collection;
+
+import com.style24.core.support.annotation.ShopDs;
+import com.style24.persistence.domain.GoodsSearch;
+import com.style24.persistence.domain.Option;
+
+import com.gagaframework.web.parameter.GagaMap;
+
+/**
+ * 재고관리 Dao
+ *
+ * @author eskim
+ * @since 2020. 11. 17
+ */
+@ShopDs
+public interface TssStockDao {
+
+	/**
+	 * 상품 사이즈별 재고 현황 목록 건수
+	 *
+	 * @param goodsSearch
+	 * @return
+	 * @author eskim
+	 * @since 2010. 11. 17
+	 */
+	int getGoodsSizeStockCount(GoodsSearch goodsSearch);
+
+	/**
+	 * 상품 사이즈별 재고 현황 목록
+	 *
+	 * @param goodsSearch
+	 * @return
+	 * @author eskim
+	 * @since 2010. 11. 17
+	 */
+	Collection<Option> getGoodsSizeStockList(GoodsSearch goodsSearch);
+
+	/**
+	 * 사이즈별재고현황 - 엑셀다운로드
+	 *
+	 * @param goodsSearch
+	 * @return
+	 * @author eskim
+	 * @since 2020. 11. 17
+	 */
+	Collection<GagaMap> getGoodsSizeStockExcelList(GoodsSearch goodsSearch);
+
+	/**
+	 * 상품 사이즈별 품절여부 변경
+	 *
+	 * @param stock
+	 * @author eskim
+	 * @since 2020. 11. 17
+	 */
+	void updateStockSoldOut(Option stock);
+
+}

+ 213 - 0
style24.scm/src/main/java/com/style24/scm/biz/service/TssStockService.java

@@ -0,0 +1,213 @@
+package com.style24.scm.biz.service;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StringUtils;
+
+import com.style24.core.support.message.TscMessageByLocale;
+import com.style24.persistence.domain.GoodsSearch;
+import com.style24.persistence.domain.Option;
+import com.style24.persistence.domain.SearchData;
+import com.style24.scm.biz.dao.TssStockDao;
+import com.style24.scm.support.env.TssConstants;
+import com.style24.scm.support.security.session.TssSession;
+
+import lombok.extern.slf4j.Slf4j;
+
+import com.gagaframework.excel.GagaExcelUtil;
+import com.gagaframework.excel.env.GagaExcelConstants;
+import com.gagaframework.web.parameter.GagaMap;
+import com.gagaframework.web.util.GagaFileUtil;
+
+
+/**
+ * 재고관리 Service
+ *
+ * @author eskim
+ * @since 2020. 11. 17
+ */
+@Service
+@Slf4j
+public class TssStockService {
+
+	@Autowired
+	private TscMessageByLocale message;
+
+	@Autowired
+	private TssStockDao stockDao;
+
+	@Autowired
+	private Environment env;
+
+	@Autowired
+	private TssCommonService commonService;
+
+	@Autowired
+	private TssGoodsService goodsService;
+
+	/**
+	 * 상품 사이즈별 재고 현황 목록 건수
+	 *
+	 * @param goodsSearch
+	 * @return
+	 * @author eskim
+	 * @since 2010. 11. 17
+	 */
+	public int getGoodsSizeStockCount(GoodsSearch goodsSearch) {
+		return stockDao.getGoodsSizeStockCount(goodsSearch);
+	}
+
+	/**
+	 * 상품 사이즈별 재고 현황 목록
+	 *
+	 * @param goodsSearch
+	 * @return
+	 * @author eskim
+	 * @since 2010. 11. 17
+	 */
+	public Collection<Option> getGoodsSizeStockList(GoodsSearch goodsSearch) {
+		return stockDao.getGoodsSizeStockList(goodsSearch);
+	}
+
+	/**
+	 * 사이즈별재고현황 - 엑셀다운로드
+	 *
+	 * @param goodsSearch
+	 * @param excelFilenameWithPath - 경로를 포함한 엑셀파일명
+	 * @return
+	 * @author eskim
+	 * @since 2020. 11. 17
+	 */
+	public void getGoodsSizeStockExcelList(GoodsSearch goodsSearch, String excelFilenameWithPath) {
+		// 헤더 title 설정
+		String[] listTitles = {"브랜드명","상품명", "품목", "상품상태", "상품코드",  "옵션코드", "색상" , "사이즈", "품절여부",
+			"재고", "안전재고","출고대기", "판매가능재고"};
+
+		// DB 처리 시 사용되는 파라미터명(셀명) 설정
+		String[] cellNames = { "BRAND_ENM", "GOODS_NM", "ITEMKIND_NM","GOODS_STAT_NM","GOODS_CD", "OPT_CD", "OPT_CD1","OPT_CD2", "SOLDOUT_YN",
+			"CURR_STOCK_QTY", "BASE_STOCK_QTY", "SALE_STOCK_QTY", "ABLE_STOCK_QTY"};
+
+		String[] cellTypes = {GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_CENTER.name(),
+			GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_CENTER.name(),
+			GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_CENTER.name(),
+			GagaExcelConstants.CellType.CHAR_CENTER.name(), GagaExcelConstants.CellType.CHAR_CENTER.name(),
+			GagaExcelConstants.CellType.CHAR_CENTER.name(),
+			GagaExcelConstants.CellType.CHAR_RIGHT.name(), GagaExcelConstants.CellType.CHAR_RIGHT.name(),
+			GagaExcelConstants.CellType.CHAR_RIGHT.name(), GagaExcelConstants.CellType.CHAR_RIGHT.name()
+		};
+
+		Collection<GagaMap> dataList = stockDao.getGoodsSizeStockExcelList(goodsSearch);
+
+		try {
+			GagaExcelUtil.createExcel(excelFilenameWithPath, dataList, "사이즈별재고현황", listTitles, cellNames, cellTypes,
+				TssConstants.EXCEL_FOOTER_TITLE);
+		} catch (Exception e) {
+			throw new IllegalStateException(e);
+		}
+	}
+
+	/**
+	 * 상품 입출고 엑셀조회용 상품 저장
+	 *
+	 * @param procJob : goodsExcelUpload
+	 * @param goodsSizeList
+	 * @return
+	 * @author eskim
+	 * @since 2020. 02. 13
+	 */
+	@Transactional("shopTxnManager")
+	public void saveGoodsSizeSoldoutExcelupload(Collection<Option> goodsSizeList, String excelFilename) {
+
+		String targetPath = GagaFileUtil.getConcatenationPath(env.getProperty("upload.excel.target.path"), "excel");
+		if (goodsSizeList == null || goodsSizeList.isEmpty()) {
+			this.deleteExceluploadFile(targetPath, excelFilename);
+			throw new IllegalStateException(message.getMessage("FAIL_1001"));
+		}
+
+		// 입력값 확인
+		String goodsSizeSoldoutCheck = getGoodsSizeSoldoutCheck(goodsSizeList);
+		if (!"SUCC".equals(goodsSizeSoldoutCheck)) {
+			this.deleteExceluploadFile(targetPath, excelFilename);
+			throw new IllegalStateException(goodsSizeSoldoutCheck);
+		}
+
+		int index = 0;
+		for (Option stock : goodsSizeList) {
+			stock.setUpdNo(TssSession.getInfo().getUserNo());
+			stock.setRegNo(TssSession.getInfo().getUserNo());
+
+			// 엑셀조회를 위한 SEARCH 테이블 생성
+			SearchData searchData = new SearchData();
+			searchData.setRegNo(stock.getRegNo());
+			searchData.setSearchCd(stock.getGoodsCd());
+			searchData.setDispOrd(index);
+			searchData.setDummy1(stock.getOptCd());
+			if (index == 0) {
+				commonService.deleteExceluploadSearCh(searchData);
+			}
+
+			commonService.createExceluploadSearchByAll(searchData);
+
+			goodsService.createStockHst(stock);
+
+			stockDao.updateStockSoldOut(stock);
+
+			index++;
+		}
+	}
+
+	/*
+	 * 상품 입출고 엑셀조회용 상품 저장 - 입력값 확인
+	 */
+	private String getGoodsSizeSoldoutCheck(Collection<Option> goodsStockList) {
+
+		int cnt = 0;
+		for (Option stock : goodsStockList) {
+
+			if (StringUtils.isEmpty(stock.getGoodsCd())) {
+				return (cnt + 2) + "행의 상품코드를 확인해주세요";
+			}
+			if (StringUtils.isEmpty(stock.getOptCd())) {
+				return (cnt + 2) + "행의 사이즈를 확인해주세요.";
+			}
+			if (!"N".equals(stock.getSoldoutYn()) && !"Y".equals(stock.getSoldoutYn())) {
+				return (cnt + 2) + "행의 품절여부  확인해주세요.";
+			}
+			// 상품코드 옵션 확인
+			int stockCnt = goodsService.getGoodsOptionCount(stock);
+			if (stockCnt <= 0) {
+				return (cnt + 2) + "행의 상품 사이즈는 존재하지 않습니다.<br/>확인해주세요.";
+			}
+			if (StringUtils.isEmpty(stock.getBaseStockQty())) {
+				return (cnt + 2) + "행의 안전재고 수량을 확인해주세요.";
+			}
+
+			cnt++;
+		}
+
+		return "SUCC";
+	}
+
+	/**
+	 * 파일 삭제
+	 *
+	 * @param targetPath
+	 * @param excelFilename
+	 * @author eskim
+	 * @since 2019. 09. 26
+	 */
+	private void deleteExceluploadFile(String targetPath, String excelFilename) {
+		// 파일 삭제
+		try {
+			GagaFileUtil.deleteFile(GagaFileUtil.getConcatenationPath(targetPath, excelFilename));
+		} catch (IOException e) {
+			// Nothing Do
+		}
+	}
+
+}

+ 200 - 0
style24.scm/src/main/java/com/style24/scm/biz/web/TssStockController.java

@@ -0,0 +1,200 @@
+package com.style24.scm.biz.web;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.core.io.InputStreamResource;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.style24.core.support.message.TscMessageByLocale;
+import com.style24.persistence.TssPageRequest;
+import com.style24.persistence.domain.Color;
+import com.style24.persistence.domain.Goods;
+import com.style24.persistence.domain.GoodsSearch;
+import com.style24.persistence.domain.Option;
+import com.style24.scm.biz.service.TssRendererService;
+import com.style24.scm.biz.service.TssStockService;
+import com.style24.scm.support.controller.TssBaseController;
+import com.style24.scm.support.security.session.TssSession;
+
+import lombok.extern.slf4j.Slf4j;
+
+import com.gagaframework.excel.GagaExcelUtil;
+import com.gagaframework.web.parameter.GagaMap;
+import com.gagaframework.web.rest.server.GagaResponse;
+import com.gagaframework.web.util.GagaDateUtil;
+import com.gagaframework.web.util.GagaFileUtil;
+
+/**
+ * 상품 재고 Controller
+ *
+ * @author eskim
+ * @since 2020. 11. 17
+ */
+@Controller
+@RequestMapping("/stock")
+@Slf4j
+public class TssStockController extends TssBaseController {
+
+	@Autowired
+	private TscMessageByLocale message;
+
+	@Autowired
+	private Environment env;
+
+	@Autowired
+	private TssStockService stockService;
+
+	@Autowired
+	private TssRendererService rendererService;
+
+	/**
+	 * 사이즈별재고현황 화면
+	 *
+	 * @return
+	 * @throws Exception
+	 * @author eskim
+	 * @since 2020. 11. 17
+	 */
+	@RequestMapping(value = "/size/form", method = RequestMethod.GET)
+	public ModelAndView goodsSizeStockListForm() {
+
+		ModelAndView mav = new ModelAndView();
+
+		// 공급업체
+		String supplyCompCd = "";
+		if ("G001_B000".equals(TssSession.getInfo().getRoleCd())) {
+			supplyCompCd = TssSession.getInfo().getSupplyCompCd();
+		}
+		mav.addObject("supplyCompList", rendererService.getSupplyCompanyList(supplyCompCd, "N"));
+		// 상품상태
+		String[] exceptCds = {"G008_00"};
+		mav.addObject("goodsStatList", rendererService.getCommonCodeList("G008", "Y", exceptCds));
+		// 정상이월
+		mav.addObject("formalGbList", rendererService.getAvailCommonCodeList("G009"));
+		// 시즌
+		mav.addObject("seasonList", rendererService.getAvailCommonCodeList("G006"));
+		// 년도
+		int toYear = Integer.parseInt(GagaDateUtil.getToday("yyyy")) - 4;
+		mav.addObject("styleYearList", rendererService.getYearList(toYear,0,5));
+		// 사용여부
+		mav.addObject("useYnList", rendererService.getAvailCommonCodeList("G002"));
+		// 품목
+		mav.addObject("itemkindList", rendererService.getAllItemkindList());
+		// MD
+		mav.addObject("brandMdList", rendererService.getBrandMdList());
+		// 색상
+		Color color = new Color();
+		mav.addObject("colorList", rendererService.getColorList(color));
+
+		mav.setViewName("stock/GoodsSizeStockForm");
+
+		return mav;
+	}
+
+	/**
+	 * 사이즈별재고현황 조회
+	 *
+	 * @return
+	 * @throws Exception
+	 * @author eskim
+	 * @since 2020. 11. 17
+	 */
+	@RequestMapping(value = "/sizeStock/list", method = RequestMethod.POST)
+	@ResponseBody
+	public GagaMap getGoodsSizeStockList(@RequestBody GoodsSearch goodsSearch) {
+
+		GagaMap result = new GagaMap();
+
+		//입점업체담당자는 업체코드 설정
+		if ("G001_B000".equals(TssSession.getInfo().getRoleCd())) {
+			goodsSearch.setSupplyCompCd(TssSession.getInfo().getSupplyCompCd());
+			goodsSearch.setMdNo(TssSession.getInfo().getUserNo().toString());
+		}
+
+		goodsSearch.setRegNo(TssSession.getInfo().getUserNo());	//엑셀조회시 로그인 사용자의 엑셀 상품조회시 사용
+		goodsSearch.setPageable(new TssPageRequest(goodsSearch.getPageNo() - 1, goodsSearch.getPageSize()));
+		goodsSearch.getPageable().setTotalCount(stockService.getGoodsSizeStockCount(goodsSearch));
+
+		result.set("pageing", goodsSearch);
+		result.set("goodsSizeStockList", stockService.getGoodsSizeStockList(goodsSearch));
+
+		return result;
+	}
+
+	/**
+	 * 사이즈별재고현황 - 엑셀다운로드
+	 *
+	 * @param goodsSearch
+	 * @return
+	 * @throws Exception
+	 * @author eskim
+	 * @since 2020. 11. 17
+	 */
+	@RequestMapping(value = "/sizeStock/excel/list", method = RequestMethod.GET)
+	public ResponseEntity<InputStreamResource> downloadGoodsInfoExcelList(HttpServletRequest request, GoodsSearch goodsSearch) throws Exception {
+		String excelfileName = "사이즈별재고현황_" + GagaDateUtil.getTodayDateTime() + ".xlsx";
+		String excelFilenameWithPath = GagaFileUtil.getConcatenationPath(env.getProperty("download.path"), "excel", excelfileName);
+
+		log.info("downloadGoodsInfoExcelList goodsSearch= {}", goodsSearch);
+		//입점업체담당자는 업체코드 설정
+		if ("G001_B000".equals(TssSession.getInfo().getRoleCd())) {
+			goodsSearch.setSupplyCompCd(TssSession.getInfo().getSupplyCompCd());
+			goodsSearch.setMdNo(TssSession.getInfo().getUserNo().toString());
+		}
+		goodsSearch.setRegNo(TssSession.getInfo().getUserNo());	//엑셀조회시 로그인 사용자의 엑셀 상품조회시 사용
+
+		// 대용량엑셀파일다운로드는 이런 식으로 ...
+		stockService.getGoodsSizeStockExcelList(goodsSearch, excelFilenameWithPath);
+
+		return GagaFileUtil.writeFile(request, excelFilenameWithPath);
+	}
+
+	/**
+	 * 상품 사이즈별 품절/안전재고 변경
+	 *
+	 * @param goods
+	 * @return
+	 * @throws Exception
+	 * @author eskim
+	 * @since 2020. 02. 20
+	 */
+	@PostMapping("/sizeSoldout/excelupload/save")
+	@ResponseBody
+	public GagaResponse saveGoodsSizeSoldoutExcelupload(@RequestBody Goods goods) throws Exception {
+
+		ObjectMapper mapper = new ObjectMapper();
+
+		String targetPath = GagaFileUtil.getConcatenationPath(env.getProperty("upload.excel.target.path"), "excel");
+		// DB 처리 시 사용되는 파라미터명(셀명) 설정
+		String[] cellName = { "brandEnm", "goodsNm", "itemkindCd","goodsStat","goodsCd", "optCd", "optCd1", "optCd2",  "soldoutYn",
+			"currStockQty", "baseStockQty","saleStockQty", "ableStockQty"};
+
+		Collection<GagaMap> ecxelGoodsList = GagaExcelUtil.getList(GagaFileUtil.getConcatenationPath(targetPath, goods.getExcelFileNm()), 0, cellName, 0);
+
+		Collection<Option> goodsSizeList = new ArrayList<>();
+		for (GagaMap map : ecxelGoodsList) {
+			Option tmpGoods = mapper.convertValue(map, Option.class);
+			goodsSizeList.add(tmpGoods);
+		}
+
+		stockService.saveGoodsSizeSoldoutExcelupload(goodsSizeList, goods.getExcelFileNm());
+
+		// 파일 삭제
+		GagaFileUtil.deleteFile(GagaFileUtil.getConcatenationPath(targetPath, goods.getExcelFileNm()));
+
+		return super.ok("");
+	}
+}

+ 13 - 9
style24.scm/src/main/webapp/WEB-INF/views/goods/GoodsListForm.html

@@ -485,6 +485,7 @@
 		$("#searchForm input[type=checkbox]").parent("label").removeClass("checked");
 		$("#searchForm input[type=radio][checked]").parent("label").addClass("checked");
 		$("#multiBrand").empty();
+		fnSupplyBrandInit();
 	});
 
 	// 조회클릭시
@@ -958,6 +959,17 @@
 		cfnCreateCombo('/renderer/delvFee/list/' + $('#searchForm select[name=statSupplyCompCd]').val(), $('#searchForm select[name=delvFeeCdC]'), "[선택]");
 	});
 	
+	// 업체 브랜드 초기화
+	var fnSupplyBrandInit = function(){
+		$("#searchForm select[name=supplyCompCd]").val([[${sessionInfo.supplyCompCd}]]);
+		//$("#searchForm select[name=supplyCompCd]").attr("disabled", true);
+		//$("select[disabled]").addClass("formControl");
+
+		$('#searchForm').find('#multiBrand').empty();
+		var actionUrl = '/renderer/brand/AuthBrandlist';
+		cfnCreateMultiCombo(actionUrl,"multiBrand",  "[전체]",null, 'Y');
+	}
+	
 	$(document).ready(function() {
 
 		cfnCreateCalendar('#sellTerms', 'stDate', 'edDate', true, '등록일', 'X');
@@ -974,15 +986,7 @@
 		gagaAgGrid.createGrid('gridList', gridOptions);
 		
 		if(sessRoleCd == "G001_B000") {
-			
-			$("#searchForm select[name=supplyCompCd]").val([[${sessionInfo.supplyCompCd}]]);
-			//$("#searchForm select[name=supplyCompCd]").attr("disabled", true);
-			//$("select[disabled]").addClass("formControl");
-
-			$('#searchForm').find('#multiBrand').empty();
-			var actionUrl = '/renderer/brand/AuthBrandlist';
-			cfnCreateMultiCombo(actionUrl,"multiBrand",  "[전체]",null, 'Y');
-			
+			fnSupplyBrandInit();
 		}
 
 	});

+ 30 - 8
style24.scm/src/main/webapp/WEB-INF/views/goods/GoodsNoticeForm.html

@@ -47,7 +47,7 @@
 						<th>업체/브랜드</th>
 						<td>
 							<select name="supplyCompCd" id="supplyCompCd">
-								<option value="" th:if="${sessionInfo.roleCd} != 'B000'">[전체]</option>
+								<option value="" >[전체]</option>
 								<option th:if="${supplyCompList}" th:each="oneData, status : ${supplyCompList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
 							</select>
 							<select name="brandCd" id="brandCd">
@@ -87,7 +87,7 @@
 				</table>
 				<ul class="panelBar">
 					<li class="center">
-						<button type="button" class="btn btn-gray btn-lg" onclick="$('#searchForm')[0].reset();">초기화</button>
+						<button type="button" class="btn btn-gray btn-lg" id="btnInit" >초기화</button>
 						<button type="button" class="btn btn-base btn-lg" id="btnSearch">조회</button>
 					</li>
 				</ul>
@@ -192,7 +192,9 @@
 <script type="text/javascript" src="/ux/plugins/gaga/gaga.summernote.js?v=2020103001"></script>
 <script th:inline="javascript">
 /*<![CDATA[*/
-
+	
+	var sessRoleCd = [[${sessionInfo.roleCd}]];
+	
 	var columnNoticeDefs = [
 		{headerName: 'No', width: 60, cellClass: 'text-center', valueGetter: function(params) { return params.node.rowIndex + 1 }},
 		{headerName: "공지번호", field: "noticeSq", width: 90, cellClass: 'text-center'},
@@ -250,6 +252,21 @@
 		// 상품 목록
 		fnGetNoticeGoodsList(event.data.noticeSq);
 	}
+	
+	// 초기화 클릭시
+	$('#btnInit').on('click', function() {
+		fnInit();
+	});
+	
+	var fnInit = function(){
+		$('#goodsNoticeForm')[0].reset();
+		//$("#goodsNoticeForm input[type=radio]").removeClass("checked");
+		$("#goodsNoticeForm input[type=checkbox]").removeClass("checked");
+		//$("#goodsNoticeForm input[type=radio]").parent("label").removeClass("checked");
+		$("#goodsNoticeForm input[type=checkbox]").parent("label").removeClass("checked");
+		$("#goodsNoticeForm input[type=radio][checked]").parent("label").addClass("checked");
+		fnSupplyBrandInit();
+	}
 
 	// 검색
 	$('#btnSearch').on('click', function() {
@@ -502,6 +519,15 @@
 		});
 	});
 	
+	// 업체 브랜드 초기화
+	var fnSupplyBrandInit = function(){
+		$("#searchForm select[name=supplyCompCd]").val([[${sessionInfo.supplyCompCd}]]);
+		//$("#searchForm select[name=supplyCompCd]").attr("disabled", true);
+		//$("select[disabled]").addClass("formControl");
+		var actionUrl = '/renderer/brand/AuthBrandlist';
+		cfnCreateCombo(actionUrl, $('#searchForm select[name=brandCd]'), "[전체]");
+	}
+	
 	$(document).ready(function() {
 		
 		cfnCreateCalendar('#sellTerms', 'stDate', 'edDate', true, '공지일', 'X');
@@ -515,11 +541,7 @@
 		gagaSn.createSummernote(snOptions, '#noticeContent');
 		
 		if(sessRoleCd == "G001_B000") {
-			$("#goodsPriceHstForm select[name=supplyCompCd]").val([[${sessionInfo.supplyCompCd}]]);
-			//$("#goodsPriceHstForm select[name=supplyCompCd]").attr("disabled", true);
-			//$("select[disabled]").addClass("formControl");
-			var actionUrl = '/renderer/brand/AuthBrandlist';
-			cfnCreateCombo(actionUrl, $('#goodsPriceHstForm select[name=brandCd]'), "[전체]");
+			fnSupplyBrandInit();
 		}
 		
 	});

+ 11 - 5
style24.scm/src/main/webapp/WEB-INF/views/goods/GoodsSupplyPriceForm.html

@@ -226,6 +226,7 @@
 		//$("#goodsPriceHstForm input[type=radio]").parent("label").removeClass("checked");
 		$("#goodsPriceHstForm input[type=checkbox]").parent("label").removeClass("checked");
 		$("#goodsPriceHstForm input[type=radio][checked]").parent("label").addClass("checked");
+		fnSupplyBrandInit();
 	}
 	
 	// 조회클릭시
@@ -360,6 +361,15 @@
 		fnGoodsPriceHstListSearch('Y');
 	}
 	
+	// 업체 브랜드 초기화
+	var fnSupplyBrandInit = function(){
+		$("#goodsPriceHstForm select[name=supplyCompCd]").val([[${sessionInfo.supplyCompCd}]]);
+		//$("#goodsPriceHstForm select[name=supplyCompCd]").attr("disabled", true);
+		//$("select[disabled]").addClass("formControl");
+		var actionUrl = '/renderer/brand/AuthBrandlist';
+		cfnCreateCombo(actionUrl, $('#goodsPriceHstForm select[name=brandCd]'), "[전체]");
+	}
+	
 	$(document).ready(function() {
 		
 		cfnCreateCalendar('#sellTerms', 'stDate', 'edDate', true, '등록일', 'X');
@@ -373,11 +383,7 @@
 		
 		
 		if(sessRoleCd == "G001_B000") {
-			$("#goodsPriceHstForm select[name=supplyCompCd]").val([[${sessionInfo.supplyCompCd}]]);
-			//$("#goodsPriceHstForm select[name=supplyCompCd]").attr("disabled", true);
-			//$("select[disabled]").addClass("formControl");
-			var actionUrl = '/renderer/brand/AuthBrandlist';
-			cfnCreateCombo(actionUrl, $('#goodsPriceHstForm select[name=brandCd]'), "[전체]");
+			fnSupplyBrandInit();
 		}
 		
 		// Create a agGrid

+ 539 - 0
style24.scm/src/main/webapp/WEB-INF/views/stock/GoodsSizeStockForm.html

@@ -0,0 +1,539 @@
+<!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.11.17   eskim       수정
+ *******************************************************************************
+ -->
+	<div id="main">
+		<!-- 메인타이틀 영역 -->
+		<div class="main-title">
+		</div>
+		<!-- //메인타이틀 영역 -->
+		<!-- 메뉴 설명 -->
+		<div class="infoBox menu-desc">
+		</div>
+		<form id="goodsSizeStockForm" name="goodsSizeStockForm" action="#" th:action="@{'/stock/sizeStock/list'}">
+		<input type="hidden" id="searchGb" name="searchGb" />
+ 		<!-- 패널 영역1 -->
+		<div class="panelStyle" >
+			<!-- TITLE -->
+			<div class="panelTitle">
+				<h3><i class="fa fa-info-circle"></i>아래 검색조건 중 <font color="red">업체, 키워드</font>중 하나를 꼭 입력해 주세요.</h3>
+				<span class="panelControl">
+					<i class="fa fa-chevron-up"></i>
+				</span>
+			</div>
+			<!-- //TITLE -->
+			<div class="panelContent">
+				<table class="frmStyle">
+					<colgroup>
+						<col width="9%"/>
+						<col width="16%"/>
+						<col width="9%"/>
+						<col width="16%"/>
+						<col width="9%"/>
+						<col width="16%"/>
+						<col width="9%"/>
+						<col/>
+					</colgroup>
+					<tr>
+						<th>업체/브랜드<em class="required" title="필수"></em></th>
+						<td colspan="3">
+							<select name="supplyCompCd" id="supplyCompCd">
+								<option value="" >[전체]</option>
+								<option th:if="${supplyCompList}" th:each="oneData, status : ${supplyCompList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+							</select>
+							<select name="brandCd" id="brandCd">
+								<option value="">[전체]</option>
+							</select>
+						</td>
+						<th>품목</th>
+						<td colspan="3">
+							<select name="itemkindCd" id="itemkindCd">
+								<option value="">[전체]</option>
+								<option th:if="${itemkindList}" th:each="oneData, status : ${itemkindList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+							</select>
+						</td>
+					</tr>
+					<tr>
+						<th>키워드<em class="required" title="필수"></em></th>
+						<td colspan="3">
+							<select name="search" id="search">
+								<option value="searchGoodsCd">상품코드</option>
+								<option value="searchGoodsNm">상품명</option>
+								<option value="searchGoodsNum">품번</option>
+								<option value="searchSupplyGoodsCd">업체상품코드</option>
+							</select>
+							<input type="text" class="w150" name="condition" id="condition" maxlength="50"/>
+						</td>
+						<th>상품상태</th>
+						<td>
+							<select  name="goodsStat" id="goodsStat">
+								<option value="">[전체]</option>
+								<option th:if="${goodsStatList}" th:each="oneData, status : ${goodsStatList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+							</select>
+						</td>
+						<th>정상/이월 구분</th>
+						<td>
+							<select  name="formalGb" id="formalGb">
+								<option value="">[전체]</option>
+								<option th:if="${formalGbList}" th:each="oneData, status : ${formalGbList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+							</select>
+						</td>
+					</tr>
+					<tr>	
+						<th>년도/시즌</th>
+						<td colspan="3">
+							<select  name="styleYear" id="styleYear">
+								<option value="">[전체]</option>
+								<option th:if="${styleYearList}" th:each="oneData, status : ${styleYearList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+							</select>
+							<select  name="seasonCd" id="seasonCd">
+								<option value="">[전체]</option>
+								<option th:if="${seasonList}" th:each="oneData, status : ${seasonList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+							</select>
+						</td>
+						<th>색상</th>
+						<td>
+							<select name="optCd1" id="optCd1">
+								<option value="">[전체]</option>
+								<option th:if="${colorList}" th:each="oneData, status : ${colorList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+							</select>
+						</td>
+						<th>사이즈</th>
+						<td>
+							<input type="text" class="w80" name="optCd2" id="optCd2" maxlength="50"/>
+						</td>
+						
+					</tr>
+					<tr>
+						<th>품절여부</th>
+						<td>
+							<select  name="soldOutYn" id="soldOutYn">
+								<option value="">[전체]</option>
+								<option th:if="${useYnList}" th:each="oneData, status : ${useYnList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+							</select>
+						</td>
+						<th>담당MD</th>
+						<td>
+							<select  name="mdNo" id="mdNo">
+								<option value="">[전체]</option>
+								<option th:if="${brandMdList}" th:each="oneData, status : ${brandMdList}" th:value="${oneData.cd}" th:text="${oneData.cdNm}"></option>
+							</select>
+						</td>
+						<th>재고수량</th>
+						<td colspan="3">
+							<input type="text" class="w70" name="stockQtySt" id="stockQtySt" maxlength="5" data-valid-type="numeric"/> ~ <input type="text" class="w70" name="stockQtyEd" id="stockQtyEd" maxlength="5" data-valid-type="numeric"/>
+						</td>
+					</tr>
+				</table>
+				<ul class="panelBar">
+					<li class="center">
+						<button type="button" class="btn btn-gray btn-lg" id="btnInit" >초기화</button>
+						<button type="button" class="btn btn-info btn-lg" id="btnSearch" >조회</button>
+					</li>
+				</ul>
+
+			</div>
+			<!-- //검색조건 영역 -->
+		</div>
+		<!-- 패널 영역1 -->
+		<div class="panelStyle">
+			<!-- 검색결과 영역 -->
+			<!-- 상단버튼 영역  -->
+			<ul class="panelBar">
+				<li class="left">
+					<select id="excelSample" name="excelSample">
+						<option value="">[선택]</option>
+						<option value="SF003">상품엑셀조회양식</option>
+						<option value="SF008" th:if="${sessionInfo.roleCd == 'G001_B000' }">상품사이즈품절/안전재고양식</option>
+						<option value="EXCELDOWN">엑셀다운로드</option>
+					</select>
+					<button type="button" class="btn btn-default btn-lg" id="btnExcelSampleDownLoad">다운로드</button>
+					<button type="button" class="btn btn-base btn-lg" id="btnGoodsExcelSearch">엑셀조회</button>
+					<button type="button" class="btn btn-success btn-lg" id="btnGoodsExcelSave" th:if="${sessionInfo.roleCd == 'G001_B000' }">품절/안전재고 저장</button>
+				</li>
+				<li class="right">
+					검색결과 : <strong><span id="gridRowTotalCount">0</span> 건</strong>&nbsp;
+					쪽번호 <span id="pgNo">0</span>/ <strong id="endPgNo">0</strong>&nbsp;&nbsp;
+					<select id="pageSize" name="pageSize">
+						<option value="100" selected="selected">100개씩 보기</option>
+						<option value="500">500개씩 보기</option>
+						<option value="1000">1000개씩 보기</option>
+						<option value="5000">5000개씩 보기</option>
+					</select>
+					<input type="hidden" name="pageNo" id="pageNo" value ="1"/>
+				</li>
+			</ul>
+			<!-- //상단버튼 영역  -->
+			<div id="gridList" style="width: 100%; height:550px" class="ag-theme-balham"></div>
+			<ul class="panelBar">
+				<li class="center">
+					<div class="tablePaging" id="goodsListPagination"></div>
+				</li>
+			</ul>
+			<!-- 검색결과 영역 -->
+		</div>
+		<label class="off">
+			<a href="javascript:void(0);" id="GoodsSizeStockExcelList" style="display: none;">사이즈별 재고현황 엑셀다운로드</a>
+		</label>
+		</form>
+		<!-- //패널 영역2 -->
+<script type="text/javascript" src="/ux/plugins/gaga/gaga.paging.js?v=2019072202"></script>
+<script th:inline="javascript">
+/*<![CDATA[*/
+	var sessRoleCd = [[${sessionInfo.roleCd}]];
+	var goodsStatList = gagajf.convertToArray([[${goodsStatList}]]);
+	var formalGbList = gagajf.convertToArray([[${formalGbList}]]);
+	var columnDefs = [];
+	
+	columnDefs = [
+		//{width: 40, minWidth: 40, cellClass: 'text-right', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
+		{headerName: 'No', width: 60, cellClass: 'text-center',
+			valueGetter: function(params) { return cfnGridNumner('goodsSizeStockForm',params.node.rowIndex, 'A');}
+		},
+		{headerName: "브랜드명", field: "brandEnm", width: 130, cellClass: 'text-center'},
+		{headerName: "상품명", field: "goodsNm", width: 200, cellClass: 'text-left'},
+		{headerName: "품목", field: "itemkindNm", width: 180, cellClass: 'text-left'},
+		{headerName: "상품상태", field: "goodsStat" , width: 120, cellClass: 'text-center',
+			cellEditorParams: { values: gagaAgGrid.extractValues(goodsStatList) },
+			valueFormatter: function (params) { return gagaAgGrid.lookupValue(goodsStatList, params.value); },
+			valueParser: function (params) { return gagaAgGrid.lookupKey(goodsStatList, params.newValue); }
+		},
+		{headerName: "상품코드", field: "goodsCd", width: 140, cellClass: 'text-center',
+			cellRenderer: function(params) {
+				if (params.data.sizeSoldoutYn == "Y"){
+					return '<a href="javascript:void(0);" style="color:red">' + params.value + '</a>';
+				}else{
+					return '<a href="javascript:void(0);">' + params.value + '</a>';	
+				}
+			}	
+		},
+		{headerName: "색상", field: "optCd1", width: 100, cellClass: 'text-center'},
+		{headerName: "사이즈", field: "optCd2", width: 100, cellClass: 'text-center'},
+		{headerName: "품절여부", field: "soldoutYn", width: 100, cellClass: 'text-center',
+			cellStyle : function(params){
+				var color = "";
+				if (params.value == "Y"){
+					color = "red";
+				}
+				return { 'color': color}
+			} 
+		},
+		
+		{headerName: "재고", field: "currStockQty", width: 100, cellClass: 'text-right',
+			valueFormatter: function(params) {	return params.value.addComma();}
+		},
+		{headerName: "안전재고", field: "baseStockQty", width: 100, cellClass: 'text-right',
+			valueFormatter: function(params) {	return params.value.addComma();}
+		},
+		{headerName: "출고대기", field: "saleStockQty", width: 100, cellClass: 'text-right',
+			valueFormatter: function(params) {	return params.value.addComma();}
+		},
+		{headerName: "판매가능재고", field: "ableStockQty", width: 100, cellClass: 'text-right',
+			valueFormatter: function(params) {	return params.value.addComma();},
+			cellStyle : function(params){
+				var color = "";
+				if (params.value <= 0){
+					color = '#ff96689c';
+				}
+				return { 'background-color': color};
+			}
+		}
+	];
+	
+	// Get GridOptions
+	var gridOptions = gagaAgGrid.getGridOptions(columnDefs);
+
+	// 중복 선택 가능
+	gridOptions.rowSelection = 'multiple';
+	gridOptions.suppressRowClickSelection = true;
+	//gridOptions.rowHeight = 60; //이미지가 있을경우 높이 지정해야함.
+
+	// Row Click
+	gridOptions.onCellClicked = function(event) {
+		var goodsCd = event.data.goodsCd;
+		if (event.colDef.field == "goodsCd"){
+			cfnOpenGoodsDetailPopup('U',goodsCd);
+		}
+	}
+
+	gridOptions.getRowStyle = function(params) {
+		if ("G008_00" == params.data.goodsStat  || "G008_10" == params.data.goodsStatG008_ || "20" == params.data.goodsStat || "G008_30" == params.data.goodsStat) {
+			return { background: '#23c6c8' };
+		}
+	}
+	
+	// 초기화 클릭시
+	$('#btnInit').on('click', function() {
+		fnInit();
+	});
+	
+	var fnInit = function(){
+		
+		$('#goodsSizeStockForm')[0].reset();
+		//$("#goodsSizeStockForm input[type=radio]").removeClass("checked");
+		$("#goodsSizeStockForm input[type=checkbox]").removeClass("checked");
+		//$("#goodsSizeStockForm input[type=radio]").parent("label").removeClass("checked");
+		$("#goodsSizeStockForm input[type=checkbox]").parent("label").removeClass("checked");
+		//$("#goodsSizeStockForm input[type=radio][checked]").parent("label").addClass("checked");
+		$("#goodsSizeStockForm select[name=supplyCompCd]").val([[${sessionInfo.supplyCompCd}]]);
+		fnSupplyBrandInit();
+	}
+	
+	// 조회클릭시
+	$('#btnSearch').on('click', function() {
+		$("#goodsSizeStockForm input[name=pageNo]").val('1');
+		fnGoodsListSearch('BASIC');
+	});
+
+	// 조회
+	var fnGoodsListSearch = function(gbn) {
+		
+		if (typeof(gbn) != 'undefined' &&  gbn == 'EXCEL'){
+			$("#goodsSizeStockForm input[name=searchGb]").val("EXCEL");
+		}else if (typeof(gbn) != 'undefined' &&  gbn == 'EXCELRESULT'){
+			$("#goodsSizeStockForm input[name=searchGb]").val("EXCELRESULT");
+		}else{
+			$("#goodsSizeStockForm input[name=searchGb]").val("BASIC");
+		}
+		
+		if(!fnConditionCheck()) return;
+		
+		gagaPaging.init('goodsSizeStockForm', fnSearchCallBack, 'goodsListPagination', $('#goodsSizeStockForm').find('#pageSize').val());
+		gagaPaging.load($("#goodsSizeStockForm input[name=pageNo]").val());
+	}
+
+	//검색 조건 확인
+	var fnConditionCheck = function(){
+		var formId = '#goodsSizeStockForm';
+		var form = document.goodsSizeStockForm;
+
+		if($("#goodsSizeStockForm input[name=searchGb]").val() == "EXCEL" || $("#goodsSizeStockForm input[name=searchGb]").val() == "EXCELRESULT") {
+			return true;
+		}
+		
+		var searchFlag = false;
+		var cnt = 0;
+
+		/* if( !gagajf.isNull($("#goodsSizeStockForm select[name=supplyCompCd]").val())
+				|| !gagajf.isNull($("#goodsSizeStockForm input[name=condition]").val())
+				|| (!gagajf.isNull($("#goodsSizeStockForm input[name=stDate]").val()) && !gagajf.isNull($("#goodsSizeStockForm input[name=edDate]").val()))
+			){
+			searchFlag = true;
+		}else{ */
+			for (i = 0; i < form.elements.length; i++ ) {
+				var el = form.elements[i];
+				
+				if ($(el).prop("type") == "text" || ($(el).prop("type") == "select-one" && el.name != "search" && el.name != "pageSize" && el.name != "excelSample")) {
+					if (!(el.value == null || el.value == "")) {
+						cnt++;
+					}
+				}
+			}
+
+			if(cnt > 0) searchFlag = true;
+			
+		/* } */
+		
+		if(searchFlag == false){
+			mcxDialog.alert("검색조건을 입력하세요.");
+			return false;
+		}
+		
+		/* if(!gagajf.isNull($("#goodsSizeStockForm input[name=currPriceSt]").val()) && !gagajf.isNull($("#goodsSizeStockForm input[name=currPriceEd]").val())){
+			if (Number($("#goodsSizeStockForm input[name=currPriceSt]").val().removeComma()) > Number($("#goodsSizeStockForm input[name=currPriceEd]").val().removeComma()) ){
+				mcxDialog.alertC("판매가를 확인해 주세요.", {
+					sureBtnText: "확인",
+					sureBtnClick: function() {
+						$("#goodsSizeStockForm input[name=currPriceEd]").focus();
+					}
+				});
+				return false;
+			}
+		} */
+		
+		/* if(!gagajf.isNull($("#goodsSizeStockForm input[name=dcRateSt]").val()) && !gagajf.isNull($("#goodsSizeStockForm input[name=dcRateEd]").val())){
+			if (Number($("#goodsSizeStockForm input[name=dcRateSt]").val().removeComma()) > Number($("#goodsSizeStockForm input[name=dcRateEd]").val().removeComma()) ){
+				mcxDialog.alertC("할인율를 확인해 주세요.", {
+					sureBtnText: "확인",
+					sureBtnClick: function() {
+						$("#goodsSizeStockForm input[name=dcRateEd]").focus();
+					}
+				});
+				return false;
+			}
+		} */
+		
+		/* var fromDate = $('#goodsSizeStockForm input[name=stDate]').val();
+		var toDate = $('#goodsSizeStockForm input[name=edDate]').val();
+		
+		if (!gagajf.isNull(fromDate) || !gagajf.isNull(toDate)) {
+			
+			if (gagajf.isNull(fromDate) || gagajf.isNull(toDate)) {
+				mcxDialog.alertC("등록일 조회시 시작일자와 종료일자를 입력하세요.", {
+					sureBtnText: "확인",
+					sureBtnClick: function() {
+						$('#goodsSizeStockForm input[name=stDate]').focus();
+					}
+				});
+				return false;
+			}
+
+			if (fromDate > toDate) {
+				mcxDialog.alertC("노출기간 시작일자는 종료일자 보다 클 수 없습니다.", {
+					sureBtnText: "확인",
+					sureBtnClick: function() {
+						$('#goodsSizeStockForm input[name=stDate]').focus();
+					}
+				});
+				return false;
+			} 
+		} */
+
+		return true;
+	}
+	
+	var fnSearchCallBack = function(result){
+		$('#goodsSizeStockForm').find('#gridRowTotalCount').html(result.pageing.pageable.totalCount.addComma());
+		$('#goodsSizeStockForm').find('#pageNo').val(result.pageing.pageable.pageNo.addComma());
+		$('#goodsSizeStockForm').find('#pgNo').html(result.pageing.pageable.pageNo.addComma());
+		$('#goodsSizeStockForm').find('#endPgNo').html(result.pageing.pageable.totalPage.addComma());
+		gridOptions.api.setRowData(result.goodsSizeStockList);
+		gagaPaging.createPagination(result.pageing.pageable);
+	}
+	
+	//페이징 
+	$('#goodsSizeStockForm select[name=pageSize]').on('change', function() {
+		$("#goodsSizeStockForm input[name=pageNo]").val('1');
+		fnGoodsListSearch($("#goodsSizeStockForm input[name=searchGb]").val());
+	});
+
+	
+	//업체변경시
+	$('#goodsSizeStockForm select[name=supplyCompCd]').on('change', function() {
+		var supplyCompCd = $(this).val();
+		
+		var actionUrl = '/renderer/supplyCompany/brand/list/' + supplyCompCd;
+
+		if(sessRoleCd == "G001_B000"){
+			actionUrl = '/renderer/brand/AuthBrandlist';
+		}
+		$("#goodsSizeStockForm select[name=brandCd] option:gt(0)").remove();
+
+		cfnCreateCombo(actionUrl, $('#goodsSizeStockForm select[name=brandCd]'), "[전체]", "");
+
+	});
+	
+	//엑셀양식 다운로드
+	$('#btnExcelSampleDownLoad').on('click', function (){
+		var gb = $("#goodsSizeStockForm select[name=excelSample]").val();
+		if (gagajf.isNull(gb)){
+			mcxDialog.alertC("다운로드 할 양식을 선택해주세요", {
+				sureBtnText: "확인",
+				sureBtnClick: function() {
+					$('#goodsSizeStockForm select[name=excelSample]').focus();
+				}
+			});
+			return false;
+		}
+		if ("EXCELDOWN" == gb){
+			fnGoodsExcelDownLoad('');
+		}else{
+			cfnDownloadSampleFile($("#goodsSizeStockForm select[name=excelSample]").val());	
+		}
+	});
+	
+	//엑셀다운로드
+	var fnGoodsExcelDownLoad = function(flag){
+		var formId = '#goodsSizeStockForm';
+		
+		if(!fnConditionCheck()) return;
+		
+		if (gridOptions.api.getDisplayedRowCount() <= 0){
+			mcxDialog.alert("조회된 데이터가 없습니다.<br/>다시 조회 후 다운로드 받으세요.");
+			return;
+		}
+		
+		var params =  $(formId).serialize();
+		$('#GoodsSizeStockExcelList').attr({ href : '/stock/sizeStock/excel/list?' + params }).get(0).click();
+	}
+	
+	//엑셀 상품 조회
+	$('#btnGoodsExcelSearch').on('click', function() {
+		cfnExcelUploadPopup('goodsSizeStockExcelUpload', 'goodsSizeStockExcelSearch');
+	});
+	
+	var goodsSizeStockExcelSearch = function(result){
+		var data = {procJob : result.procJob
+					,excelFileNm : result.excelFileNm
+					};
+		var jsonData = JSON.stringify(data);
+		gagajf.ajaxJsonSubmit('/goods/search/excelupload/save', jsonData, fnGoodsSizeStockExcelSearchCallBack);
+	}
+	
+	var fnGoodsSizeStockExcelSearchCallBack = function(result){
+		fnGoodsListSearch("EXCEL");
+	}
+	
+	//엑셀 상품 사이즈별 품절 저장
+	$('#btnGoodsExcelSave').on('click', function() {
+		cfnExcelUploadPopup('goodsSizeStockExcelUpload', 'goodsSizeStockExcelSave');
+	});
+	
+	var goodsSizeStockExcelSave = function(result){
+		mcxDialog.confirm('품절/안전재고 변경을 진행하시겠습니까?', {
+			cancelBtnText: "취소",
+			sureBtnText: "확인",
+			sureBtnClick: function(){
+				var data = {procJob : result.procJob
+						,excelFileNm : result.excelFileNm
+						};
+			var jsonData = JSON.stringify(data);
+			gagajf.ajaxJsonSubmit('/stock/sizeSoldout/excelupload/save', jsonData, fnGoodsSizeStockExcelSaveCallBack);
+			}
+		});	
+	}
+	
+	var fnGoodsSizeStockExcelSaveCallBack = function(result){
+		fnGoodsListSearch("EXCELRESULT");
+	}
+	
+	// 업체 브랜드 초기화
+	var fnSupplyBrandInit = function(){
+		$("#goodsSizeStockForm select[name=supplyCompCd]").val([[${sessionInfo.supplyCompCd}]]);
+		//$("#goodsSizeStockForm select[name=supplyCompCd]").attr("disabled", true);
+		//$("select[disabled]").addClass("formControl");
+		var actionUrl = '/renderer/brand/AuthBrandlist';
+		cfnCreateCombo(actionUrl, $('#goodsSizeStockForm select[name=brandCd]'), "[전체]");
+	}
+	
+	$(document).ready(function() {
+		
+		// Create a agGrid
+		gagaAgGrid.createGrid('gridList', gridOptions);
+		//$('.ag-header-group-cell').each(function(item){$(this).css('text-align', 'center')});
+		//$('.ag-header-group-cell-label').each(function(item){$(this).css('display', 'inline-block')});
+
+		// 입점 사용자 브랜드 조회 처리
+		if(sessRoleCd == "G001_B000") {
+			fnSupplyBrandInit();
+		}
+
+	});
+
+/*]]>*/
+</script>
+ 	</div>
+
+</html>