浏览代码

납품서 현황

dwkim 2 年之前
父节点
当前提交
ecfd172a1e

+ 1 - 0
src/main/java/com/oqpo/api/entity/inoutmng/DeliInfoMgntEntity.java

@@ -58,5 +58,6 @@ public class DeliInfoMgntEntity implements Serializable {
58 58
     private String poOwnerNm;
59 59
     private String poAddr;
60 60
 
61
+    private DeliDtlMgntEntity deliDtlMgntInfo;
61 62
 
62 63
 }

+ 5 - 0
src/main/java/com/oqpo/api/mapper/inoutmng/ShmtOdrMapper.java

@@ -37,4 +37,9 @@ public interface ShmtOdrMapper {
37 37
 
38 38
     PchOdrBaseInfoEntity selectSpplyShmtOdrInfo(@Param("brandId") String brandId, @Param("spplyId") String spplyId, @Param("pchPodrUnqNo") String pchPodrUnqNo )throws Exception;
39 39
     List<PchOdrDtlPtclEntity> selectSpplyShmtOdrList( @Param("pchPodrUnqNo") String pchPodrUnqNo )throws Exception;
40
+
41
+
42
+    List<DeliInfoMgntEntity> selectDeliGridList(@Param("sBrandId") String sBrandId, @Param("dtGubun") String dtGubun, @Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sDlvStCd") String sDlvStCd, @Param("sSpplyId") String sSpplyId, @Param("sWhsId") String sWhsId, @Param("sItemNm") String sItemNm, GridRequest gridRequest )throws Exception;
43
+    int selectDeliGridCnt(@Param("sBrandId") String sBrandId, @Param("dtGubun") String dtGubun, @Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sDlvStCd") String sDlvStCd, @Param("sSpplyId") String sSpplyId, @Param("sWhsId") String sWhsId, @Param("sItemNm") String sItemNm )throws Exception;
44
+
40 45
 }

+ 3 - 0
src/main/java/com/oqpo/api/mapper/stinfo/ItemUnitMapper.java

@@ -25,4 +25,7 @@ public interface ItemUnitMapper {
25 25
     List<ItemUnitEntity> selectPopItemStoreUnitGridList(@Param("sBrandId") String sBrandId, @Param("sStoreId") String sStoreId, @Param("sItemNm") String sItemNm, @Param("sPodrPssblDvsn") String sPodrPssblDvsn, GridRequest gridRequest)throws Exception;
26 26
     int selectPopItemStoreUnitGridCnt(@Param("sBrandId") String sBrandId, @Param("sStoreId") String sStoreId, @Param("sItemNm") String sItemNm, @Param("sPodrPssblDvsn") String sPodrPssblDvsn)throws Exception;
27 27
 
28
+    int insertItemUnitInfo(@Param("userId") String userId, ItemUnitEntity entity) throws Exception;
29
+    int updateItemUnitInfo(@Param("userId") String userId, ItemUnitEntity entity) throws Exception;
30
+
28 31
 }

+ 45 - 0
src/main/java/com/oqpo/api/service/inoutmng/ShmtOdrService.java

@@ -695,6 +695,51 @@ public class ShmtOdrService extends CommonService {
695 695
             throw new RuntimeException();
696 696
         }
697 697
     }
698
+
699
+
700
+    /*
701
+      납품서 현황 그리드 리스트 조회
702
+     */
703
+    public GridResponse selectDeliGridList(String sBrandId, String dtGubun,  String fromDt, String toDt, String sDlvStCd, String sSpplyId, String sWhsId, String sItemNm, GridRequest gridRequest) throws Exception {
704
+        int gridPage = gridRequest.getGridPage();
705
+        int gridSize = gridRequest.getGridSize();
706
+
707
+        fromDt = fromDt == null ? null : fromDt.replace(".", "");
708
+        toDt = toDt == null ? null : toDt.replace(".", "");
709
+
710
+        int gridRecords = shmtOdrMapper.selectDeliGridCnt(sBrandId, dtGubun, fromDt, toDt, sDlvStCd, sSpplyId, sWhsId, sItemNm);
711
+        int gridTotal = fnCalculateGridTotal(gridSize, gridRecords);
712
+        List<DeliInfoMgntEntity> entities = shmtOdrMapper.selectDeliGridList(sBrandId, dtGubun, fromDt, toDt, sDlvStCd, sSpplyId, sWhsId, sItemNm, gridRequest);
713
+        List<Object> gridRows = entities.stream()
714
+                .map(m -> DeliDtlSearchListResponse.builder()
715
+                        .viewCd("R")
716
+                        .brandId(m.getBrandId() == null ? "" : m.getBrandId())
717
+                        .brandNm(m.getBrandNm() == null ? "" : m.getBrandNm())
718
+                        .dlvSttmtUnqNo(m.getDlvSttmtUnqNo() == null ? "" : m.getDlvSttmtUnqNo())
719
+                        .spplyId(m.getSpplyId() == null ? "" : m.getSpplyId())
720
+                        .spplyNm(m.getSpplyNm() == null ? "" : m.getSpplyNm())
721
+                        .dlvStCd(m.getDlvStCd() == null ? "" : m.getDlvStCd())
722
+                        .dlvStNm(m.getDlvStNm() == null ? "" : m.getDlvStNm())
723
+                        .whsId(m.getWhsId() == null ? "" :m.getWhsId())
724
+                        .location(m.getLocation() == null ? "" : m.getLocation())
725
+                        .whsNm(m.getWhsNm() == null ? "" : m.getWhsNm() + " - " + m.getLocationNm())
726
+                        .podrRegDt(m.getPodrRegDt() == null ? "" : m.getPodrRegDt())
727
+                        .dlvRegDt(m.getDlvRegDt() == null ? "" : m.getDlvRegDt())
728
+                        .dlvReqDt(m.getDlvReqDt() == null ? "" : m.getDlvReqDt())
729
+                        .dlvSchDt(m.getDlvSchDt() == null ? "" : m.getDlvSchDt())
730
+                        .itemId(m.getDeliDtlMgntInfo() == null ? "" : m.getDeliDtlMgntInfo().getItemId() == null ? "" : m.getDeliDtlMgntInfo().getItemId())
731
+                        .itemNm(m.getDeliDtlMgntInfo() == null ? "" : m.getDeliDtlMgntInfo().getItemNm() == null ? "" : m.getDeliDtlMgntInfo().getItemNm())
732
+                        .podrQty(m.getDeliDtlMgntInfo() == null ? 0 : m.getDeliDtlMgntInfo().getPodrQty() == null ? 0 : m.getDeliDtlMgntInfo().getPodrQty())
733
+                        .dlvQty(m.getDeliDtlMgntInfo() == null ? 0 : m.getDeliDtlMgntInfo().getDlvQty() == null ? 0 : m.getDeliDtlMgntInfo().getDlvQty())
734
+                        .unit(m.getDeliDtlMgntInfo() == null ? "" : m.getDeliDtlMgntInfo().getUnit() == null ? "" : m.getDeliDtlMgntInfo().getUnit())
735
+                        .unitAmt(m.getDeliDtlMgntInfo() == null ? 0 : m.getDeliDtlMgntInfo().getUnitAmt() == null ? 0 : m.getDeliDtlMgntInfo().getUnitAmt())
736
+                        .dlvMgrNm(m.getDlvMgrNm() == null ? "" : m.getDlvMgrNm())
737
+                        .dlvMgrMblNo(m.getDlvMgrMblNo() == null ? "" : m.getDlvMgrMblNo())
738
+                        .build())
739
+                .collect(Collectors.toList());
740
+        return GridResponse.toDTO(gridPage, gridTotal, gridRecords, gridRows);
741
+    }
742
+
698 743
 }
