Browse Source

창고관리 LOCATION 채번 (1001 부터)

marseyes 2 years ago
parent
commit
83990bdd75

+ 2 - 0
src/main/java/com/oqpo/api/mapper/stockmng/WhsMngMapper.java

@@ -30,6 +30,8 @@ public interface WhsMngMapper {
30 30
 
31 31
     int deleteWhsMgntBaseLoc4Info(@Param("userId") String userId, WhsMgntBaseInfoEntity entity) throws Exception;
32 32
 
33
+    String selectNextLocation4Whs(@Param("brandId") String brandId, @Param("whsId") String whsId) throws Exception;
34
+
33 35
     int insertWhsMgntBaseLoc(@Param("userId") String userId, WhsMgntBaseLocEntity entity) throws Exception;
34 36
 
35 37
     int updateWhsMgntBaseLoc(@Param("userId") String userId, WhsMgntBaseLocEntity entity) throws Exception;

+ 4 - 0
src/main/java/com/oqpo/api/service/stockmng/WhsMngService.java

@@ -85,6 +85,8 @@ public class WhsMngService extends CommonService {
85 85
             // 창고로케이션정보
86 86
             List<WhsMgntBaseLocEntity> locEntities = saveWhsInfoRequest.toEntities(saveWhsInfoRequest.getGridInsertData());
87 87
             for (WhsMgntBaseLocEntity locEntity : locEntities) {
88
+                // LOCATION 채번
89
+                locEntity.setLocation(whsMngMapper.selectNextLocation4Whs(locEntity.getBrandId(), locEntity.getWhsId()));
88 90
                 whsMngMapper.insertWhsMgntBaseLoc(userId, locEntity);
89 91
             }
90 92
         } catch (GlobalException e) {
@@ -129,6 +131,8 @@ public class WhsMngService extends CommonService {
129 131
             // 등록
130 132
             locEntities = saveWhsInfoRequest.toEntities(saveWhsInfoRequest.getGridInsertData());
131 133
             for (WhsMgntBaseLocEntity locEntity : locEntities) {
134
+                // LOCATION 채번
135
+                locEntity.setLocation(whsMngMapper.selectNextLocation4Whs(locEntity.getBrandId(), locEntity.getWhsId()));
132 136
                 whsMngMapper.insertWhsMgntBaseLoc(userId, locEntity);
133 137
             }
134 138
         } catch (GlobalException e) {

+ 8 - 0
src/main/resources/mybatis/sqlmaps/stockmng/WhsMng.xml

@@ -129,6 +129,14 @@
129 129
         AND whs_id = #{entity.whsId}
130 130
     </delete>
131 131
 
132
+    <select id="selectNextLocation4Whs" resultType="java.lang.String">
133
+        /* WhsMngMapper.selectNextLocation4Whs */
134
+        SELECT IFNULL(MAX(A.LOCATION), 1000) + 1
135
+        FROM whs_mgnt_base_loc A
136
+        WHERE A.brand_id = #{brandId}
137
+        AND A.whs_id = #{whsId}
138
+    </select>
139
+
132 140
     <insert id="insertWhsMgntBaseLoc" >
133 141
         /* WhsMngMapper.insertWhsMgntBaseLoc */
134 142
         INSERT INTO whs_mgnt_base_loc