123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747 |
- package com.oqpo.api.service.inoutmng;
- import com.oqpo.api.entity.inoutmng.DeliDtlMgntEntity;
- import com.oqpo.api.entity.inoutmng.DeliInfoMgntEntity;
- import com.oqpo.api.entity.inoutmng.ShmtOdrBaseEntity;
- import com.oqpo.api.entity.inoutmng.ShmtOdrDtlEntity;
- import com.oqpo.api.entity.oper.FileEntity;
- import com.oqpo.api.entity.pomng.PchOdrBaseInfoEntity;
- import com.oqpo.api.entity.pomng.PchOdrDtlPtclEntity;
- import com.oqpo.api.entity.stinfo.BrandEntity;
- import com.oqpo.api.entity.stinfo.SpplyEntity;
- import com.oqpo.api.entity.stinfo.StoreBaseInfoEntity;
- import com.oqpo.api.entity.stockmng.StckMgntBaseInfoEntity;
- import com.oqpo.api.entity.stockmng.StckMgntDtlHistEntity;
- import com.oqpo.api.enums.ChgDvsn;
- import com.oqpo.api.enums.InOutCd;
- import com.oqpo.api.enums.SystemMessageCode;
- import com.oqpo.api.exception.GlobalException;
- import com.oqpo.api.mapper.FileMapper;
- import com.oqpo.api.mapper.inoutmng.ShmtOdrMapper;
- import com.oqpo.api.mapper.pomng.PchOrdMapper;
- import com.oqpo.api.mapper.stinfo.BrandMapper;
- import com.oqpo.api.mapper.stinfo.StoreBaseInfoMapper;
- import com.oqpo.api.mapper.stinfo.SupplyMapper;
- import com.oqpo.api.mapper.stockmng.StockMngMapper;
- import com.oqpo.api.service.CommonService;
- import com.oqpo.api.service.pomng.PchOrdService;
- import com.oqpo.api.web.dto.request.GridRequest;
- import com.oqpo.api.web.dto.request.inoutmng.InstShmtOdrRequest;
- import com.oqpo.api.web.dto.request.inoutmng.SaveSpplyDlvRequest;
- import com.oqpo.api.web.dto.response.GridResponse;
- import com.oqpo.api.web.dto.response.inoutmng.*;
- import com.oqpo.api.web.dto.response.pomng.pchOrd.SpplyPoOdrSearchListResponse;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import org.springframework.transaction.annotation.Transactional;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.stream.Collectors;
- @Service
- @Slf4j
- public class ShmtOdrService extends CommonService {
- @Autowired
- private ShmtOdrMapper shmtOdrMapper;
- @Autowired
- private StockMngMapper stockMngMapper;
- @Autowired
- private PchOrdMapper pchOrdMapper;
- @Autowired
- private PchOrdService pchOrdService;
- @Autowired
- private BrandMapper brandMapper;
- @Autowired
- private SupplyMapper supplyMapper;
- @Autowired
- private StoreBaseInfoMapper storeBaseInfoMapper;
- @Autowired
- private FileMapper fileMapper;
- /*
- 출하 대상 그리드 리스트 조회
- */
- public GridResponse selectShmtTargetOdrGridList(String sBrandId, String fromDt, String toDt, String sShmtWhsId, String sWhsId, String sItemNm, GridRequest gridRequest) throws Exception {
- int gridPage = gridRequest.getGridPage();
- int gridSize = gridRequest.getGridSize();
- fromDt = fromDt == null ? null : fromDt.replace(".", "");
- toDt = toDt == null ? null : toDt.replace(".", "");
- int gridRecords = shmtOdrMapper.selectShmtTargetOdrGridCnt(sBrandId, fromDt, toDt, sShmtWhsId, sWhsId, sItemNm);
- int gridTotal = fnCalculateGridTotal(gridSize, gridRecords);
- List<PchOdrBaseInfoEntity> entities = shmtOdrMapper.selectShmtTargetOdrGridList(sBrandId, fromDt, toDt, sShmtWhsId, sWhsId, sItemNm, gridRequest);
- List<Object> gridRows = entities.stream()
- .map(m -> ShmtOdrSearchListResponse.builder()
- .viewCd("R")
- .brandId(m.getBrandId() == null ? "" : m.getBrandId())
- .brandNm(m.getBrandNm() == null ? "" : m.getBrandNm())
- .pchPodrUnqNo(m.getPchPodrUnqNo() == null ? "" : m.getPchPodrUnqNo())
- .pchPodrDtlNo(m.getPchOdrDtlInfo() == null ? "" : m.getPchOdrDtlInfo().getPchPodrDtlNo() == null ? "" : m.getPchOdrDtlInfo().getPchPodrDtlNo())
- .itemId(m.getPchOdrDtlInfo() == null ? "" : m.getPchOdrDtlInfo().getItemId() == null ? "" : m.getPchOdrDtlInfo().getItemId())
- .itemNm(m.getPchOdrDtlInfo() == null ? "" : m.getPchOdrDtlInfo().getItemNm() == null ? "" : m.getPchOdrDtlInfo().getItemNm())
- .whsId(m.getWhsId() == null ? "" : m.getWhsId())
- .whsNm(m.getWhsNm() == null ? "" : m.getWhsNm() + " - " + m.getLocationNm())
- .location(m.getLocation() == null ? "" : m.getLocation())
- .unitAmt(m.getPchOdrDtlInfo() == null ? 0 : m.getPchOdrDtlInfo().getUnitAmt() == null ? 0 : m.getPchOdrDtlInfo().getUnitAmt())
- .podrQty(m.getPchOdrDtlInfo() == null ? 0 : m.getPchOdrDtlInfo().getPodrQty() == null ? 0 : m.getPchOdrDtlInfo().getPodrQty())
- .shmtQty(m.getPchOdrDtlInfo() == null ? 0 : m.getPchOdrDtlInfo().getShmtQty() == null ? 0 : m.getPchOdrDtlInfo().getShmtQty())
- .stckQty(m.getPchOdrDtlInfo() == null ? 0 : m.getPchOdrDtlInfo().getStckQty() == null ? 0 : m.getPchOdrDtlInfo().getStckQty())
- .expryYn(m.getPchOdrDtlInfo() == null ? "" : m.getPchOdrDtlInfo().getExpryYn() == null ? "" : m.getPchOdrDtlInfo().getExpryYn())
- .expryPeriod(m.getPchOdrDtlInfo() == null ? 0 : m.getPchOdrDtlInfo().getExpryPeriod() == null ? 0 : m.getPchOdrDtlInfo().getExpryPeriod())
- .expryDate(m.getPchOdrDtlInfo() == null ? "" : m.getPchOdrDtlInfo().getExpryDate() == null ? "" : m.getPchOdrDtlInfo().getExpryDate())
- .podrAmt(m.getPchOdrDtlInfo() == null ? 0 : m.getPchOdrDtlInfo().getPodrAmt() == null ? 0 : m.getPchOdrDtlInfo().getPodrAmt())
- .dlvReqDt(m.getDlvReqDt() == null ? "" : m.getDlvReqDt())
- .shmtWhsId(m.getShmtWhsId() == null ? "" : m.getShmtWhsId())
- .shmtLocation(m.getShmtLocation() == null ? "" : m.getShmtLocation())
- .shmtWhsNm(m.getShmtWhsNm() == null ? "" : m.getShmtWhsNm() + " - " + m.getShmtLocationNm())
- .build())
- .collect(Collectors.toList());
- return GridResponse.toDTO(gridPage, gridTotal, gridRecords, gridRows);
- }
- /*
- 출하지시 저장
- */
- @Transactional
- public void instShmtOdr(String userId, InstShmtOdrRequest instShmtOdrRequest) throws Exception {
- try {
- // 출하창고 + 납품장소 동일여부 체크
- // 출하창고의 재고 와 출하수량 비교처리
- // 발주수량은 출하수량보다 크거나 같아야함
- // 유통기한 품목에 대해서는 유통기한일자 기입 필수
- // 출하 헤더 생성
- // 출하 상세 생성
- // 납품서 헤더 생성
- // 납품서 상세 생성성
- List<PchOdrDtlPtclEntity> gridInsertData = instShmtOdrRequest.toCodeEntities(instShmtOdrRequest.getGridInsertData());
- List<PchOdrBaseInfoEntity> jobList = shmtOdrMapper.selectShmtJobDataList(instShmtOdrRequest.getBrandId(), gridInsertData);
- List<StckMgntBaseInfoEntity> stockList = new ArrayList<StckMgntBaseInfoEntity>();
- String whsId = "";
- String location = "";
- String shmtWhsId = "";
- String shmtLocation = "";
- int itemQty = 0;
- int shmtTotalAmt = 0;
- String expryDate = "";
- int shmtQty = 0;
- String shmtReqUnqNo = "";
- String dlvSttmtUnqNo = "";
- ShmtOdrBaseEntity shmtBaseEntity = new ShmtOdrBaseEntity();
- List<ShmtOdrDtlEntity> shmtDtlList = new ArrayList<ShmtOdrDtlEntity>();
- DeliInfoMgntEntity deliBaseEntity = new DeliInfoMgntEntity();
- List<DeliDtlMgntEntity> deliDtlList = new ArrayList<DeliDtlMgntEntity>();
- for (int i = 0; i < jobList.size(); i++) {
- PchOdrBaseInfoEntity entity = jobList.get(i);
- for (int j = 0; j < gridInsertData.size(); j++) {
- PchOdrDtlPtclEntity reqEntity = gridInsertData.get(j);
- if (entity.getPchPodrUnqNo().equals(reqEntity.getPchPodrUnqNo()) && entity.getPchOdrDtlInfo().getPchPodrDtlNo().equals(reqEntity.getPchPodrDtlNo())) {
- if (reqEntity.getShmtQty() > entity.getPchOdrDtlInfo().getPodrQty()) {
- // 발주수량보다 출고수량이 많을수 없습니다.
- throw new GlobalException(SystemMessageCode.ERR_POSHNONQTY);
- }
- if ("Y".equals(entity.getPchOdrDtlInfo().getExpryYn())) {
- if (reqEntity.getExpryDate() == null || "".equals(reqEntity.getExpryDate())) {
- // 유통기한을 입력해주세요!
- throw new GlobalException(SystemMessageCode.ERR_NONEXPRY);
- }
- }
- expryDate = reqEntity.getExpryDate().replaceAll("\\.", "");
- shmtQty = reqEntity.getShmtQty();
- break;
- }
- }
- if (shmtWhsId.equals(entity.getShmtWhsId()) && shmtLocation.equals(entity.getShmtLocation()) && whsId.equals(entity.getWhsId()) && location.equals(entity.getLocation())) {
- // 추가 작업
- itemQty = itemQty + 1;
- shmtTotalAmt = shmtTotalAmt + (entity.getPchOdrDtlInfo().getUnitAmt() * shmtQty);
- shmtBaseEntity.setItemQty(itemQty);
- shmtBaseEntity.setShmtTotalAmt(shmtTotalAmt);
- deliBaseEntity.setDlvAmt(shmtTotalAmt);
- ShmtOdrDtlEntity inaddDtlEntity = new ShmtOdrDtlEntity();
- inaddDtlEntity.setShmtReqUnqNo(shmtReqUnqNo);
- int dtlNo = itemQty * 10;
- inaddDtlEntity.setShmtReqDtlNo(Integer.toString(dtlNo));
- inaddDtlEntity.setItemId(entity.getPchOdrDtlInfo().getItemId());
- inaddDtlEntity.setItemNm(entity.getPchOdrDtlInfo().getItemNm());
- inaddDtlEntity.setUnitAmt(entity.getPchOdrDtlInfo().getUnitAmt());
- inaddDtlEntity.setUnit(entity.getPchOdrDtlInfo().getUnit());
- inaddDtlEntity.setPodrQty(entity.getPchOdrDtlInfo().getPodrQty());
- inaddDtlEntity.setPodrAmt(entity.getPchOdrDtlInfo().getPodrAmt());
- inaddDtlEntity.setShmtQty(shmtQty);
- inaddDtlEntity.setShmtAmt(shmtQty * entity.getPchOdrDtlInfo().getUnitAmt());
- inaddDtlEntity.setExpryDate(expryDate);
- inaddDtlEntity.setPchPodrUnqNo(entity.getPchPodrUnqNo());
- inaddDtlEntity.setPchPodrDtlNo(entity.getPchOdrDtlInfo().getPchPodrDtlNo());
- inaddDtlEntity.setPchReqUnqNo(entity.getPchOdrDtlInfo().getPchReqUnqNo());
- inaddDtlEntity.setPchReqDtlNo(entity.getPchOdrDtlInfo().getPchReqDtlNo());
- shmtDtlList.add(inaddDtlEntity);
- //재고 수량정보 기입
- StckMgntBaseInfoEntity stckEntity = new StckMgntBaseInfoEntity();
- /*
- String dupYn = "N";
- for (int ski = 0 ; ski < stockList.size() ; ski++) {
- StckMgntBaseInfoEntity tmpEntity = stockList.get(ski);
- if (entity.getBrandId().equals(tmpEntity.getBrandId()) && entity.getShmtWhsId().equals(tmpEntity.getWhsId())
- && entity.getShmtLocation().equals(tmpEntity.getLocation()) && entity.getPchOdrDtlInfo().getItemId().equals(tmpEntity.getItemId())) {
- int tmpStckQty = tmpEntity.getStckQty() ;
- stockList.get(ski).setStckQty(tmpStckQty + shmtQty);
- dupYn = "Y";
- System.out.println("for============================" + Integer.toString(ski) + stockList.get(ski).getStckQty());
- break;
- }
- }
- if ("N".equals(dupYn)) {
- */
- stckEntity.setBrandId(entity.getBrandId());
- stckEntity.setWhsId(entity.getShmtWhsId());
- stckEntity.setLocation(entity.getShmtLocation());
- stckEntity.setItemId(entity.getPchOdrDtlInfo().getItemId());
- stckEntity.setStckQty(shmtQty);
- stckEntity.setRelationNo(shmtReqUnqNo);
- stockList.add(stckEntity);
- // }
- //납품서 상세 생성
- DeliDtlMgntEntity inaddDeliDtlEntity = new DeliDtlMgntEntity();
- inaddDeliDtlEntity.setDlvSttmtUnqNo(dlvSttmtUnqNo);
- inaddDeliDtlEntity.setDlvSttmtDtlNo(Integer.toString(dtlNo));
- inaddDeliDtlEntity.setPchPodrUnqNo(entity.getPchPodrUnqNo());
- inaddDeliDtlEntity.setPchPodrDtlNo(entity.getPchOdrDtlInfo().getPchPodrDtlNo());
- inaddDeliDtlEntity.setPchReqUnqNo(entity.getPchOdrDtlInfo().getPchReqUnqNo());
- inaddDeliDtlEntity.setPchReqDtlNo(entity.getPchOdrDtlInfo().getPchReqDtlNo());
- inaddDeliDtlEntity.setItemId(entity.getPchOdrDtlInfo().getItemId());
- inaddDeliDtlEntity.setItemNm(entity.getPchOdrDtlInfo().getItemNm());
- inaddDeliDtlEntity.setUnit(entity.getPchOdrDtlInfo().getUnit());
- inaddDeliDtlEntity.setUnitAmt(entity.getPchOdrDtlInfo().getUnitAmt());
- inaddDeliDtlEntity.setPodrQty(entity.getPchOdrDtlInfo().getPodrQty());
- inaddDeliDtlEntity.setDlvQty(shmtQty);
- inaddDeliDtlEntity.setPodrAmt(entity.getPchOdrDtlInfo().getPodrAmt());
- inaddDeliDtlEntity.setDlvAmt(shmtQty * entity.getPchOdrDtlInfo().getUnitAmt());
- inaddDeliDtlEntity.setExpryDate(expryDate);
- deliDtlList.add(inaddDeliDtlEntity);
- } else {
- // 신규로 출하건 생성함 //select fn_get_dealno(16, '') as col_cmd_unq_no
- if (shmtDtlList.size() > 0) {
- shmtOdrMapper.insertShmtOdrBase(userId, shmtBaseEntity);
- shmtOdrMapper.insertShmtOdrDtl(userId, shmtDtlList);
- shmtOdrMapper.insertDeliInfoMngt(userId, deliBaseEntity);
- shmtOdrMapper.insertDeliDtlPtcl(userId, deliDtlList);
- itemQty = 0;
- shmtTotalAmt = 0;
- }
- itemQty = 1;
- shmtTotalAmt = entity.getPchOdrDtlInfo().getUnitAmt() * shmtQty;
- whsId = entity.getWhsId();
- location = entity.getLocation();
- shmtWhsId = entity.getShmtWhsId();
- shmtLocation = entity.getShmtLocation();
- shmtReqUnqNo = fnGetDealNo(16, ""); // 출하지시번호
- dlvSttmtUnqNo = fnGetDealNo(15, ""); // 납품서번호
- // 출하지시
- shmtBaseEntity = new ShmtOdrBaseEntity();
- shmtDtlList = new ArrayList<ShmtOdrDtlEntity>();
- ShmtOdrDtlEntity inDtlEntity = new ShmtOdrDtlEntity();
- //납품서정보
- deliBaseEntity = new DeliInfoMgntEntity();
- deliDtlList = new ArrayList<DeliDtlMgntEntity>();
- DeliDtlMgntEntity deliDtlEntity = new DeliDtlMgntEntity();
- shmtBaseEntity.setShmtReqUnqNo(shmtReqUnqNo);
- shmtBaseEntity.setShmtReqStCd("SHM1");
- shmtBaseEntity.setShmtWhsId(entity.getShmtWhsId());
- shmtBaseEntity.setShmtLocation(entity.getShmtLocation());
- shmtBaseEntity.setWhsDvsn("W01");
- shmtBaseEntity.setBrandId(entity.getBrandId());
- shmtBaseEntity.setStoreId(entity.getStoreId());
- shmtBaseEntity.setPodrDvsn("OD01");
- shmtBaseEntity.setItemQty(itemQty);
- shmtBaseEntity.setShmtTotalAmt(shmtTotalAmt);
- shmtBaseEntity.setPodrMgrNm(entity.getPodrMgrNm());
- shmtBaseEntity.setDlvReqDt(entity.getDlvReqDt().replaceAll("\\.", ""));
- shmtBaseEntity.setWhsId(entity.getWhsId());
- shmtBaseEntity.setLocation(entity.getLocation());
- //납품서 데이타 생성
- deliBaseEntity.setDlvSttmtUnqNo(dlvSttmtUnqNo);
- deliBaseEntity.setSpplyId(null);
- deliBaseEntity.setSpplyNm(null);
- deliBaseEntity.setStoreId(entity.getStoreId());
- deliBaseEntity.setDlvAmt(shmtTotalAmt);
- deliBaseEntity.setDlvMgrNm(instShmtOdrRequest.getDlvMgrNm());
- deliBaseEntity.setDlvMgrTelNo(instShmtOdrRequest.getDlvMgrTelNo().replaceAll("-", ""));
- deliBaseEntity.setDlvMgrEmal(null);
- deliBaseEntity.setDlvMgrMblNo(null);
- deliBaseEntity.setVndrTelNo(entity.getDeliTelNo().replaceAll("-", ""));
- deliBaseEntity.setDlvStCd("DLV0");
- deliBaseEntity.setPodrRegDt(entity.getPodrDt());
- deliBaseEntity.setDlvReqDt(entity.getDlvReqDt().replaceAll("\\.", ""));
- deliBaseEntity.setDlvSchDt(instShmtOdrRequest.getDlvSchDt().replaceAll("\\.", ""));
- deliBaseEntity.setDlvCmpltDt(null);
- deliBaseEntity.setWhsId(entity.getWhsId());
- deliBaseEntity.setLocation(entity.getLocation());
- deliBaseEntity.setWhsDvsn("W01");
- deliBaseEntity.setBrandId(instShmtOdrRequest.getBrandId());
- //출하지시 상세 생성
- ShmtOdrDtlEntity inaddDtlEntity = new ShmtOdrDtlEntity();
- inaddDtlEntity.setShmtReqUnqNo(shmtReqUnqNo);
- inaddDtlEntity.setShmtReqDtlNo("10");
- inaddDtlEntity.setItemId(entity.getPchOdrDtlInfo().getItemId());
- inaddDtlEntity.setItemNm(entity.getPchOdrDtlInfo().getItemNm());
- inaddDtlEntity.setUnitAmt(entity.getPchOdrDtlInfo().getUnitAmt());
- inaddDtlEntity.setUnit(entity.getPchOdrDtlInfo().getUnit());
- inaddDtlEntity.setPodrQty(entity.getPchOdrDtlInfo().getPodrQty());
- inaddDtlEntity.setPodrAmt(entity.getPchOdrDtlInfo().getPodrAmt());
- inaddDtlEntity.setShmtQty(shmtQty);
- inaddDtlEntity.setShmtAmt(shmtQty * entity.getPchOdrDtlInfo().getUnitAmt());
- inaddDtlEntity.setExpryDate(expryDate);
- inaddDtlEntity.setPchPodrUnqNo(entity.getPchPodrUnqNo());
- inaddDtlEntity.setPchPodrDtlNo(entity.getPchOdrDtlInfo().getPchPodrDtlNo());
- inaddDtlEntity.setPchReqUnqNo(entity.getPchOdrDtlInfo().getPchReqUnqNo());
- inaddDtlEntity.setPchReqDtlNo(entity.getPchOdrDtlInfo().getPchReqDtlNo());
- shmtDtlList.add(inaddDtlEntity);
- StckMgntBaseInfoEntity stckEntity = new StckMgntBaseInfoEntity();
- stckEntity.setBrandId(entity.getBrandId());
- stckEntity.setWhsId(entity.getShmtWhsId());
- stckEntity.setLocation(entity.getShmtLocation());
- stckEntity.setItemId(entity.getPchOdrDtlInfo().getItemId());
- stckEntity.setStckQty(shmtQty);
- stckEntity.setRelationNo(shmtReqUnqNo);
- stockList.add(stckEntity);
- //납품서 상세 생성
- DeliDtlMgntEntity inaddDeliDtlEntity = new DeliDtlMgntEntity();
- inaddDeliDtlEntity.setDlvSttmtUnqNo(dlvSttmtUnqNo);
- inaddDeliDtlEntity.setDlvSttmtDtlNo("10");
- inaddDeliDtlEntity.setPchPodrUnqNo(entity.getPchPodrUnqNo());
- inaddDeliDtlEntity.setPchPodrDtlNo(entity.getPchOdrDtlInfo().getPchPodrDtlNo());
- inaddDeliDtlEntity.setPchReqUnqNo(entity.getPchOdrDtlInfo().getPchReqUnqNo());
- inaddDeliDtlEntity.setPchReqDtlNo(entity.getPchOdrDtlInfo().getPchReqDtlNo());
- inaddDeliDtlEntity.setItemId(entity.getPchOdrDtlInfo().getItemId());
- inaddDeliDtlEntity.setItemNm(entity.getPchOdrDtlInfo().getItemNm());
- inaddDeliDtlEntity.setUnit(entity.getPchOdrDtlInfo().getUnit());
- inaddDeliDtlEntity.setUnitAmt(entity.getPchOdrDtlInfo().getUnitAmt());
- inaddDeliDtlEntity.setPodrQty(entity.getPchOdrDtlInfo().getPodrQty());
- inaddDeliDtlEntity.setDlvQty(shmtQty);
- inaddDeliDtlEntity.setPodrAmt(entity.getPchOdrDtlInfo().getPodrAmt());
- inaddDeliDtlEntity.setDlvAmt(shmtQty * entity.getPchOdrDtlInfo().getUnitAmt());
- inaddDeliDtlEntity.setExpryDate(expryDate);
- deliDtlList.add(inaddDeliDtlEntity);
- }
- // 마지막 부분일 경우
- if (i == jobList.size() - 1) {
- if (shmtDtlList.size() > 0) {
- shmtOdrMapper.insertShmtOdrBase(userId, shmtBaseEntity);
- shmtOdrMapper.insertShmtOdrDtl(userId, shmtDtlList);
- shmtOdrMapper.insertDeliInfoMngt(userId, deliBaseEntity);
- shmtOdrMapper.insertDeliDtlPtcl(userId, deliDtlList);
- }
- }
- System.out.println("============================" + stockList.size());
- System.out.println("============================" + "end");
- // 재고수량 변동 및 안전비율계산(없애기로함) 처리후 저장함함
- stockMngMapper.updateMinStockQty(userId, stockList);
- //재고 이력 테이블에 데이타 생성 insertMultiStckMgntDtlHist
- List<StckMgntDtlHistEntity> stockHistList = new ArrayList<StckMgntDtlHistEntity>();
- for (int m = 0; m < stockList.size(); m++) {
- StckMgntBaseInfoEntity baseEntity = stockList.get(m);
- StckMgntDtlHistEntity sourceHist = new StckMgntDtlHistEntity();
- //String stckMgntDtlNo = fnGetDealNo(32,"");
- //String stckMgntDtlNo = commonMapper.selectDealNo(32, "");
- //String stckMgntDtlNo1 = commonMapper.selectDealNo(33, "");
- sourceHist.setStckMgntDtlNo(fnGetDealNo(32, "")); // 재고관리상세번호
- //System.out.println("seqno =========>" +sourceHist.getStckMgntDtlNo() + "===" + stckMgntDtlNo );
- sourceHist.setBrandId(baseEntity.getBrandId());
- sourceHist.setWhsId(baseEntity.getWhsId());
- sourceHist.setLocation(baseEntity.getLocation());
- sourceHist.setItemId(baseEntity.getItemId());
- sourceHist.setItemNm(baseEntity.getItemNm());
- sourceHist.setInoutCd(InOutCd.OUT.getCd()); // 출고
- sourceHist.setInoutQty(baseEntity.getStckQty());
- sourceHist.setChgDvsn(ChgDvsn.PURCHASE_OUT.getCd()); // 구매출고
- sourceHist.setRelationNo(baseEntity.getRelationNo());
- stockHistList.add(sourceHist);
- }
- stockMngMapper.insertMultiStckMgntDtlHist(userId, stockHistList);
- // 발주상태 변경처리
- // 1. 발주상세정보 상태 없데이트 한후 pchOrdMapper
- for (int poi = 0; poi < gridInsertData.size(); poi++) {
- gridInsertData.get(poi).setPodrDtlStCd("POD3");
- }
- pchOrdMapper.updateChangeStPodrDtl(userId, gridInsertData);
- // 발주 헤더 상태 처리 updateChgMultiPodrStCd
- String pchPodrUnqNo = "";
- for (int k = 0; k < gridInsertData.size(); k++) {
- if (!pchPodrUnqNo.equals(gridInsertData.get(k).getPchPodrUnqNo())) {
- pchPodrUnqNo = gridInsertData.get(k).getPchPodrUnqNo();
- String pchOdrStCd = pchOrdService.selectOdrDtlStatusList(pchPodrUnqNo);
- pchOrdMapper.updateChgPodrStCd(userId, pchOdrStCd, pchPodrUnqNo);
- }
- }
- }
- } catch (GlobalException e) {
- //e.getStackTrace();
- e.printStackTrace();
- throw new GlobalException(e.getSystemMessageCode());
- } catch (Exception e) {
- e.printStackTrace();
- throw new RuntimeException();
- }
- }
- /* 출하현황 */
- public GridResponse selectShmtSearchGridList(String sBrandId, String fromDt, String toDt, String sShmtWhsId, String sShmtReqStCd, String sWhsId, String sItemNm, GridRequest gridRequest) throws Exception {
- int gridPage = gridRequest.getGridPage();
- int gridSize = gridRequest.getGridSize();
- fromDt = fromDt == null ? null : fromDt.replace(".", "");
- toDt = toDt == null ? null : toDt.replace(".", "");
- int gridRecords = shmtOdrMapper.selectShmtSearchGridCnt(sBrandId, fromDt, toDt, sShmtWhsId, sShmtReqStCd, sWhsId, sItemNm);
- int gridTotal = fnCalculateGridTotal(gridSize, gridRecords);
- List<ShmtOdrBaseEntity> entities = shmtOdrMapper.selectShmtSearchGridList(sBrandId, fromDt, toDt, sShmtWhsId, sShmtReqStCd, sWhsId, sItemNm, gridRequest);
- List<Object> gridRows = entities.stream()
- .map(m -> ShmtOutSearchListResponse.builder()
- .viewCd("R")
- .shmtReqUnqNo(m.getShmtReqUnqNo() == null ? "" : m.getShmtReqUnqNo())
- .shmtReqDtlNo(m.getShmtOdrDtlInfo() == null ? "" : m.getShmtOdrDtlInfo().getShmtReqDtlNo() == null ? "" : m.getShmtOdrDtlInfo().getShmtReqDtlNo())
- .brandId(m.getBrandId() == null ? "" : m.getBrandId())
- .brandNm(m.getBrandNm() == null ? "" : m.getBrandNm())
- .pchPodrUnqNo(m.getShmtOdrDtlInfo() == null ? "" : m.getShmtOdrDtlInfo().getPchPodrUnqNo() == null ? "" : m.getShmtOdrDtlInfo().getPchPodrUnqNo())
- .pchPodrDtlNo(m.getShmtOdrDtlInfo() == null ? "" : m.getShmtOdrDtlInfo().getPchPodrDtlNo() == null ? "" : m.getShmtOdrDtlInfo().getPchPodrDtlNo())
- .shmtReqStCd(m.getShmtReqStCd() == null ? "" : m.getShmtReqStCd())
- .shmtReqStNm(m.getShmtReqStNm() == null ? "" : m.getShmtReqStNm())
- .itemId(m.getShmtOdrDtlInfo() == null ? "" : m.getShmtOdrDtlInfo().getItemId() == null ? "" : m.getShmtOdrDtlInfo().getItemId())
- .itemNm(m.getShmtOdrDtlInfo() == null ? "" : m.getShmtOdrDtlInfo().getItemNm() == null ? "" : m.getShmtOdrDtlInfo().getItemNm())
- .whsId(m.getWhsId() == null ? "" : m.getWhsId())
- .whsNm(m.getWhsNm() == null ? "" : m.getWhsNm() + " - " + m.getLocationNm())
- .location(m.getLocation() == null ? "" : m.getLocation())
- .shmtQty(m.getShmtOdrDtlInfo() == null ? 0 : m.getShmtOdrDtlInfo().getShmtQty() == null ? 0 : m.getShmtOdrDtlInfo().getShmtQty())
- .shmtAmt(m.getShmtOdrDtlInfo() == null ? 0 : m.getShmtOdrDtlInfo().getShmtAmt() == null ? 0 : m.getShmtOdrDtlInfo().getShmtAmt())
- .whsQty(m.getWhsProcInfo() == null ? 0 : m.getWhsProcInfo().getWhsQty() == null ? 0 : m.getWhsProcInfo().getWhsQty())
- .whsAmt(m.getWhsProcInfo() == null ? 0 : m.getWhsProcInfo().getWhsAmt() == null ? 0 : m.getWhsProcInfo().getWhsAmt())
- .whsDt(m.getWhsProcInfo() == null ? "" : m.getWhsProcInfo().getWhsDt() == null ? "" : m.getWhsProcInfo().getWhsDt())
- .whsCnfmNm(m.getWhsProcInfo() == null ? "" : m.getWhsProcInfo().getWhsCnfmNm() == null ? "" : m.getWhsProcInfo().getWhsCnfmNm())
- .dlvSttmtUnqNo(m.getDlvSttmtUnqNo() == null ? "" : m.getDlvSttmtUnqNo())
- .build())
- .collect(Collectors.toList());
- return GridResponse.toDTO(gridPage, gridTotal, gridRecords, gridRows);
- }
- /* 납품서 정보 */
- public InvInfoResponse selectInvInfo(String brandId, String dlvSttmtUnqNo) throws Exception {
- DeliInfoMgntEntity entity = shmtOdrMapper.selectInvInfo(brandId, dlvSttmtUnqNo);
- List<DeliDtlMgntEntity> dtlEntity = shmtOdrMapper.selectInvDtlList(brandId, dlvSttmtUnqNo);
- // 공급사
- // 배송처 정보
- BrandEntity brandEntity = brandMapper.selectBrandInfo(brandId);
- if ("DL01".equals(entity.getDeliDvsn())) {
- //브랜드정보 배송
- entity.setDlvBsnsRegno(brandEntity.getBsnsRegNo());
- entity.setDlvNm(brandEntity.getBrandNm());
- entity.setDlvOwnerNm(brandEntity.getOwnerNm());
- entity.setDlvAddr(brandEntity.getAddr1() + " " + brandEntity.getAddr2());
- } else {
- //공급사 배송
- SpplyEntity dlv_spplyEntity = supplyMapper.selectSpplyInfo(brandId, entity.getSpplyId());
- entity.setDlvBsnsRegno(dlv_spplyEntity.getBsnsRegNo());
- entity.setDlvNm(dlv_spplyEntity.getSpplyNm());
- entity.setDlvOwnerNm(dlv_spplyEntity.getOwnerNm());
- entity.setDlvAddr(dlv_spplyEntity.getAddr1() + " " + dlv_spplyEntity.getAddr2());
- }
- //발주처 정보
- if ("W01".equals(entity.getWhsDvsn())) {
- //납품창고 본사
- entity.setPoBsnsRegno(brandEntity.getBsnsRegNo());
- entity.setPoNm(brandEntity.getBrandNm());
- entity.setPoOwnerNm(brandEntity.getOwnerNm());
- entity.setPoAddr(brandEntity.getAddr1() + " " + brandEntity.getAddr2());
- } else {
- //납품창고 매장
- StoreBaseInfoEntity whs_storeBaseInfoEntity = storeBaseInfoMapper.selectStoreInfo(brandId, entity.getStoreId());
- entity.setPoBsnsRegno(whs_storeBaseInfoEntity.getBsnsRegNo());
- entity.setPoNm(whs_storeBaseInfoEntity.getStoreNm());
- entity.setPoOwnerNm(whs_storeBaseInfoEntity.getOwnerNm());
- entity.setPoAddr(whs_storeBaseInfoEntity.getAddr1() + " " + whs_storeBaseInfoEntity.getAddr2());
- }
- // 브랜드 로고 brand_logo_file_no
- List<FileEntity> logFileList = null;
- if (!"".equals(brandEntity.getBrandLogoFileNo())) {
- logFileList = fileMapper.selectFileList(brandEntity.getBrandLogoFileNo());
- } else {
- logFileList = new ArrayList<FileEntity>();
- }
- return InvInfoResponse.toDTO(entity, dtlEntity, logFileList);
- }
- /*
- 출하 대상 그리드 리스트 조회
- */
- public GridResponse selectSpplyTargetOdrGridList(String sBrandId, String fromDt, String toDt, String sSpplyId, String sWhsId, String sItemNm, GridRequest gridRequest) throws Exception {
- int gridPage = gridRequest.getGridPage();
- int gridSize = gridRequest.getGridSize();
- fromDt = fromDt == null ? null : fromDt.replace(".", "");
- toDt = toDt == null ? null : toDt.replace(".", "");
- int gridRecords = shmtOdrMapper.selectSpplyTargetOdrGridCnt(sBrandId, fromDt, toDt, sSpplyId, sWhsId, sItemNm);
- int gridTotal = fnCalculateGridTotal(gridSize, gridRecords);
- List<PchOdrBaseInfoEntity> entities = shmtOdrMapper.selectSpplyTargetOdrGridList(sBrandId, fromDt, toDt, sSpplyId, sWhsId, sItemNm, gridRequest);
- List<Object> gridRows = entities.stream()
- .map(m -> SpplyTargerOdrSearchListResponse.builder()
- .viewCd("R")
- .brandId(m.getBrandId() == null ? "" : m.getBrandId())
- .brandNm(m.getBrandNm() == null ? "" : m.getBrandNm())
- .pchPodrUnqNo(m.getPchPodrUnqNo() == null ? "" : m.getPchPodrUnqNo())
- .pchPodrDtlNo(m.getPchOdrDtlInfo() == null ? "" : m.getPchOdrDtlInfo().getPchPodrDtlNo() == null ? "" : m.getPchOdrDtlInfo().getPchPodrDtlNo())
- .itemId(m.getPchOdrDtlInfo() == null ? "" : m.getPchOdrDtlInfo().getItemId() == null ? "" : m.getPchOdrDtlInfo().getItemId())
- .itemNm(m.getPchOdrDtlInfo() == null ? "" : m.getPchOdrDtlInfo().getItemNm() == null ? "" : m.getPchOdrDtlInfo().getItemNm())
- .whsId(m.getWhsId() == null ? "" : m.getWhsId())
- .whsNm(m.getWhsNm() == null ? "" : m.getWhsNm() + " - " + m.getLocationNm())
- .location(m.getLocation() == null ? "" : m.getLocation())
- .unitAmt(m.getPchOdrDtlInfo() == null ? 0 : m.getPchOdrDtlInfo().getUnitAmt() == null ? 0 : m.getPchOdrDtlInfo().getUnitAmt())
- .podrQty(m.getPchOdrDtlInfo() == null ? 0 : m.getPchOdrDtlInfo().getPodrQty() == null ? 0 : m.getPchOdrDtlInfo().getPodrQty())
- .podrAmt(m.getPchOdrDtlInfo() == null ? 0 : m.getPchOdrDtlInfo().getPodrAmt() == null ? 0 : m.getPchOdrDtlInfo().getPodrAmt())
- .dlvReqDt(m.getDlvReqDt() == null ? "" : m.getDlvReqDt())
- .build())
- .collect(Collectors.toList());
- return GridResponse.toDTO(gridPage, gridTotal, gridRecords, gridRows);
- }
- /* 공급사 납품서 생성 최기 정보 */
- public SpplyInvInitResponse selectSpplyShmtOdrInfo(String brandId, String spplyId, String pchPodrUnqNo) throws Exception {
- PchOdrBaseInfoEntity entity = shmtOdrMapper.selectSpplyShmtOdrInfo(brandId, spplyId, pchPodrUnqNo);
- List<PchOdrDtlPtclEntity> dtlEntity = shmtOdrMapper.selectSpplyShmtOdrList(pchPodrUnqNo);
- return SpplyInvInitResponse.toDTO(entity, dtlEntity);
- }
- /* 공급사 납품서 생성 저장 */
- @Transactional
- public void saveSpplyInv(String userId, SaveSpplyDlvRequest saveSpplyDlvRequest) throws Exception {
- try {
- List<PchOdrDtlPtclEntity> gridInsertData = saveSpplyDlvRequest.toCodeEntities(saveSpplyDlvRequest.getGridInsertData());
- List<PchOdrBaseInfoEntity> jobList = shmtOdrMapper.selectShmtJobDataList(saveSpplyDlvRequest.getBrandId(), gridInsertData);
- int shmtTotalAmt = 0;
- String expryDate = "";
- int shmtQty = 0;
- String dlvSttmtUnqNo = "";
- DeliInfoMgntEntity deliBaseEntity = new DeliInfoMgntEntity();
- List<DeliDtlMgntEntity> deliDtlList = new ArrayList<DeliDtlMgntEntity>();
- for (int i = 0; i < jobList.size(); i++) {
- PchOdrBaseInfoEntity entity = jobList.get(i);
- for (int j = 0; j < gridInsertData.size(); j++) {
- PchOdrDtlPtclEntity reqEntity = gridInsertData.get(j);
- if (entity.getPchPodrUnqNo().equals(reqEntity.getPchPodrUnqNo()) && entity.getPchOdrDtlInfo().getPchPodrDtlNo().equals(reqEntity.getPchPodrDtlNo())) {
- if (reqEntity.getShmtQty() > entity.getPchOdrDtlInfo().getPodrQty()) {
- // 발주수량보다 출고수량이 많을수 없습니다.
- throw new GlobalException(SystemMessageCode.ERR_POSHNONQTY);
- }
- if ("Y".equals(entity.getPchOdrDtlInfo().getExpryYn())) {
- if (reqEntity.getExpryDate() == null || "".equals(reqEntity.getExpryDate())) {
- // 유통기한을 입력해주세요!
- throw new GlobalException(SystemMessageCode.ERR_NONEXPRY);
- }
- }
- expryDate = reqEntity.getExpryDate().replaceAll("\\.", "");
- shmtQty = reqEntity.getShmtQty();
- break;
- }
- }
- shmtTotalAmt = shmtTotalAmt + (entity.getPchOdrDtlInfo().getUnitAmt() * shmtQty);
- if (i == 0 ) {
- dlvSttmtUnqNo = fnGetDealNo(15, ""); // 납품서번호
- deliBaseEntity.setDlvSttmtUnqNo(dlvSttmtUnqNo);
- deliBaseEntity.setDlvSttmtUnqNo(dlvSttmtUnqNo);
- deliBaseEntity.setSpplyId(entity.getSpplyId());
- deliBaseEntity.setSpplyNm(entity.getSpplyNm());
- deliBaseEntity.setStoreId(entity.getStoreId());
- //deliBaseEntity.setDlvAmt(shmtTotalAmt);
- deliBaseEntity.setDlvMgrNm(saveSpplyDlvRequest.getDlvMgrNm());
- deliBaseEntity.setDlvMgrTelNo(saveSpplyDlvRequest.getDlvMgrTelNo().replaceAll("-", ""));
- deliBaseEntity.setDlvMgrEmal(null);
- deliBaseEntity.setDlvMgrMblNo(null);
- deliBaseEntity.setVndrTelNo(entity.getDeliTelNo().replaceAll("-", ""));
- deliBaseEntity.setDlvStCd("DLV0");
- deliBaseEntity.setPodrRegDt(entity.getPodrDt());
- deliBaseEntity.setDlvReqDt(entity.getDlvReqDt().replaceAll("\\.", ""));
- deliBaseEntity.setDlvSchDt(saveSpplyDlvRequest.getDlvSchDt().replaceAll("\\.", ""));
- deliBaseEntity.setDlvCmpltDt(null);
- deliBaseEntity.setWhsId(entity.getWhsId());
- deliBaseEntity.setLocation(entity.getLocation());
- if ("".equals(entity.getStoreId()) || entity.getStoreId() == null) {
- deliBaseEntity.setWhsDvsn("W01");
- } else {
- deliBaseEntity.setWhsDvsn("W02");
- }
- deliBaseEntity.setBrandId(saveSpplyDlvRequest.getBrandId());
- }
- int dtlNo = (i+1) * 10;
- DeliDtlMgntEntity inaddDeliDtlEntity = new DeliDtlMgntEntity();
- inaddDeliDtlEntity.setDlvSttmtUnqNo(dlvSttmtUnqNo);
- inaddDeliDtlEntity.setDlvSttmtDtlNo(Integer.toString(dtlNo));
- inaddDeliDtlEntity.setPchPodrUnqNo(entity.getPchPodrUnqNo());
- inaddDeliDtlEntity.setPchPodrDtlNo(entity.getPchOdrDtlInfo().getPchPodrDtlNo());
- inaddDeliDtlEntity.setPchReqUnqNo(entity.getPchOdrDtlInfo().getPchReqUnqNo());
- inaddDeliDtlEntity.setPchReqDtlNo(entity.getPchOdrDtlInfo().getPchReqDtlNo());
- inaddDeliDtlEntity.setItemId(entity.getPchOdrDtlInfo().getItemId());
- inaddDeliDtlEntity.setItemNm(entity.getPchOdrDtlInfo().getItemNm());
- inaddDeliDtlEntity.setUnit(entity.getPchOdrDtlInfo().getUnit());
- inaddDeliDtlEntity.setUnitAmt(entity.getPchOdrDtlInfo().getUnitAmt());
- inaddDeliDtlEntity.setPodrQty(entity.getPchOdrDtlInfo().getPodrQty());
- inaddDeliDtlEntity.setDlvQty(shmtQty);
- inaddDeliDtlEntity.setPodrAmt(entity.getPchOdrDtlInfo().getPodrAmt());
- inaddDeliDtlEntity.setDlvAmt(shmtQty * entity.getPchOdrDtlInfo().getUnitAmt());
- inaddDeliDtlEntity.setExpryDate(expryDate);
- deliDtlList.add(inaddDeliDtlEntity);
- }
- deliBaseEntity.setDlvAmt(shmtTotalAmt);
- shmtOdrMapper.insertDeliInfoMngt(userId, deliBaseEntity);
- shmtOdrMapper.insertDeliDtlPtcl(userId, deliDtlList);
- for (int poi = 0; poi < gridInsertData.size(); poi++) {
- gridInsertData.get(poi).setPodrDtlStCd("POD3");
- }
- pchOrdMapper.updateChangeStPodrDtl(userId, gridInsertData);
- // 발주 헤더 상태 처리 updateChgMultiPodrStCd
- String pchPodrUnqNo = "";
- for (int k = 0; k < gridInsertData.size(); k++) {
- if (!pchPodrUnqNo.equals(gridInsertData.get(k).getPchPodrUnqNo())) {
- pchPodrUnqNo = gridInsertData.get(k).getPchPodrUnqNo();
- String pchOdrStCd = pchOrdService.selectOdrDtlStatusList(pchPodrUnqNo);
- pchOrdMapper.updateChgPodrStCd(userId, pchOdrStCd, pchPodrUnqNo);
- }
- }
- } catch (GlobalException e) {
- //e.getStackTrace();
- e.printStackTrace();
- throw new GlobalException(e.getSystemMessageCode());
- } catch (Exception e) {
- e.printStackTrace();
- throw new RuntimeException();
- }
- }
- /*
- 납품서 현황 그리드 리스트 조회
- */
- public GridResponse selectDeliGridList(String sBrandId, String dtGubun, String fromDt, String toDt, String sDlvStCd, String sSpplyId, String sWhsId, String sItemNm, GridRequest gridRequest) throws Exception {
- int gridPage = gridRequest.getGridPage();
- int gridSize = gridRequest.getGridSize();
- fromDt = fromDt == null ? null : fromDt.replace(".", "");
- toDt = toDt == null ? null : toDt.replace(".", "");
- int gridRecords = shmtOdrMapper.selectDeliGridCnt(sBrandId, dtGubun, fromDt, toDt, sDlvStCd, sSpplyId, sWhsId, sItemNm);
- int gridTotal = fnCalculateGridTotal(gridSize, gridRecords);
- List<DeliInfoMgntEntity> entities = shmtOdrMapper.selectDeliGridList(sBrandId, dtGubun, fromDt, toDt, sDlvStCd, sSpplyId, sWhsId, sItemNm, gridRequest);
- List<Object> gridRows = entities.stream()
- .map(m -> DeliDtlSearchListResponse.builder()
- .viewCd("R")
- .brandId(m.getBrandId() == null ? "" : m.getBrandId())
- .brandNm(m.getBrandNm() == null ? "" : m.getBrandNm())
- .dlvSttmtUnqNo(m.getDlvSttmtUnqNo() == null ? "" : m.getDlvSttmtUnqNo())
- .spplyId(m.getSpplyId() == null ? "" : m.getSpplyId())
- .spplyNm(m.getSpplyNm() == null ? "" : m.getSpplyNm())
- .dlvStCd(m.getDlvStCd() == null ? "" : m.getDlvStCd())
- .dlvStNm(m.getDlvStNm() == null ? "" : m.getDlvStNm())
- .whsId(m.getWhsId() == null ? "" :m.getWhsId())
- .location(m.getLocation() == null ? "" : m.getLocation())
- .whsNm(m.getWhsNm() == null ? "" : m.getWhsNm() + " - " + m.getLocationNm())
- .podrRegDt(m.getPodrRegDt() == null ? "" : m.getPodrRegDt())
- .dlvRegDt(m.getDlvRegDt() == null ? "" : m.getDlvRegDt())
- .dlvReqDt(m.getDlvReqDt() == null ? "" : m.getDlvReqDt())
- .dlvSchDt(m.getDlvSchDt() == null ? "" : m.getDlvSchDt())
- .itemId(m.getDeliDtlMgntInfo() == null ? "" : m.getDeliDtlMgntInfo().getItemId() == null ? "" : m.getDeliDtlMgntInfo().getItemId())
- .itemNm(m.getDeliDtlMgntInfo() == null ? "" : m.getDeliDtlMgntInfo().getItemNm() == null ? "" : m.getDeliDtlMgntInfo().getItemNm())
- .podrQty(m.getDeliDtlMgntInfo() == null ? 0 : m.getDeliDtlMgntInfo().getPodrQty() == null ? 0 : m.getDeliDtlMgntInfo().getPodrQty())
- .dlvQty(m.getDeliDtlMgntInfo() == null ? 0 : m.getDeliDtlMgntInfo().getDlvQty() == null ? 0 : m.getDeliDtlMgntInfo().getDlvQty())
- .unit(m.getDeliDtlMgntInfo() == null ? "" : m.getDeliDtlMgntInfo().getUnit() == null ? "" : m.getDeliDtlMgntInfo().getUnit())
- .unitAmt(m.getDeliDtlMgntInfo() == null ? 0 : m.getDeliDtlMgntInfo().getUnitAmt() == null ? 0 : m.getDeliDtlMgntInfo().getUnitAmt())
- .dlvMgrNm(m.getDlvMgrNm() == null ? "" : m.getDlvMgrNm())
- .dlvMgrMblNo(m.getDlvMgrMblNo() == null ? "" : m.getDlvMgrMblNo())
- .build())
- .collect(Collectors.toList());
- return GridResponse.toDTO(gridPage, gridTotal, gridRecords, gridRows);
- }
- }
|