699 744
 
700 745
 

+ 5 - 2
src/main/java/com/oqpo/api/service/stinfo/ItemUnitService.java

@@ -179,9 +179,12 @@ public class ItemUnitService extends CommonService {
179 179
                     itemUnitMapper.updateItemUnitContEnd(entity.getBrandId(), entity.getBrandUnitUnqNo(), entity.getContEndDt());
180 180
                 }
181 181
             }
182
-            itemUnitMapper.insertMergItemUnitInfo(userId, entity);
183
-
184 182
 
183
+            if ("".equals(entity.getBrandUnitUnqNo())) {
184
+                itemUnitMapper.insertItemUnitInfo(userId, entity);
185
+            } else {
186
+                itemUnitMapper.updateItemUnitInfo(userId, entity);
187
+            }
185 188
         } catch (GlobalException e) {
186 189
             e.getStackTrace();
187 190
             throw new GlobalException(e.getSystemMessageCode());

+ 17 - 0
src/main/java/com/oqpo/api/web/controller/inoutmng/ShmtOdrController.java

@@ -157,4 +157,21 @@ public class ShmtOdrController {
157 157
         return ResponseEntity.ok(SaveResponse.toDTO(SystemMessageCode.SAVE_OK));
158 158
     }
159 159
 
160
+
161
+    /**
162
+     * 설명 : 납품서 현황 그리드 리스트
163
+     *
164
+     * @param DeliDtlGridRequest
165
+     * @return
166
+     * @throws Exception
167
+     */
168
+
169
+    @ApiImplicitParams({
170
+            @ApiImplicitParam(name = "X-AUTH-TOKEN", value = "CONN-KEY", required = true, dataType = "String", paramType = "header")
171
+    })
172
+    @ApiOperation(value = " 납품서 현황 그리드 리스트")
173
+    @PostMapping("/deli-grid-list")
174
+    public ResponseEntity<GridResponse> selectDeliGridList(@RequestBody @Valid DeliDtlGridRequest deliDtlGridRequest) throws Exception {
175
+        return ResponseEntity.ok(shmtOdrService.selectDeliGridList(deliDtlGridRequest.getSBrandId(), deliDtlGridRequest.getDtlGubun(), deliDtlGridRequest.getFromDt(), deliDtlGridRequest.getToDt(), deliDtlGridRequest.getSDlvStCd(),  deliDtlGridRequest.getSSpplyId(), deliDtlGridRequest.getSWhsId(), deliDtlGridRequest.getSItemNm(),  deliDtlGridRequest.toDTO(deliDtlGridRequest)));
176
+    }
160 177
 }

