소스 검색

입고처리 및 입고현황

dwkim 2 년 전
부모
커밋
31469a16e0

+ 1 - 1
src/main/java/com/oqpo/api/entity/stockmng/WhsProcInfoPtclEntity.java

@@ -75,7 +75,7 @@ public class WhsProcInfoPtclEntity implements Serializable {
75 75
     @ApiModelProperty(value = "품목명")
76 76
     private String itemNm;
77 77
     @ApiModelProperty(value = "입고금액")
78
-    private Integer whsAmt;
78
+    private Long whsAmt;
79 79
     @ApiModelProperty(value = "입고배송비")
80 80
     private String whsDlvChrg;
81 81
     @ApiModelProperty(value = "납품담당자아이디")

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

@@ -64,5 +64,7 @@ public interface ShmtOdrMapper {
64 64
 
65 65
     int updatePchPodrDtlStCd(@Param("userId") String userId, List<PchOdrDtlPtclEntity> gridUpdateData)throws Exception;
66 66
 
67
+    List<WhsProcInfoPtclEntity> selectWarehouseList(@Param("sBrandId") String sBrandId, @Param("sStoreId") String sStoreId, @Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sPchPodrUnqNo") String sPchPodrUnqNo, @Param("sSpplyId") String sSpplyId, @Param("sWhsId") String sWhsId, @Param("sItemNm") String sItemNm, GridRequest gridRequest  )throws Exception;
68
+    int selectWarehouseCnt(@Param("sBrandId") String sBrandId, @Param("sStoreId") String sStoreId,@Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sPchPodrUnqNo") String sPchPodrUnqNo, @Param("sSpplyId") String sSpplyId, @Param("sWhsId") String sWhsId, @Param("sItemNm") String sItemNm  )throws Exception;
67 69
 
68 70
 }

+ 3 - 0
src/main/java/com/oqpo/api/mapper/loanmng/LoanStateMapper.java

@@ -1,6 +1,7 @@
1 1
 package com.oqpo.api.mapper.loanmng;
2 2
 
3 3
 
4
+import com.oqpo.api.entity.inoutmng.DeliDtlMgntEntity;
4 5
 import com.oqpo.api.entity.loanmng.LoanMgntBaseInfoEntity;
5 6
 import com.oqpo.api.entity.loanmng.LoanMgntDtlHstEntity;
6 7
 import com.oqpo.api.web.dto.request.GridRequest;
@@ -34,5 +35,7 @@ public interface LoanStateMapper {
34 35
 
35 36
     int updateloanMinusInstProc(@Param("loanMgntUnqNo") String loanMgntUnqNo, @Param("storeId") String storeId, @Param("useAmtTotal") long useAmtTotal);
36 37
 
38
+    int updateListLoanMinusProc(@Param("userId") String userId, List<LoanMgntBaseInfoEntity> gridUpdateData );
39
+
37 40
 
38 41
 }

+ 112 - 9
src/main/java/com/oqpo/api/service/inoutmng/ShmtOdrService.java

@@ -5,6 +5,7 @@ import com.oqpo.api.entity.inoutmng.DeliDtlMgntEntity;
5 5
 import com.oqpo.api.entity.inoutmng.DeliInfoMgntEntity;
6 6
 import com.oqpo.api.entity.inoutmng.ShmtOdrBaseEntity;
7 7
 import com.oqpo.api.entity.inoutmng.ShmtOdrDtlEntity;
8
+import com.oqpo.api.entity.loanmng.LoanMgntBaseInfoEntity;
8 9
 import com.oqpo.api.entity.oper.FileEntity;
9 10
 import com.oqpo.api.entity.pomng.PchOdrBaseInfoEntity;
10 11
 import com.oqpo.api.entity.pomng.PchOdrDtlPtclEntity;
@@ -134,6 +135,10 @@ public class ShmtOdrService extends CommonService {
134 135
             List<PchOdrDtlPtclEntity> gridInsertData = instShmtOdrRequest.toCodeEntities(instShmtOdrRequest.getGridInsertData());
135 136
             List<PchOdrBaseInfoEntity> jobList = shmtOdrMapper.selectShmtJobDataList(instShmtOdrRequest.getBrandId(), gridInsertData);
136 137
             List<StckMgntBaseInfoEntity> stockList = new ArrayList<StckMgntBaseInfoEntity>();
138
+
139
+            //여신관련하여 출하지시시 납품수량이 발주수량보다 적을 경우 사용금액을 차액만큼 원복처리를 위한 데이타
140
+            List<LoanMgntBaseInfoEntity> loanList = new ArrayList<LoanMgntBaseInfoEntity>();
141
+
137 142
             String whsId = "";
138 143
             String location = "";
139 144
             String shmtWhsId = "";
@@ -170,6 +175,40 @@ public class ShmtOdrService extends CommonService {
170 175
                                 throw new GlobalException(SystemMessageCode.ERR_NONEXPRY);
171 176
                             }
172 177
                         }
178
+
179
+                        if (reqEntity.getShmtQty() < entity.getPchOdrDtlInfo().getPodrQty()) {
180
+                            // 출고수량보다 발주수량클경우 구매금액을 차감 처리.
181
+                            String loanMgntUnqNo = storeBaseInfoMapper.selectStoreLoanMgntUnqNo(entity.getStoreId());
182
+
183
+                            if (loanList.size() > 0) {
184
+                                String exchk = "N";
185
+                                for (int la = 0 ; la < loanList.size() ; la++ ) {
186
+                                    if (loanMgntUnqNo.equals(loanList.get(la).getLoanMgntUnqNo())) {
187
+                                        long sumAmt = loanList.get(la).getUseAmtTotal();
188
+                                        sumAmt = sumAmt + ((entity.getPchOdrDtlInfo().getPodrQty() - reqEntity.getShmtQty()) * entity.getPchOdrDtlInfo().getUnitAmt());
189
+                                        loanList.get(la).setUseAmtTotal(sumAmt);
190
+                                        exchk = "Y";
191
+                                        break;
192
+                                    }
193
+                                }
194
+
195
+                                if ("N".equals(exchk)) {
196
+                                    LoanMgntBaseInfoEntity loanEntity = new LoanMgntBaseInfoEntity();
197
+                                    loanEntity.setLoanMgntUnqNo(loanMgntUnqNo);
198
+                                    loanEntity.setStoreId(entity.getStoreId());
199
+                                    loanEntity.setUseAmtTotal((entity.getPchOdrDtlInfo().getPodrQty() - reqEntity.getShmtQty()) * entity.getPchOdrDtlInfo().getUnitAmt());
200
+                                    loanList.add(loanEntity);
201
+                                }
202
+                            } else {
203
+                                LoanMgntBaseInfoEntity loanEntity = new LoanMgntBaseInfoEntity();
204
+                                loanEntity.setLoanMgntUnqNo(loanMgntUnqNo);
205
+                                loanEntity.setStoreId(entity.getStoreId());
206
+                                loanEntity.setUseAmtTotal((entity.getPchOdrDtlInfo().getPodrQty() - reqEntity.getShmtQty()) * entity.getPchOdrDtlInfo().getUnitAmt());
207
+
208
+                                loanList.add(loanEntity);
209
+                            }
210
+                        }
211
+
173 212
                         expryDate = reqEntity.getExpryDate().replaceAll("\\.", "");
174 213
                         shmtQty = reqEntity.getShmtQty();
175 214
 
@@ -185,6 +224,7 @@ public class ShmtOdrService extends CommonService {
185 224
                     shmtBaseEntity.setShmtTotalAmt(shmtTotalAmt);
186 225
                     deliBaseEntity.setDlvAmt(shmtTotalAmt);
187 226
 
227
+
188 228
                     ShmtOdrDtlEntity inaddDtlEntity = new ShmtOdrDtlEntity();
189 229
                     inaddDtlEntity.setShmtReqUnqNo(shmtReqUnqNo);
190 230
                     int dtlNo = itemQty * 10;
@@ -388,6 +428,11 @@ public class ShmtOdrService extends CommonService {
388 428
                 System.out.println("============================" + stockList.size());
389 429
 
390 430
                 System.out.println("============================" + "end");
431
+                // 납품수량 변동발생시 처리
432
+                if (loanList.size() > 0) {
433
+                    loanStateMapper.updateListLoanMinusProc(userId, loanList);
434
+                }
435
+
391 436
 
392 437
                 // 재고수량 변동 및 안전비율계산(없애기로함) 처리후 저장함함
393 438
                 stockMngMapper.updateMinStockQty(userId, stockList);
@@ -578,7 +623,7 @@ public class ShmtOdrService extends CommonService {
578 623
     }
579 624
 
580 625
 
581
-    /* 공급사 납품서 생성 기 정보 */
626
+    /* 공급사 납품서 생성 기 정보 */
582 627
     public SpplyInvInitResponse selectSpplyShmtOdrInfo(String brandId, String spplyId, String pchPodrUnqNo) throws Exception {
583 628
         PchOdrBaseInfoEntity entity = shmtOdrMapper.selectSpplyShmtOdrInfo(brandId, spplyId, pchPodrUnqNo);
584 629
         List<PchOdrDtlPtclEntity> dtlEntity = shmtOdrMapper.selectSpplyShmtOdrList(pchPodrUnqNo);
@@ -597,13 +642,18 @@ public class ShmtOdrService extends CommonService {
597 642
             String expryDate = "";
598 643
             int shmtQty = 0;
599 644
             String dlvSttmtUnqNo = "";
645
+            String storeId = "" ;
646
+            int chgLoanAmt = 0 ;
600 647
 
601 648
             DeliInfoMgntEntity deliBaseEntity = new DeliInfoMgntEntity();
602 649
             List<DeliDtlMgntEntity> deliDtlList = new ArrayList<DeliDtlMgntEntity>();
603 650
 
651
+
604 652
             for (int i = 0; i < jobList.size(); i++) {
605 653
                 PchOdrBaseInfoEntity entity = jobList.get(i);
606 654
 
655
+
656
+
607 657
                 for (int j = 0; j < gridInsertData.size(); j++) {
608 658
                     PchOdrDtlPtclEntity reqEntity = gridInsertData.get(j);
609 659
                     if (entity.getPchPodrUnqNo().equals(reqEntity.getPchPodrUnqNo()) && entity.getPchOdrDtlInfo().getPchPodrDtlNo().equals(reqEntity.getPchPodrDtlNo())) {
@@ -618,6 +668,17 @@ public class ShmtOdrService extends CommonService {
618 668
                                 throw new GlobalException(SystemMessageCode.ERR_NONEXPRY);
619 669
                             }
620 670
                         }
671
+
672
+                        // 동일 납품처가 아니면 오류 처리
673
+                        if (!"".equals(storeId) && !storeId.equals(entity.getStoreId())) {
674
+                            throw new GlobalException(SystemMessageCode.ERR_NEQWHSID);
675
+                        }
676
+
677
+                        if (reqEntity.getShmtQty() < entity.getPchOdrDtlInfo().getPodrQty()) {
678
+
679
+                            chgLoanAmt = chgLoanAmt + (entity.getPchOdrDtlInfo().getPodrQty() - reqEntity.getShmtQty()) * entity.getPchOdrDtlInfo().getUnitAmt();
680
+                        }
681
+
621 682
                         expryDate = reqEntity.getExpryDate().replaceAll("\\.", "");
622 683
                         shmtQty = reqEntity.getShmtQty();
623 684
 
@@ -681,6 +742,13 @@ public class ShmtOdrService extends CommonService {
681 742
             shmtOdrMapper.insertDeliInfoMngt(userId, deliBaseEntity);
682 743
             shmtOdrMapper.insertDeliDtlPtcl(userId, deliDtlList);
683 744
 
745
+            // 변동금액 시 여신수정
746
+            if (chgLoanAmt > 0 ) {
747
+                String loanMgntUnqNo = storeBaseInfoMapper.selectStoreLoanMgntUnqNo(storeId);
748
+                loanStateMapper.updateloanMinusInstProc(loanMgntUnqNo, storeId, chgLoanAmt);
749
+            }
750
+
751
+
684 752
             for (int poi = 0; poi < gridInsertData.size(); poi++) {
685 753
                 gridInsertData.get(poi).setPodrDtlStCd("POD3");
686 754
             }
@@ -912,7 +980,7 @@ public class ShmtOdrService extends CommonService {
912 980
                             whsProcData.setDlvMgrMblNo(targetData.getDlvMgrMblNo());
913 981
                             whsProcData.setItemId(targetData.getDeliDtlMgntInfo().getItemId());
914 982
                             whsProcData.setItemNm(targetData.getDeliDtlMgntInfo().getItemNm());
915
-                            whsProcData.setWhsAmt(targetData.getDeliDtlMgntInfo().getUnitAmt() * whsProcData.getWhsQty());
983
+                            whsProcData.setWhsAmt(Long.valueOf(targetData.getDeliDtlMgntInfo().getUnitAmt() * whsProcData.getWhsQty()));
916 984
                             whsProcData.setWhsDlvChrg(null);
917 985
                             //whsProcData.setDlvMgrId(targetData.getdlvmgr);
918 986
                             whsProcData.setDlvCnfmDocFileNo(whsProcData.getDlvCnfmDocFileNo());
@@ -1023,15 +1091,8 @@ public class ShmtOdrService extends CommonService {
1023 1091
 
1024 1092
                 }
1025 1093
 
1026
-
1027
-
1028
-
1029 1094
             }
1030 1095
 
1031
-
1032
-
1033
-
1034
-
1035 1096
         } catch (GlobalException e) {
1036 1097
             //e.getStackTrace();
1037 1098
             e.printStackTrace();
@@ -1042,6 +1103,48 @@ public class ShmtOdrService extends CommonService {
1042 1103
         }
1043 1104
     }
1044 1105
 
1106
+
1107
+    /*
1108
+      입고 현황 그리드 리스트 조회  @Param("sBrandId") String sBrandId, @Param("sStoreId") String sStoreId,
1109
+      @Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sPchPodrUnqNo") String sPchPodrUnqNo, @Param("sSpplyId") String sSpplyId, @Param("sWhsId") String sWhsId, @Param("sItemNm") String sItemNm
1110
+     */
1111
+    public GridResponse selectWarehouseGridList(String sBrandId, String sStoreId,  String fromDt, String toDt, String sPchPodrUnqNo, String sSpplyId, String sWhsId, String sItemNm, GridRequest gridRequest) throws Exception {
1112
+        int gridPage = gridRequest.getGridPage();
1113
+        int gridSize = gridRequest.getGridSize();
1114
+
1115
+        fromDt = fromDt == null ? null : fromDt.replace(".", "");
1116
+        toDt = toDt == null ? null : toDt.replace(".", "");
1117
+
1118
+        int gridRecords = shmtOdrMapper.selectWarehouseCnt(sBrandId, sStoreId, fromDt, toDt, sPchPodrUnqNo, sSpplyId, sWhsId, sItemNm);
1119
+        int gridTotal = fnCalculateGridTotal(gridSize, gridRecords);
1120
+        List<WhsProcInfoPtclEntity> entities = shmtOdrMapper.selectWarehouseList(sBrandId, sStoreId, fromDt, toDt, sPchPodrUnqNo, sSpplyId, sWhsId, sItemNm, gridRequest);
1121
+        List<Object> gridRows = entities.stream()
1122
+                .map(m -> WarehouseSearchGridListResponse.builder()
1123
+                        .viewCd("R")
1124
+                        .pchPodrUnqNo(m.getPchPodrUnqNo() == null ? "" : m.getPchPodrUnqNo())
1125
+                        .pchPodrDtlNo(m.getPchPodrDtlNo() == null ? "" : m.getPchPodrDtlNo())
1126
+                        .dlvSttmtUnqNo(m.getDlvSttmtUnqNo() == null ? "" : m.getDlvSttmtUnqNo())
1127
+                        .dlvSttmtDtlNo(m.getDlvSttmtDtlNo() == null ? "" : m.getDlvSttmtDtlNo() )
1128
+                        .podrQty(m.getPodrQty() == null ? 0 : m.getPodrQty())
1129
+                        .dlvQty(m.getDlvQty() == null ? 0 : m.getDlvQty())
1130
+                        .whsQty(m.getWhsQty() == null ? 0 : m.getWhsQty())
1131
+                        .dlvReqDt(m.getDlvReqDt() == null ? "" : m.getDlvReqDt())
1132
+                        .dlvSchDt(m.getDlvSchDt() == null ? "" : m.getDlvSchDt())
1133
+                        .dlvCmpltDt(m.getDlvCmpltDt() == null ? "" : m.getDlvCmpltDt())
1134
+                        .whsCnfmNm(m.getWhsCnfmNm() == null ? "" : m.getWhsCnfmNm())
1135
+                        .dlvMgrNm(m.getDlvMgrNm() == null ? "" : m.getDlvMgrNm())
1136
+                        .dlvMgrTelNo(m.getDlvMgrTelNo() == null ? "" : m.getDlvMgrTelNo())
1137
+                        .itemId(m.getItemId() == null ? "" : m.getItemId())
1138
+                        .itemNm(m.getItemNm() == null ? "" : m.getItemNm())
1139
+                        .unit(m.getUnit() == null ? "" : m.getUnit())
1140
+                        .whsAmt(m.getWhsAmt() == null ? 0 : m.getWhsAmt())
1141
+                        .build())
1142
+                .collect(Collectors.toList());
1143
+        return GridResponse.toDTO(gridPage, gridTotal, gridRecords, gridRows);
1144
+    }
1145
+
1146
+
1147
+
1045 1148
 }
1046 1149
 
1047 1150
 

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

@@ -228,4 +228,22 @@ public class ShmtOdrController {
228 228
         shmtOdrService.saveWarehouseProc(userId,  saveWarehouseProcRequest);
229 229
         return ResponseEntity.ok(SaveResponse.toDTO(SystemMessageCode.SAVE_OK));
230 230
     }
231
+
232
+
233
+    /**
234
+     * 설명 : 입고 현황 그리드 리스트
235
+     *
236
+     * @param DeliDtlGridRequest
237
+     * @return
238
+     * @throws Exception
239
+     */
240
+
241
+    @ApiImplicitParams({
242
+            @ApiImplicitParam(name = "X-AUTH-TOKEN", value = "CONN-KEY", required = true, dataType = "String", paramType = "header")
243
+    })
244
+    @ApiOperation(value = " 입고 현황 그리드 리스트")
245
+    @PostMapping("/warehouse-grid-list")
246
+    public ResponseEntity<GridResponse> selectWarehouseGridList(@RequestBody @Valid WarehouseGridRequest warehouseGridRequest) throws Exception {
247
+        return ResponseEntity.ok(shmtOdrService.selectWarehouseGridList(warehouseGridRequest.getSBrandId(), warehouseGridRequest.getSStoreId(), warehouseGridRequest.getFromDt(), warehouseGridRequest.getToDt(), warehouseGridRequest.getSPchPodrUnqNo(),  warehouseGridRequest.getSSpplyId(), warehouseGridRequest.getSWhsId(), warehouseGridRequest.getSItemNm(),  warehouseGridRequest.toDTO(warehouseGridRequest)));
248
+    }
231 249
 }

+ 47 - 0
src/main/java/com/oqpo/api/web/dto/request/inoutmng/WarehouseGridRequest.java

@@ -0,0 +1,47 @@
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 WarehouseGridRequest extends GridRequest {
14
+
15
+    @NotBlank
16
+    @ApiModelProperty(value = "브랜드아이디")
17
+    private String sBrandId;
18
+
19
+    @ApiModelProperty(value = "매장아이디")
20
+    private String sStoreId;
21
+
22
+    @NotBlank
23
+    @ApiModelProperty(value = "시작일자")
24
+    private String fromDt;
25
+
26
+    @NotBlank
27
+    @ApiModelProperty(value = "종료일자")
28
+    private String toDt;
29
+
30
+    @ApiModelProperty(value = "발주번호")
31
+    private String sPchPodrUnqNo;
32
+
33
+    @ApiModelProperty(value = "공급업체코드")
34
+    private String sSpplyId;
35
+
36
+    @ApiModelProperty(value = "납품창고아이디")
37
+    private String sWhsId;
38
+
39
+    @ApiModelProperty(value = "품목명")
40
+    private String sItemNm;
41
+
42
+
43
+
44
+    protected WarehouseGridRequest(Integer gridSize, Integer gridPage, String sidx, String sord, Boolean pagingYn, Integer gridFirst) {
45
+        super(gridSize, gridPage, sidx, sord, pagingYn, gridFirst);
46
+    }
47
+}

+ 34 - 0
src/main/java/com/oqpo/api/web/dto/response/inoutmng/WarehouseSearchGridListResponse.java

@@ -0,0 +1,34 @@
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 WarehouseSearchGridListResponse {
13
+
14
+    @ApiModelProperty(value = "CRUD")
15
+    private String viewCd;
16
+
17
+    @ApiModelProperty(value = "발주번호") private String pchPodrUnqNo;
18
+    @ApiModelProperty(value = "발주항번") private String pchPodrDtlNo;
19
+    @ApiModelProperty(value = "납품서번호") private String dlvSttmtUnqNo;
20
+    @ApiModelProperty(value = "납품항번") private String dlvSttmtDtlNo;
21
+    @ApiModelProperty(value = "발주수량") private Integer podrQty;
22
+    @ApiModelProperty(value = "납품수량") private Integer dlvQty;
23
+    @ApiModelProperty(value = "입고수량") private Integer whsQty;
24
+    @ApiModelProperty(value = "납품요청일") private String dlvReqDt;
25
+    @ApiModelProperty(value = "납품예정일") private String dlvSchDt;
26
+    @ApiModelProperty(value = "납품일자") private String dlvCmpltDt;
27
+    @ApiModelProperty(value = "입고확인자") private String whsCnfmNm;
28
+    @ApiModelProperty(value = "납품자명") private String dlvMgrNm;
29
+    @ApiModelProperty(value = "납품자전화번호") private String dlvMgrTelNo;
30
+    @ApiModelProperty(value = "품목번호") private String itemId;
31
+    @ApiModelProperty(value = "품목명") private String itemNm;
32
+    @ApiModelProperty(value = "단위") private String unit;
33
+    @ApiModelProperty(value = "입고금액") private Long whsAmt;
34
+}

+ 72 - 1
src/main/resources/mybatis/sqlmaps/inoutmng/ShmtOdr.xml

@@ -117,7 +117,7 @@
117 117
                 , base.store_id , base.podr_mgr_nm , base.podr_mgr_tel_no
118 118
                 , fn_get_telno((select tel_no from store_base_info where store_id = base.store_id )) as deli_tel_no
119 119
                 , date_format(base.podr_dt,'%Y%m%d') as podr_dt
120
-                , base.spply_id, fn_spply_nm(base.spply_id) as spply_nm
120
+                , base.spply_id, fn_spply_nm(base.spply_id) as spply_nm, , base.store_id
121 121
         from   pch_odr_base_info base
122 122
         join pch_odr_dtl_ptcl ptcl on base.pch_podr_unq_no = ptcl.pch_podr_unq_no and ptcl.podr_dtl_st_cd = 'POD0'
123 123
         join item_base_info itm on ptcl.item_id = itm.item_id
@@ -738,4 +738,75 @@
738 738
             AND pch_podr_dlt_no = #{item.pchPodrDtlNo}
739 739
         </foreach>
740 740
     </update>
741
+
742
+    <select id="selectWarehouseList" resultType="com.oqpo.api.entity.stockmng.WhsProcInfoPtclEntity">
743
+       select whs.pch_podr_unq_no, whs.pch_podr_dtl_no, whs.dlv_sttmt_unq_no, whs.dlv_sttmt_dtl_no
744
+             , whs.podr_qty, whs.dlv_qty, whs.whs_qty
745
+             , date_format(whs.dlv_req_dt, '%Y.%m.%d') as dlv_req_dt
746
+             , date_format(whs.dlv_sch_dt, '%Y.%m.%d') as dlv_sch_dt
747
+             , date_format(whs.dlv_cmplt_dt, '%Y.%m.%d') as dlv_cmplt_dt
748
+             , whs.whs_cnfm_nm, whs.dlv_mgr_nm, whs.dlv_mgr_tel_no
749
+             , whs.item_id, whs.item_nm, whs.unit, whs.whs_amt, whs.dlv_cnfm_doc_file_no
750
+          from whs_proc_info_ptcl whs
751
+         where 1 = 1
752
+         and whs.whs_dt between #{fromDt} and #{toDt}
753
+         and   whs.brand_id = #{sBrandId}
754
+        <if test="sStoreId != null and sStoreId != ''">
755
+         and   whs.store_id = #{sStoreId}
756
+        </if>
757
+        <if test="sPchPodrUnqNo != null and sPchPodrUnqNo != ''">
758
+           and whs.pch_podr_unq_no like concat('%', #{sPchPodrUnqNo}, '%')
759
+        </if>
760
+        <if test="sSpplyId != null and sSpplyId != ''">
761
+           and whs.spply_id =  #{sSpplyId}
762
+        </if>
763
+        <if test="sWhsId != null and sWhsId != ''">
764
+           and whs.whs_id = #{sWhsId}
765
+        </if>
766
+        <if test="sItemNm != null and sItemNm != ''">
767
+           and (whs.item_id like concat('%', #{sItemNm}, '%') or whs.item_nm like concat('%', #{sItemNm}, '%'))
768
+        </if>
769
+
770
+        <choose>
771
+            <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
772
+                <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
773
+                    <if test="gridRequest.sord == 'asc'.toString()">
774
+                        order by pch_req_unq_no asc
775
+                    </if>
776
+                    <if test="gridRequest.sord == 'desc'.toString()">
777
+                        order by pch_req_unq_no desc
778
+                    </if>
779
+                </if>
780
+            </when>
781
+            <otherwise>
782
+                order by pch_req_unq_no desc
783
+            </otherwise>
784
+        </choose>
785
+        <if test="gridRequest.pagingYn == true">
786
+            limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
787
+        </if>
788
+    </select>
789
+
790
+    <select id="selectWarehouseCnt" resultType="int">
791
+        select count(*)
792
+        from whs_proc_info_ptcl whs
793
+        where 1 = 1
794
+        and whs.whs_dt between #{fromDt} and #{toDt}
795
+        and   whs.brand_id = #{sBrandId}
796
+        <if test="sStoreId != null and sStoreId != ''">
797
+            and   whs.store_id = #{sStoreId}
798
+        </if>
799
+        <if test="sPchPodrUnqNo != null and sPchPodrUnqNo != ''">
800
+            and whs.pch_podr_unq_no like concat('%', #{sPchPodrUnqNo}, '%')
801
+        </if>
802
+        <if test="sSpplyId != null and sSpplyId != ''">
803
+            and whs.spply_id =  #{sSpplyId}
804
+        </if>
805
+        <if test="sWhsId != null and sWhsId != ''">
806
+            and whs.whs_id = #{sWhsId}
807
+        </if>
808
+        <if test="sItemNm != null and sItemNm != ''">
809
+            and (whs.item_id like concat('%', #{sItemNm}, '%') or whs.item_nm like concat('%', #{sItemNm}, '%'))
810
+        </if>
811
+    </select>
741 812
 </mapper>

+ 12 - 1
src/main/resources/mybatis/sqlmaps/loanmng/LoanState.xml

@@ -161,9 +161,20 @@
161 161
     <update id="updateloanMinusInstProc">
162 162
         update /* updateloanMinusInstProc */ loan_mgnt_base_info
163 163
         set   use_amt_total = use_amt_total - #{useAmtTotal}
164
-           , acct_bal = acct_bal - #{acctBal}
165 164
         where loan_mgnt_unq_no = #{loanMgntUnqNo}
166 165
         and   store_id = #{storeId}
167 166
     </update>
168 167
 
168
+
169
+    <update id="updateListLoanMinusProc" >
170
+        /* updateListLoanMinusProc */
171
+        <foreach collection="gridUpdateData" item="item" separator=";">
172
+            update /* updateloanMinusInstProc */ loan_mgnt_base_info
173
+            set   use_amt_total = use_amt_total - #{item.useAmtTotal}
174
+                 , sys_chg_dttm = NOW()
175
+                 , sys_chg_id = #{userId}
176
+            where loan_mgnt_unq_no = #{item.loanMgntUnqNo}
177
+            and   store_id = #{item.storeId}
178
+        </foreach>
179
+    </update>
169 180
 </mapper>