+ 48 - 0
src/main/java/com/oqpo/api/web/dto/request/inoutmng/DeliDtlGridRequest.java

@@ -0,0 +1,48 @@
1
+package com.oqpo.api.web.dto.request.inoutmng;
2
+
3
+import com.oqpo.api.web.dto.request.GridRequest;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Getter;
6
+import lombok.Setter;
7
+
8
+import javax.validation.constraints.NotBlank;
9
+
10
+
11
+@Getter
12
+@Setter
13
+public class DeliDtlGridRequest extends GridRequest {
14
+
15
+    @NotBlank
16
+    @ApiModelProperty(value = "브랜드아이디")
17
+    private String sBrandId;
18
+
19
+    @NotBlank
20
+    @ApiModelProperty(value = "날짜검색조건 - 1 발주생성일,  2 납품요청일 , 3 납품생성일")
21
+    private String dtlGubun;
22
+
23
+    @NotBlank
24
+    @ApiModelProperty(value = "시작일자")
25
+    private String fromDt;
26
+
27
+    @NotBlank
28
+    @ApiModelProperty(value = "종료일자")
29
+    private String toDt;
30
+
31
+    @ApiModelProperty(value = "납품상태코드")
32
+    private String sDlvStCd;
33
+
34
+    @ApiModelProperty(value = "공급업체코드")
35
+    private String sSpplyId;
36
+
37
+    @ApiModelProperty(value = "납품창고아이디")
38
+    private String sWhsId;
39
+
40
+    @ApiModelProperty(value = "품목명")
41
+    private String sItemNm;
42
+
43
+
44
+
45
+    protected DeliDtlGridRequest(Integer gridSize, Integer gridPage, String sidx, String sord, Boolean pagingYn, Integer gridFirst) {
46
+        super(gridSize, gridPage, sidx, sord, pagingYn, gridFirst);
47
+    }
48
+}

+ 4 - 1
src/main/java/com/oqpo/api/web/dto/request/stinfo/itemUnit/SaveStoreItemUnitInfolRequest.java

@@ -33,9 +33,12 @@ public class SaveStoreItemUnitInfolRequest {
33 33
     private String contEndDt;
34 34
 
35 35
 
36
-    @ApiModelProperty(value = "매장단가정리스트")
36
+    @ApiModelProperty(value = "매장단가정리스트")
37 37
     private List<SaveStoreItemUnitInfolRequest.SaveStoreItemUnit> gridUpdateData;
38 38
 
39
+    @ApiModelProperty(value = "매장단가신규리스트")
40
+    private List<SaveStoreItemUnitInfolRequest.SaveStoreItemUnit> gridInsertData;
41
+
39 42
 
40 43
     public List<StoreItemUnitEntity> toCodeEntities(List< SaveStoreItemUnitInfolRequest.SaveStoreItemUnit > gridData) {
41 44
         List<StoreItemUnitEntity> entities = new ArrayList<>();

+ 40 - 0
src/main/java/com/oqpo/api/web/dto/response/inoutmng/DeliDtlSearchListResponse.java

@@ -0,0 +1,40 @@
1
+package com.oqpo.api.web.dto.response.inoutmng;
2
+
3
+import com.fasterxml.jackson.annotation.JsonInclude;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.*;
6
+
7
+@Getter
8
+@Setter
9
+@Builder
10
+@AllArgsConstructor(access = AccessLevel.PROTECTED)
11
+@JsonInclude(JsonInclude.Include.ALWAYS)
12
+public class DeliDtlSearchListResponse {
13
+
14
+    @ApiModelProperty(value = "CRUD")
15
+    private String viewCd;
16
+
17
+    @ApiModelProperty(value = "브랜드아이디") private String brandId;
18
+    @ApiModelProperty(value = "브랜드명") private String brandNm;
19
+    @ApiModelProperty(value = "납품서번호") private String dlvSttmtUnqNo;
20
+    @ApiModelProperty(value = "공급사아이디") private String spplyId;
21
+    @ApiModelProperty(value = "공급사명") private String spplyNm;
22
+    @ApiModelProperty(value = "납품상태코드") private String dlvStCd;
23
+    @ApiModelProperty(value = "납품상태명") private String dlvStNm;
24
+    @ApiModelProperty(value = "납품창고아이디") private String whsId;
25
+    @ApiModelProperty(value = "납품LOCATION") private String location;
26
+    @ApiModelProperty(value = "납품창고명") private String whsNm;
27
+    @ApiModelProperty(value = "발주생성일") private String podrRegDt;
28
+    @ApiModelProperty(value = "납품생성일") private String dlvRegDt;
29
+    @ApiModelProperty(value = "납품요청일") private String dlvReqDt;
30
+    @ApiModelProperty(value = "납품예정일") private String dlvSchDt;
31
+    @ApiModelProperty(value = "품목아이디") private String itemId;
32
+    @ApiModelProperty(value = "품목명") private String itemNm;
33
+    @ApiModelProperty(value = "발주금액") private Integer podrQty;
34
+    @ApiModelProperty(value = "납품수량") private Integer dlvQty;
35
+    @ApiModelProperty(value = "단위") private String unit;
36
+    @ApiModelProperty(value = "납품금액") private Integer unitAmt;
37
+    @ApiModelProperty(value = "납품담당자명") private String dlvMgrNm;
38
+    @ApiModelProperty(value = "납품담당자연락처") private String dlvMgrMblNo;
39
+
40
+}

+ 87 - 0
src/main/resources/mybatis/sqlmaps/inoutmng/ShmtOdr.xml

@@ -355,4 +355,91 @@
355 355
     and    ptcl.podr_dtl_st_cd = 'POD0'
356 356
     </select>
357 357
 
358
+    <select id="selectDeliGridList" resultType="com.oqpo.api.entity.inoutmng.DeliInfoMgntEntity">
359
+        select info.brand_id, fn_brand_nm(info.brand_id) as brand_nm, info.dlv_sttmt_unq_no
360
+            , info.spply_id, info.spply_nm, info.dlv_st_cd, fn_code_nm(upper('dlv_st_cd'), info.dlv_st_cd) as dlv_st_nm
361
+            , info.whs_id, info.location, fn_whs_nm(info.brand_id, info.whs_id) as whs_nm
362
+            , fn_whs_location_nm(info.brand_id, info.whs_id, info.location) as location_nm
363
+            , date_format(info.podr_reg_dt, '%Y.%m.%d') as podr_reg_dt, date_format(info.dlv_req_dt, '%y.%m.%d') as dlv_req_dt
364
+            , date_format(info.dlv_reg_dt, '%Y.%m.%d') as dlv_req_dt, date_format(info.dlv_sch_dt, '%y.%m.%d') as dlv_sch_dt
365
+            , ptcl.item_id as 'deliDtlMgntInfo.item_id', ptcl.item_nm as 'deliDtlMgntInfo.item_nm'
366
+            , ptcl.podr_qty as 'deliDtlMgntInfo.podr_qty', ptcl.dlv_qty as 'deliDtlMgntInfo.dlv_qty'
367
+            , ptcl.unit as 'deliDtlMgntInfo.unit', ptcl.unit_amt as 'deliDtlMgntInfo.unit_amt'
368
+            , info.dlv_mgr_nm , info.dlv_mgr_mbl_no
369
+        from deli_info_mgnt info
370
+             , deli_dtl_ptcl ptcl
371
+        where 1 = 1
372
+        and info.dlv_sttmt_unq_no = ptcl.dlv_sttmt_unq_no
373
+        and info.brand_id = #{sBrandId}
374
+        <if test="dtGubun eq '1'.toString()">
375
+            and info.podr_reg_dt between #{fromDt} and #{toDt}  -- 1인경우 발주생성일로 조회
376
+        </if>
377
+        <if test="dtGubun eq '2'.toString()">
378
+            and info.dlv_req_dt between #{fromDt} and #{toDt}   -- 2인경우 납품요청일로 조회
379
+        </if>
380
+        <if test="dtGubun eq '3'.toString()">
381
+            and info.dlv_reg_dt between #{fromDt} and #{toDt}    -- 3인경우 납품생성일로 조회
382
+        </if>
383
+        <if test="sDlvStCd != null and sDlvStCd != ''">
384
+            and info.dlv_st_cd = #{sDlvStCd}  -- 납품상태
385
+        </if>
386
+        <if test="sSpplyId != null and sSpplyId != ''">
387
+            and info.spply_id = #{sSpplyId}
388
+        </if>
389
+        <if test="sWhsId != null and sWhsId != ''">
390
+            and info.whs_id = #{sWhsId}
391
+        </if>
392
+        <if test="sItemNm != null and sItemNm != ''">
393
+            and (ptcl.item_id like concat('%', #{sItemNm}, '%') or ptcl.item_nm like concat('%', #{sItemNm}, '%'))
394
+        </if>
395
+        <choose>
396
+            <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
397
+                <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
398
+                    <if test="gridRequest.sord == 'asc'.toString()">
399
+                        order by pch_req_unq_no asc
400
+                    </if>
401
+                    <if test="gridRequest.sord == 'desc'.toString()">
402
+                        order by pch_req_unq_no desc
403
+                    </if>
404
+                </if>
405
+            </when>
406
+            <otherwise>
407
+                order by pch_req_unq_no desc
408
+            </otherwise>
409
+        </choose>
410
+        <if test="gridRequest.pagingYn == true">
411
+            limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
412
+        </if>
413
+    </select>
414
+
415
+    <select id="selectDeliGridCnt" resultType="int">
416
+        select count(*)
417
+        from deli_info_mgnt info
418
+        , deli_dtl_ptcl ptcl
419
+        where 1 = 1
420
+        and info.dlv_sttmt_unq_no = ptcl.dlv_sttmt_unq_no
421
+        and info.brand_id = #{sBrandId}
422
+        <if test="dtGubun eq '1'.toString()">
423
+            and info.podr_reg_dt between #{fromDt} and #{toDt}  -- 1인경우 발주생성일로 조회
424
+        </if>
425
+        <if test="dtGubun eq '2'.toString()">
426
+            and info.dlv_req_dt between #{fromDt} and #{toDt}   -- 2인경우 납품요청일로 조회
427
+        </if>
428
+        <if test="dtGubun eq '3'.toString()">
429
+            and info.dlv_reg_dt between #{fromDt} and #{toDt}    -- 3인경우 납품생성일로 조회
430
+        </if>
431
+        <if test="sDlvStCd != null and sDlvStCd != ''">
432
+            and info.dlv_st_cd = #{sDlvStCd}  -- 납품상태
433
+        </if>
434
+        <if test="sSpplyId != null and sSpplyId != ''">
435
+            and info.spply_id = #{sSpplyId}
436
+        </if>
437
+        <if test="sWhsId != null and sWhsId != ''">
438
+            and info.whs_id = #{sWhsId}
439
+        </if>
440
+        <if test="sItemNm != null and sItemNm != ''">
441
+            and (ptcl.item_id like concat('%', #{sItemNm}, '%') or ptcl.item_nm like concat('%', #{sItemNm}, '%'))
442
+        </if>
443
+    </select>
444
+
358 445
 </mapper>

+ 34 - 0
src/main/resources/mybatis/sqlmaps/stinfo/ItemUnit.xml

@@ -129,6 +129,40 @@
129 129
 
130 130
     </update>
131 131
 
132
+    <insert id="insertItemUnitInfo" >
133
+        insert into  /**  insertItemUnitInfo */
134
+        brand_item_unit_info
135
+            (brand_unit_unq_no, brand_id, item_id, item_nm, spply_id,
136
+            spply_nm, cont_stt_dt, cont_end_dt, curr, unit,
137
+            unit_amt, lead_time, dlv_cndt, short_cont_file_no, spply_item_id,
138
+            unit_st_cd, stdd_qty, store_sale_stdd_qty, store_sale_unit_amt,
139
+            sys_reg_dttm, sys_reg_id, sys_chg_dttm, sys_chg_id)
140
+        values
141
+            ( fn_get_dealno(33,''), #{entity.brandId}, #{entity.itemId}, #{entity.itemNm}, #{entity.spplyId},
142
+            #{entity.spplyNm}, #{entity.contSttDt}, #{entity.contEndDt}, #{entity.curr}, #{entity.unit},
143
+            #{entity.unitAmt}, #{entity.leadTime}, #{entity.dlvCndt}, #{entity.shortContFileNo}, #{entity.spplyItemId},
144
+            #{entity.unitStCd}, #{entity.stddQty}, #{entity.storeSaleStddQty}, #{entity.storeSaleUnitAmt},
145
+            now(), #{userId}, now(), #{userId})
146
+    </insert>
147
+
148
+    <update id="updateItemUnitInfo" >
149
+            update brand_item_unit_info
150
+            set sys_chg_dttm    = now()
151
+            ,sys_chg_id      = #{userId}
152
+            ,cont_stt_dt     = #{entity.contSttDt}
153
+            ,cont_end_dt     = #{entity.contEndDt}
154
+            ,curr            = #{entity.curr}
155
+            ,unit            = #{entity.unit}
156
+            ,unit_amt        = #{entity.unitAmt}
157
+            ,lead_time       = #{entity.leadTime}
158
+            ,dlv_cndt        = #{entity.dlvCndt}
159
+            ,short_cont_file_no = #{entity.shortContFileNo}
160
+            ,unit_st_cd      = #{entity.unitStCd}
161
+            ,stdd_qty        = #{entity.stddQty}
162
+            ,store_sale_stdd_qty = #{entity.storeSaleStddQty}
163
+            ,store_sale_unit_amt = #{entity.storeSaleUnitAmt}
164
+        where brand_unit_unq_no = #{brandUnitUnqNo}
165
+    </update>
132 166
 
133 167
     <insert id="insertMergItemUnitInfo" >
134 168
         insert into  /** Merge insertMergItemUnitInfo */