1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237 |
- require(['config'], function() {
- require([
- 'kakao.map.util'
- ], function($) {
- pageObj.init();
- });
- });
- /********************************************************
- --------------------------------------------------------
- - Object 목록 -
- --------------------------------------------------------
- * const gridColModel = {} : 화면 Grid Object *
- * let pageObj = {} : 화면공통 Object *
- * let listObj = {} : 목록화면 Object *
- * let viewObj = {} : 상세화면 Object *
- * let modifyObj = {} : 수정화면 Object *
- * let createObj = {} : 신규화면 Object *
- *******************************************************/
- /*화면 변수*/
- const RTNMNG03010_GRID_ID = '#ITP_RTNMNG03010_jqGrid';
- const RTNMNG03010_GRID_LIST = '#ITP_RTNMNG03010_jqGrid_list';
- const RTNMNG03010_GRID_PAGER = '#ITP_RTNMNG03010_jqGridPager';
- const RTNMNG03010_GRID_EMPTY = '#ITP_RTNMNG03010_jqGridEmpty';
- const RTNMNG03010_DETAIL_GRID_ID = '#ITP_RTNMNG03010_DETAIL_jqGrid';
- const RTNMNG03010_DETAIL_GRID_LIST = '#ITP_RTNMNG03010_DETAIL_jqGrid_list';
- const RTNMNG03010_DETAIL_GRID_PAGER = '#ITP_RTNMNG03010_DETAIL_jqGridPager';
- const RTNMNG03010_DETAIL_GRID_EMPTY = '#ITP_RTNMNG03010_DETAIL_jqGridEmpty';
- const RTNMNG03010_NDETAIL_GRID_ID = '#ITP_RTNMNG03010_NDETAIL_jqGrid';
- const RTNMNG03010_NDETAIL_GRID_LIST = '#ITP_RTNMNG03010_NDETAIL_jqGrid_list';
- const RTNMNG03010_NDETAIL_GRID_PAGER = '#ITP_RTNMNG03010_NDETAIL_jqGridPager';
- const RTNMNG03010_NDETAIL_GRID_EMPTY = '#ITP_RTNMNG03010_NDETAIL_jqGridEmpty';
- let ITP_FORM_RTNMNG03010_DETAIL_IS_WRITING = false;
- let RTNMNG03010_GRID_LAST_ROW_ID;
- let SCREEN_MODE ;
- /* 공통코드 리스트 */
- let ITP_COMMON_CD_RTN_DVSN = fn_make_common_cd_list(CODE_LIST, 'RTN_DVSN', false);
- let ITP_COMMON_CD_RTN_RSN_DVSN = fn_make_common_cd_list(CODE_LIST, 'RTN_RSN_DVSN', false);
- /*API URL*/
- let API_DETAIL_GRID_LIST = '/api/rtnmng/target-grid-list'; // 목록
- let API_DETAIL_REJECT = '/api/rtnmng/reject-rtnReq'; // 반품요청 선택한건 반려 처리
- let API_DETAIL_POPASS_CHK = '/api/rtnmng/rtn/chk-rtnOrd'; // 목록에서 선택한 요청건에 대해 발주가능여부 체크 함
- let API_DETAIL_PO_INIT_INFO = '/api/rtnmng/rtn/init-rtnOrd'; // 요청발주생성 오픈시 호출하여 데이타 세팅함 (/api/rtnmng/rtn/init-rtnOrd)
- let API_DETAIL_NEW_INIT_INFO = '/api/rtnmng/rtn/init-new-rtnOrd'; // 신규발주생성 오픈시 호출하여 데이타 세팅함
- let API_DETAIL_SAVE = '/api/rtnmng/rtn/save-rtnPo'; // 저장(/api/rtnmng/rtn/save-rtnPo)
- let API_DETAIL_PASSQTY = '/api/stock/mng/whs-passqty-list'; // 창고선택후 해당 창고의 출고가능수량을 가져옴
- /*화면 Grid ColModel*/
- const gridColModel = {
- list: [
- {
- index: 'RTN_REQ_UNQ_NO', name: 'rtnReqUnqNo',
- label: '반품요청고유번호',
- width: '13', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'RTN_REQ_DTL_NO', name: 'rtnReqDtlNo',
- label: '반품요청상세번호',
- width: '13', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'BRAND_ID', name: 'brandId',
- label: ITP_MSG_LOCALE.label.brandId, //브랜드ID
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'STORE_ID', name: 'storeId',
- label: ITP_MSG_LOCALE.label.storeId, //매장아이디
- width: '13', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'BRAND_NM', name: 'brandNm',
- label: ITP_MSG_LOCALE.label.brandNm, //브랜드명
- width: '10', fixed: false, align: 'left',
- sortable: false, hidden: false, classes: 'ui-ellipsis'
- },
- {
- index: 'RTN_WHS_NM', name: 'rtnWhsNm',
- label: '반품장소',
- width: '10', fixed: false, align: 'left',
- sortable: false, hidden: false, classes: 'ui-ellipsis'
- },
- {
- index: 'SPPLY_NM', name: 'spplyNm',
- label: '공급사명',
- width: '10', fixed: false, align: 'left',
- sortable: false, hidden: false, classes: 'ui-ellipsis'
- },
- {
- index: 'ITEM_ID', name: 'itemId',
- label: ITP_MSG_LOCALE.label.itemId, //품목아이디
- width: '12', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'ITEM_NM', name: 'itemNm',
- label: ITP_MSG_LOCALE.label.itemNm, //품목명
- minwidth: 100,
- width: '7', fixed: false, align: 'left',
- sortable: false, hidden: false, classes: 'ui-ellipsis'
- },
- {
- index: 'RTN_QTY', name: 'rtnQty',
- label: '반품수량',
- width: '8', fixed: false, align: 'right',
- sortable: false, hidden: false,
- formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
- },
- {
- index: 'RTN_DVSN_NM', name: 'rtnDvsnNm',
- label: '반품구분',
- width: '8', fixed: false, align: 'left',
- sortable: false, hidden: false
- },
- {
- index: 'RTN_AMT', name: 'rtnAmt',
- label: '반품금액',
- width: '10', fixed: false, align: 'right',
- sortable: false, hidden: true,
- formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' },
- classes: 'ui-ellipsis'
- },
- {
- index: 'RTN_REQ_DT', name: 'rtnReqDt',
- label: '반품요청일',
- width: '9', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'COL_REQ_DT', name: 'colReqDt',
- label: '수거요청일',
- width: '9', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'RTN_RSN_DVSN_NM', name: 'rtnRsnDvsnNm',
- label: '반품사유',
- minwidth: 130,
- width: '7', fixed: false, align: 'center',
- sortable: false, hidden: false
- }
- ],
- detail: [
- {
- index: 'VIEW_CD', name: 'viewCd',
- label: ITP_MSG_LOCALE.label.viewCd,
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'RTN_REQ_UNQ_NO', name: 'rtnReqUnqNo',
- label: '반품요청번호',
- width: '9', fixed: false, align: 'center',
- sortable: false, hidden: false, edittype: 'text',
- editable: false
- },
- {
- index: 'RTN_REQ_DTL_NO', name: 'rtnReqDtlNo',
- label: '반품요청항번',
- width: '8', fixed: false, align: 'center',
- sortable: true, editable: false, edittype: 'text',
- hidden: false
- },
- {
- index: 'ITEM_ID', name: 'itemId',
- label: ITP_MSG_LOCALE.label.itemId, // 품목아이디
- width: '10', fixed: false, align: 'center',
- sortable: false, editable: false, edittype: 'text',
- hidden: false
- },
- {
- index: 'ITEM_NM', name: 'itemNm',
- label: ITP_MSG_LOCALE.label.itemNm, //품목명
- width: '6', fixed: false, align: 'left',
- sortable: false, editable: false, edittype: 'text',
- hidden: false
- },
- {
- index: 'UNIT_AMT', name: 'unitAmt',
- label: ITP_MSG_LOCALE.label.unitAmt, //단가
- width: '5', fixed: false, align: 'right',
- sortable: false, editable: false, edittype: 'text',
- hidden: false,
- formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
- },
- {
- index: 'UNIT', name: 'unit',
- label: ITP_MSG_LOCALE.label.unit, //단위
- width: '5', fixed: false, align: 'center',
- sortable: false, editable: false, edittype: 'text',
- hidden: false
- },
- {
- index: 'RTN_REQ_QTY', name: 'rtnReqQty',
- label: '반품요청수량',
- width: '8', fixed: false, align: 'right',
- sortable: false, editable: false, edittype: 'text',
- hidden: false,
- formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
- },
- {
- index: 'RTN_QTY', name: 'rtnQty',
- label: '반품발주수량', classes: 'input_color',
- width: '8', fixed: false, align: 'right',
- sortable: false, editable: true, edittype: 'text',
- editrules: {required: true}, hidden: false,
- editoptions: {"onKeyup": "this.value=this.value.replace(/[^0-9]/g,'');", maxlength: 10},
- formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
- },
- {
- index: 'RTN_AMT', name: 'rtnAmt',
- label: '발주금액',
- width: '6', fixed: false, align: 'right',
- sortable: false, editable: false, edittype: 'text',
- hidden: false,
- formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
- },
- {
- index: 'RTN_DVSN_NM', name: 'rtnDvsnNm',
- label: '반품구분',
- width: '6', fixed: false, align: 'left',
- sortable: false, editable: false, edittype: 'text',
- hidden: false
- },
- {
- index: 'RTN_DVSN', name: 'rtnDvsn',
- label: '반품구분',
- width: '6', fixed: false, align: 'center',
- sortable: false, editable: false, edittype: 'text',
- hidden: true
- },
- {
- index: 'RTN_RSN_DVSN_NM', name: 'rtnRsnDvsnNm',
- label: '사유구분',
- width: '7', fixed: false, align: 'left',
- sortable: false, editable: false, edittype: 'text',
- hidden: false
- },
- {
- index: 'RTN_RSN_DVSN', name: 'rtnRsnDvsn',
- label: '사유구분',
- width: '7', fixed: false, align: 'left',
- sortable: false, editable: false, edittype: 'text',
- hidden: true
- },
- {
- index: 'RTN_RSN', name: 'rtnRsn',
- label: '사유',
- width: '11', fixed: false, align: 'center',
- sortable: false, editable: false, edittype: 'text',
- hidden: false
- },
- {
- index: 'BRAND_UNIT_UNQ_NO', name: 'brandUnitUnqNo',
- label: ITP_MSG_LOCALE.label.brandUnitUnqNo, //브랜드단가고유번호
- width: '10', fixed: false, align: 'center',
- sortable: false, editable: false, edittype: 'text',
- hidden: true
- },
- {
- index: 'STORE_UNIT_UNQ_NO', name: 'storeUnitUnqNo',
- label: ITP_MSG_LOCALE.label.storeUnitUnqNo, //매장단가고유번호
- width: '10', fixed: false, align: 'left',
- sortable: false, editable: false, edittype: 'text',
- hidden: true
- }
- ],
- ndetail: [
- {
- index: 'VIEW_CD', name: 'viewCd',
- label: ITP_MSG_LOCALE.label.viewCd,
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'RTN_REQ_UNQ_NO', name: 'rtnReqUnqNo',
- label: '반품요청번호',
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: true, edittype: 'text',
- editable: false
- },
- {
- index: 'RTN_REQ_DTL_NO', name: 'rtnReqDtlNo',
- label: '반품요청항번',
- width: '10', fixed: false, align: 'center',
- sortable: true, editable: false, edittype: 'text',
- hidden: true
- },
- {
- index: 'ITEM_ID', name: 'itemId',
- label: ITP_MSG_LOCALE.label.itemId, // 품목아이디
- width: '14', fixed: false, align: 'center',
- sortable: false, editable: false, edittype: 'text',
- hidden: false
- },
- {
- index: 'ITEM_NM', name: 'itemNm',
- label: ITP_MSG_LOCALE.label.itemNm, //품목명
- width: '10', fixed: false, align: 'left',
- sortable: false, editable: false, edittype: 'text',
- hidden: false
- },
- {
- index: 'UNIT_AMT', name: 'unitAmt',
- label: ITP_MSG_LOCALE.label.unitAmt, //단가
- width: '8', fixed: false, align: 'right',
- sortable: false, editable: false, edittype: 'text',
- hidden: false,
- formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
- },
- {
- index: 'UNIT', name: 'unit',
- label: ITP_MSG_LOCALE.label.unit, //단위
- width: '12', fixed: false, align: 'center',
- sortable: false, editable: false, edittype: 'text',
- hidden: false
- },
- {
- index: 'RTN_REQ_QTY', name: 'rtnReqQty',
- label: '반품요청수량',
- width: '10', fixed: false, align: 'right',
- sortable: false, editable: false, edittype: 'text',
- hidden: true,
- formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
- },
- {
- index: 'RTN_QTY', name: 'rtnQty',
- label: '반품발주수량', classes: 'input_color',
- width: '10', fixed: false, align: 'right',
- sortable: false, editable: true, edittype: 'text',
- editrules: {required: true}, hidden: false,
- editoptions: {"onKeyup": "this.value=this.value.replace(/[^0-9]/g,'');", maxlength: 10},
- formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
- },
- {
- index: 'RTN_AMT', name: 'rtnAmt',
- label: '발주금액',
- width: '10', fixed: false, align: 'right',
- sortable: false, editable: false, edittype: 'text',
- hidden: false,
- formatter:'integer', formatoptions: { defaultValue: '', thousandsSeparator: ',' }
- },
- {
- index: 'RTN_DVSN', name: 'rtnDvsn',
- label: '반품구분', classes: 'input_color',
- width: '10', fixed: false, align: 'center',
- sortable: false, editable: true, formatter: 'select', edittype: 'select',
- editoptions: {value: ITP_COMMON_CD_RTN_DVSN},
- editrules: {required: true}
- },
- {
- index: 'RTN_RSN_DVSN', name: 'rtnRsnDvsn',
- label: '사유구분', classes: 'input_color',
- width: '10', fixed: false, align: 'center',
- sortable: false, editable: true, formatter: 'select', edittype: 'select',
- editoptions: {value: ITP_COMMON_CD_RTN_RSN_DVSN},
- editrules: {required: true}
- },
- {
- index: 'RTN_RSN', name: 'rtnRsn',
- label: '반품사유', classes: 'input_color',
- width: '15', fixed: false, align: 'left',
- sortable: false, editable: true, edittype: 'text',
- editoptions: {maxlength: 200}
- },
- {
- index: 'BRAND_UNIT_UNQ_NO', name: 'brandUnitUnqNo',
- label: ITP_MSG_LOCALE.label.brandUnitUnqNo, //브랜드단가고유번호
- width: '10', fixed: false, align: 'center',
- sortable: false, editable: false, edittype: 'text',
- hidden: true
- },
- {
- index: 'STORE_UNIT_UNQ_NO', name: 'storeUnitUnqNo',
- label: ITP_MSG_LOCALE.label.storeUnitUnqNo, //매장단가고유번호
- width: '10', fixed: false, align: 'center',
- sortable: false, editable: false, edittype: 'text',
- hidden: true
- }
- ]
- };
- /*화면공통 Object*/
- let pageObj = {
- init: function () {
- this.ui.init();
- this.event.init();
- this.action();
- },
- ui: {
- init: function () {
- this.view();
- this.grid();
- this.ready();
- },
- view: function() {
- // 버튼 권한설정
- fn_proc_btn_auth('RTNMNG03010');
- // 공통코드 표시
- $('select').each(function() {
- if($(this).data('select-code')) {
- fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
- }
- });
-
- // 브랜드/매장
- $('#ITP_FORM_RTNMNG03010_SEARCH_SBRAND_ID').val(fn_make_user_info.get('brandId'));
- $('#ITP_FORM_RTNMNG03010_SEARCH_SSTORE_ID').val(fn_make_user_info.get('storeId'));
- // 조회일자 지정
- var now = new Date();
- $('#ITP_TAB_RTNMNG03010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
- $('#ITP_FORM_RTNMNG03010_SEARCH_FROM_DT').datepicker('setDate', new Date(now.setMonth(now.getMonth() - 1)));
- $('#ITP_FORM_RTNMNG03010_SEARCH_TO_DT').datepicker('setDate', new Date());
-
- },
- grid: function() {
- itp_fn_jqgrid_resize(RTNMNG03010_GRID_ID, RTNMNG03010_GRID_LIST, 'lg');
-
- },
- ready: function() {
- listObj.init();
- }
- },
- action: function () {
- var _this = this;
- // 검색 반품장소
- $('#ITP_FORM_RTNMNG03010_SSEARCH_SWHS_NM').on('click', function() {
- _this.popup('SW');
- });
- // 검색 반품장소 텍스트 삭제 버튼 클릭
- $('#ITP_FORM_RTNMNG03010_SDELETE_SWHS_NM').on('click', function() {
- $('#ITP_FORM_RTNMNG03010_SEARCH_SWHS_NM').val('');
- $('#ITP_FORM_RTNMNG03010_SEARCH_SWHS_ID').val('');
- });
-
- // 상세 출하창고
- $('#ITP_BTN_RTNMNG03010_DETAIL_SRH').on('click', function() {
- _this.popup('SHW');
- });
- // 검색 납품장소 텍스트 삭제 버튼 클릭
- $('#ITP_BTN_RTNMNG03010_DETAIL_MODIFY').on('click', function() {
- $('#ITP_FORM_RTNMNG03010_DETAIL_WHS_ID').val('');
- $('#ITP_FORM_RTNMNG03010_DETAIL_LOCATION').val('');
- $('#ITP_FORM_RTNMNG03010_DETAIL_WHS_NM').val('');
- });
-
- // 검색 공급사
- $('#ITP_FORM_RTNMNG03010_SSEARCH_SSPPLY_NM').on('click', function() {
- _this.popup('SS');
- });
- // 검색 텍스트 삭제 버튼 클릭
- $('#ITP_FORM_RTNMNG03010_SDELETE_SSPPLY_NM').on('click', function() {
- $('#ITP_FORM_RTNMNG03010_SEARCH_SSPPLY_NM').val('');
- $('#ITP_FORM_RTNMNG03010_SEARCH_SSPPLY_ID').val('');
-
- });
-
- // 검색 공급사
- $('#ITP_BTN_RTNMNG03010_NDETAIL_SPPLY_NM').on('click', function() {
- _this.popup('NS');
- });
- // 검색 텍스트 삭제 버튼 클릭
- $('#ITP_BTN_RTNMNG03010_SDELETE_SPPLY_NM').on('click', function() {
-
- var spplyId = $('#ITP_FORM_RTNMNG03010_NDETAIL_SPPLY_ID').val();
- var records = $(RTNMNG03010_NDETAIL_GRID_ID).getGridParam('reccount')
-
- if (spplyId != '' && records != 0 ) {
- // 공급업체 삭제시 품목까지 삭제 처리되어집니다. 삭제 하시겠습니까?
- var delSpply = {
- callBack: function(args) {
- $('#ITP_FORM_RTNMNG03010_NDETAIL_SPPLY_NM').val('');
- $('#ITP_FORM_RTNMNG03010_NDETAIL_SPPLY_ID').val('');
-
- // 품목그리드삭제 처리
- pageObj.grid.clearData('NPC');
- $('#ITP_FORM_RTNMNG03010_NDETAIL .fnRtnDodrTotalAmt').text('');
- }
- };
- itp_fn_modal_confirm(ITP_MSG_LOCALE.message.ajax.delAllItem, delSpply, null);
- } else {
- $('#ITP_FORM_RTNMNG03010_NDETAIL_SPPLY_NM').val('');
- $('#ITP_FORM_RTNMNG03010_NDETAIL_SPPLY_ID').val('')
- }
- });
-
- // 수거장소
- $('#ITP_BTN_RTNMNG03010_NDETAIL_SRH').on('click', function() {
- _this.popup('NHW');
- });
- // 수거장소 삭제 버튼 클릭
- $('#ITP_BTN_RTNMNG03010_NDETAIL_MODIFY').on('click', function() {
- $('#ITP_FORM_RTNMNG03010_NDETAIL_RTN_WHS_NM').val('');
- $('#ITP_FORM_RTNMNG03010_NDETAIL_RTN_WHS_ID').val('');
- $('#ITP_FORM_RTNMNG03010_NDETAIL_RTN_LOCATION').val('');
- });
-
- },
- popup: function (arg) {
- var popFn ;
- // 팝업
- if (arg == "SW") {
- popFn = this.callback.searWhs;
- } else if (arg == "SS") {
- popFn = this.callback.searSpply;
- } else if (arg == "SHW") {
- popFn = this.callback.searchRtnWhs;
- } else if (arg == "NS") {
- popFn = this.callback.searNSpply;
- } else if (arg == "NHW") {
- popFn = this.callback.searNWhs;
- } else if (arg == "REJ") {
- popFn = this.callback.poRej;
- }
-
- const key = {brandId:fn_make_user_info.get('brandId'),storeId:fn_make_user_info.get('storeId')};
- if (arg == "SW" ) {
- const keya = {brandId:fn_make_user_info.get('brandId'),storeId:fn_make_user_info.get('storeId'), whsDvsn:""};
- fn_call_popup('biz', 'BIZPOP_WHS_LOCATION', '#ITP_ASIDE', popFn, keya, 'S');
- } else if (arg == "SS" || arg == "NS" ) {
- fn_call_popup('biz', 'BIZPOP_STORE_SPPLY', '#ITP_ASIDE', popFn, key, 'S');
- } else if (arg == "SHW" || arg == "NHW") {
- const keyb = {brandId:fn_make_user_info.get('brandId'),storeId:"", whsDvsn:"W01"};
- fn_call_popup('biz', 'BIZPOP_WHS_LOCATION', '#ITP_ASIDE', popFn, keyb, 'S');
- } else if (arg == "REJ" ) {
- /* 선택ROW가져오기 */
- const rowKey = $(RTNMNG03010_GRID_ID).getGridParam('selrow');
- if (!rowKey) {
- return;
- }
-
- var selectedIds = $(RTNMNG03010_GRID_ID).getGridParam('selarrrow');
- if(selectedIds.length > 1) { // 1개만 선택
- itp_fn_modal_alert("반품요청 반려대상에 대해 하나만 선택해주세요.") ;
- return;
- }
-
- var selRowData ;
-
- for (var i=selectedIds.length-1; i>=0; i--) {
- selRowData = $(RTNMNG03010_GRID_ID).jqGrid('getRowData', selectedIds[i]);
- }
-
- const key1 = {rtnReqUnqNo:selRowData.rtnReqUnqNo, storeId:selRowData.storeId};
-
- fn_call_popup('biz', 'BIZPOP_RTN_PO_REJECT', '#ITP_ASIDE', popFn, key1, 'S');
- }
-
- },
- callback: {
- searWhs: function(rowDataPop) {
- if(rowDataPop) {
- $('#ITP_FORM_RTNMNG03010_SEARCH_SWHS_NM').val(rowDataPop.whsNm);
- $('#ITP_FORM_RTNMNG03010_SEARCH_SWHS_ID').val(rowDataPop.whsId);
- }
-
- },
- searSpply: function(rowDataPop) {
- if(rowDataPop) {
- $('#ITP_FORM_RTNMNG03010_SEARCH_SSPPLY_NM').val(rowDataPop.spplyNm);
- $('#ITP_FORM_RTNMNG03010_SEARCH_SSPPLY_ID').val(rowDataPop.spplyId);
- }
-
- },
- searNSpply: function(rowDataPop) {
- if(rowDataPop) {
- var pspplyId = $('#ITP_FORM_RTNMNG03010_NDETAIL_SPPLY_ID').val();
- if (pspplyId == "") {
- $('#ITP_FORM_RTNMNG03010_NDETAIL_SPPLY_NM').val(rowDataPop.spplyNm);
- $('#ITP_FORM_RTNMNG03010_NDETAIL_SPPLY_ID').val(rowDataPop.spplyId);
- } else {
- var records = $(RTNMNG03010_NDETAIL_GRID_ID).getGridParam('reccount')
- if (records != 0) {
- if (pspplyId != rowDataPop.spplyId ) {
- itp_fn_modal_alert( "추가한 품목의 공급사와 서로 틀립니다 !");
- return ;
- }
- }
- }
- }
-
- },
- searchRtnWhs: function(rowDataPop) {
- if(rowDataPop) {
- $('#ITP_FORM_RTNMNG03010_DETAIL_WHS_NM').val(rowDataPop.whsNm + " - " + rowDataPop.locationNm);
- $('#ITP_FORM_RTNMNG03010_DETAIL_WHS_ID').val(rowDataPop.whsId);
- $('#ITP_FORM_RTNMNG03010_DETAIL_LOCATION').val(rowDataPop.location);
- }
- },
- searNWhs: function(rowDataPop) {
- if(rowDataPop) {
- $('#ITP_FORM_RTNMNG03010_NDETAIL_RTN_WHS_NM').val(rowDataPop.whsNm + " - " + rowDataPop.locationNm);
- $('#ITP_FORM_RTNMNG03010_NDETAIL_RTN_WHS_ID').val(rowDataPop.whsId);
- $('#ITP_FORM_RTNMNG03010_NDETAIL_RTN_LOCATION').val(rowDataPop.location);
- }
- },
- poRej: function(rowDataPop) {
- if(rowDataPop) {
- if (rowDataPop.retVal == "Y") {
- modifyObj.button.rejectSave(rowDataPop);
- }
- }
- }
-
- },
- event: {
- init: function () {
- this.button();
- },
- button: function () {
- // 버튼 클릭 이벤트
- $('button').each(function() {
- var id = $(this).attr('id');
- $(this).on('click', function() {
- switch (id) {
- case 'ITP_BTN_RTNMNG03010_SRH' : listObj.button.search(); break; // 조회 버튼 클릭
- case 'ITP_BTN_RTNMNG03010_NEWCREATE' : listObj.button.chkpo(); break; // 반품발주생성 버튼
- case 'ITP_BTN_RTNMNG03010_POCREATE' : listObj.button.newpocreate(); break; // 반품신규생성 버튼
- case 'ITP_BTN_RTNMNG03010_POREJECT' : listObj.button.reject(); break; // 반려
- case 'ITP_BTN_RTNMNG03010_RTNPO' : modifyObj.button.save(); break; // 발주
- case 'ITP_BTN_RTNMNG03010_CANCELLIST' : modifyObj.button.cancel(); break; // 취소/목록 버튼
- case 'ITP_BTN_RTNMNG03010_NDETAIL_ADDROW' : pageObj.grid.button.addRow(); break; // 품목추가
- case 'ITP_BTN_RTNMNG03010_NDETAIL_DELROW' : pageObj.grid.button.delRow(); break; // 품목삭제
- case 'ITP_BTN_RTNMNG03010_EXCEL' : listObj.excelDown(); break; // 엑셀다운로드
- }
- });
- });
-
- $('body').on('click', function(e) {
-
- var gridId = ((SCREEN_MODE === 'NPC') ? RTNMNG03010_NDETAIL_GRID_ID : RTNMNG03010_DETAIL_GRID_ID).replace('#', '');
- var rids = $( (SCREEN_MODE === 'NPC') ? RTNMNG03010_NDETAIL_GRID_ID : RTNMNG03010_DETAIL_GRID_ID).jqGrid('getDataIDs');
- var last_row_id = rids[rids.length - 1];
-
- itp_fn_grid_reset_selection(e, last_row_id, gridId, (SCREEN_MODE === 'NPC') ? 'RTNMNG03010_NDETAIL' : 'RTNMNG03010_DETAIL');
- pageObj.grid.recal();
- });
- }
- },
- switchScreen: function(mode) {
- $('.itp_det_head').find('button[id^="ITP_BTN_RTNMNG03010_"]').each(function(i) {
- $(this).hide();
- });
- $('#ITP_TAB_RTNMNG03010').find('div[id$="_CONTAINER"]').each(function(i) {
- $(this).hide();
- });
- if(mode == 'LIST') { // 목록
- itp_fn_fire_window_resize();
- $('#ITP_AJAX_RTNMNG03010_LIST_CONTAINER').show();
- $('#ITP_FORM_RTNMNG03010_SDELETE_SSPPLY_NM').show();
- $('#ITP_FORM_RTNMNG03010_SDELETE_SWHS_NM').show();
- fn_show_btn_auth_array(['#ITP_BTN_RTNMNG03010_SRH', '#ITP_BTN_RTNMNG03010_NEWCREATE','#ITP_BTN_RTNMNG03010_POCREATE', '#ITP_BTN_RTNMNG03010_POREJECT']);
- // $('#ITP_FORM_RTNMNG03010_DETAIL_SBRAND_ID').val(fn_make_user_info.get('brandId'));
- // $('#ITP_FORM_RTNMNG03010_DETAIL_SSTORE_ID').val(fn_make_user_info.get('storeId'));
- $('#ITP_BTN_RTNMNG03010_EXCEL').show();
- SCREEN_MODE = 'LIST' ;
-
- } else if(mode == 'NPC') { // 신규발주등록
- $('#ITP_AJAX_RTNMNG03010_NDETAIL_CONTAINER').show();
- $('#ITP_BTN_RTNMNG03010_SDELETE_SPPLY_NM').show();
- $('#ITP_BTN_RTNMNG03010_NDETAIL_MODIFY').show();
- fn_show_btn_auth_array(['#ITP_BTN_RTNMNG03010_RTNPO', '#ITP_BTN_RTNMNG03010_CANCELLIST', '#ITP_BTN_RTNMNG03010_NDETAIL_ADDROW','#ITP_BTN_RTNMNG03010_NDETAIL_DELROW']);
- $('#ITP_FORM_RTNMNG03010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
- SCREEN_MODE = 'NPC' ;
- pageObj.grid.init('NPC');
-
- } else if(mode == 'POC') { // 구매요청 발주
- $('#ITP_AJAX_RTNMNG03010_DETAIL_CONTAINER').show();
- $('#ITP_BTN_RTNMNG03010_DETAIL_MODIFY').show();
- fn_show_btn_auth_array(['#ITP_BTN_RTNMNG03010_RTNPO', '#ITP_BTN_RTNMNG03010_CANCELLIST']);
-
- $('#ITP_FORM_RTNMNG03010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
- $('#ITP_FORM_RTNMNG03010_DETAIL_STORE_ID').val(fn_make_user_info.get('storeId'));
- SCREEN_MODE = 'POC' ;
- }
- },
- grid: {
- init: function(mode, gridRows) {
- this.gridId = (mode === 'NPC') ? RTNMNG03010_NDETAIL_GRID_ID : RTNMNG03010_DETAIL_GRID_ID;
- this.gridList = (mode === 'NPC') ? RTNMNG03010_NDETAIL_GRID_LIST : RTNMNG03010_DETAIL_GRID_LIST;
- this.gridEmpty = (mode === 'NPC') ? RTNMNG03010_NDETAIL_GRID_EMPTY : RTNMNG03010_DETAIL_GRID_EMPTY;
- this.gridRows = gridRows;
- this.unload();
- this.load(mode, gridRows);
-
- },
- gridId: '',
- button: {
- addRow: function() {
- // 팝업
- var popFn = function(rowDataPop) {
- // 기존등록 데이터
- var exists = '';
- const rowData = $(RTNMNG03010_NDETAIL_GRID_ID).getRowData();
- $.each(rowData, function(key, value) {
- if (value.viewCd != "D") {
- exists = exists + value.brandUnitUnqNo + ';';
- }
- });
-
- var diffchk = "N";
- var spplyId = $('#ITP_FORM_RTNMNG03010_NDETAIL_SPPLY_ID').val();
- var spplyNm = $('#ITP_FORM_RTNMNG03010_NDETAIL_SPPLY_NM').val();
-
- // 넘어오는 데이타가 서로 상이한 공급업체인지 파악
- var chkSpplyId = "";
- var chkSpplyNm = "";
- $.each(rowDataPop, function(key, value) {
-
- if (chkSpplyId != "" ) {
- if (value.spplyId != chkSpplyId ) {
- itp_fn_modal_alert("서로다른 공급사 품목을 발주 진행 할 수 없습니다.");
- diffchk = "Y" ;
- return false ;
- }
- } else {
- chkSpplyId = value.spplyId;
- chkSpplyNm = value.spplyNm;
- }
- });
-
- if (diffchk == "Y") return;
-
- if (spplyId == "" ) {
- $('#ITP_FORM_RTNMNG03010_NDETAIL_SPPLY_ID').val(chkSpplyId);
- $('#ITP_FORM_RTNMNG03010_NDETAIL_SPPLY_NM').val(chkSpplyNm);
- } else {
- if (spplyId != chkSpplyId ) {
- itp_fn_modal_alert("납품 공급사와 품목 공급사 정보가 서로 다릅니다.");
- diffchk = "Y" ;
- }
- }
-
- if (diffchk == "Y") return;
-
- $.each(rowDataPop, function(key, value) {
- // 공급업체가 상이사면 오류 알럿 출력
- if (exists.indexOf(value.brandUnitUnqNo) < 0 && value.podrPssblDvsn == 'PO01') {
- value['viewCd'] = "C";
-
- $(RTNMNG03010_NDETAIL_GRID_ID).jqGrid('addRowData', value.brandUnitUnqNo, value, 'last');
- }
- });
- $(RTNMNG03010_NDETAIL_GRID_EMPTY).hide();
-
- };
- const key = {brandId:fn_make_user_info.get('brandId')};
- console.log("key==",key);
- fn_call_popup('biz', 'BIZPOP_ITEM', '#ITP_ASIDE', popFn, key, 'S'); // ==>dwkim 추후 작업 진행 파라메타 설명필요
- },
- delRow: function() {
- itp_fn_grid_del_row(RTNMNG03010_NDETAIL_GRID_ID);
- pageObj.grid.recal();
- }
-
- },
- gridList: '',
- gridEmpty: '',
- gridRows: '',
- load: function(mode, gridRows) {
- var _this = this;
- var option = {
- gridId: _this.gridId,
- colModel: (mode === 'NPC') ? gridColModel.ndetail : gridColModel.detail,
- data: gridRows,
- multiselect: (mode === 'NPC'),
- loadComplete: function(data) {
- $(mode === 'NPC' ? RTNMNG03010_NDETAIL_GRID_LIST : RTNMNG03010_DETAIL_GRID_LIST).find('.ui-jqgrid .ui-jqgrid-bdiv').css('overflow-x', 'hidden');
-
- data.records === 0 ? _this.clearData(mode) : $(_this.mode === 'NPC' ? _this.clearData(mode) : RTNMNG03010_DETAIL_GRID_EMPTY).hide();
-
- },
- onCellSelect: function(rowid, cellIdx, cellValue) {
- RTNMNG03010_GRID_LAST_ROW_ID = itp_fn_set_data_editable(rowid, cellIdx, RTNMNG03010_GRID_LAST_ROW_ID, _this.gridId, ['pchReqDtlNo']);
- }
- };
- itp_fn_grid_make_local(option);
-
- },
- recal: function() {
- if (SCREEN_MODE == 'NPC' || SCREEN_MODE === 'POC') {
- var ids = $((SCREEN_MODE === 'NPC') ? RTNMNG03010_NDETAIL_GRID_ID : RTNMNG03010_DETAIL_GRID_ID).getDataIDs();
- $.each(ids, function(idx, rowId) {
- var viewCd = jQuery(SCREEN_MODE === 'NPC' ? RTNMNG03010_NDETAIL_GRID_ID : RTNMNG03010_DETAIL_GRID_ID).jqGrid('getCell', rowId, 'viewCd');
- var unitAmt = jQuery(SCREEN_MODE === 'NPC' ? RTNMNG03010_NDETAIL_GRID_ID : RTNMNG03010_DETAIL_GRID_ID).jqGrid('getCell', rowId, 'unitAmt');
- var rtnQty = jQuery(SCREEN_MODE === 'NPC' ? RTNMNG03010_NDETAIL_GRID_ID : RTNMNG03010_DETAIL_GRID_ID).jqGrid('getCell', rowId, 'rtnQty');
-
- if(viewCd != 'D' && unitAmt != null && unitAmt != '' && rtnQty != null && rtnQty != '') {
-
- jQuery(SCREEN_MODE === 'NPC' ? RTNMNG03010_NDETAIL_GRID_ID : RTNMNG03010_DETAIL_GRID_ID).jqGrid('setRowData',rowId,{rtnAmt: parseInt(unitAmt)*parseInt(rtnQty)});
- }
- });
-
- const rowData = $((SCREEN_MODE == 'NPC') ? RTNMNG03010_NDETAIL_GRID_ID : RTNMNG03010_DETAIL_GRID_ID).getRowData();
- var rtnAmt = 0 ;
- $.each(rowData, function(key, value) {
- if (value.rtnAmt != null && value.rtnAmt != "" && value.viewCd != "D") {
- rtnAmt = rtnAmt + parseInt(value.rtnAmt) ;
- }
-
- });
-
- if (SCREEN_MODE == 'NPC') {
- $('#ITP_FORM_RTNMNG03010_NDETAIL .fnRtnDodrTotalAmt').text(itp_fn_number_comma(rtnAmt));
- } else {
- $('#ITP_FORM_RTNMNG03010_DETAIL .fnRtnDodrTotalAmt').text(itp_fn_number_comma(rtnAmt));
- }
- }
- },
- clearData : function(mode) {
- $(mode === 'NPC' ? RTNMNG03010_NDETAIL_GRID_ID : RTNMNG03010_DETAIL_GRID_ID).jqGrid('clearGridData', true);
- $(mode === 'NPC' ? RTNMNG03010_NDETAIL_GRID_LIST : RTNMNG03010_DETAIL_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
- $(mode === 'NPC' ? RTNMNG03010_NDETAIL_GRID_EMPTY : RTNMNG03010_DETAIL_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
- $(mode === 'NPC' ? RTNMNG03010_NDETAIL_GRID_EMPTY : RTNMNG03010_DETAIL_GRID_EMPTY).show();
- },
- unload : function() {
- $.jgrid.gridUnload(this.gridId);
- }
- }
- };
- /*목록화면 Object*/
- let listObj = {
- init: function () {
- this.grid.init();
- },
- itp_RTNMNG03010_search: false,
- button: {
- search: function() {
- listObj.itp_RTNMNG03010_search = true;
- let param = $('#ITP_FORM_RTNMNG03010_SEARCH').serializeObject();
- param.gridSize = $.jgrid.defaults.rowNum;
- param.gridPage = $.jgrid.defaults.page;
- $(RTNMNG03010_GRID_ID).data('grid-param',param);
- $(RTNMNG03010_GRID_ID).setGridParam({'postData': JSON.stringify(param)}).trigger('reloadGrid');
- },
- pocreate: function(param) {
- //pageObj.switchScreen('POC');
- itp_fn_form_clear_validate(null, '#ITP_FORM_RTNMNG03010_DETAIL');
- modifyObj.init(param);
- },
- newpocreate: function() {
- pageObj.switchScreen('NPC');
- itp_fn_form_clear_validate(null, '#ITP_FORM_RTNMNG03010_NDETAIL');
- createObj.init();
- },
- reject: function() {
- //팝업 오픈
- pageObj.popup('REJ');
- },
- chkpo: function() {
- let gridUpdateData = [];
- const rowKey = $(RTNMNG03010_GRID_ID).getGridParam('selrow');
- if (!rowKey) {
- itp_fn_modal_alert( "반품요청 품목을 선택하세요.");
- return;
- }
-
- var selectedIds = $(RTNMNG03010_GRID_ID).getGridParam('selarrrow');
-
- for (var i=selectedIds.length-1; i>=0; i--) {
- gridUpdateData.push($(RTNMNG03010_GRID_ID).jqGrid('getRowData', selectedIds[i]));
- }
-
- let param = {};
- param.brandId=fn_make_user_info.get('brandId');
- param.gridUpdateData = gridUpdateData;
- var chkFn = function(result) {
- if (result.code == "Y") {
- //발수 생성화면으로 전화
- listObj.button.pocreate(param);
- }
- };
- fn_ajax_call(API_DETAIL_POPASS_CHK, JSON.stringify(param), chkFn, 'POST');
- },
- },
- empty: {
- init: function() {
-
- },
- itp_RTNMNG03010_param: {},
- push: function() {
-
- },
- back: function() {
-
- }
- },
- grid: {
- init: function () {
- // 데이터 없을때
- itp_fn_jqgrid_resize(RTNMNG03010_GRID_ID, RTNMNG03010_GRID_LIST, 'lg');
- itp_fn_fire_window_resize();
- this.search();
-
- },
- colModel: gridColModel.list,
- search: function() {
- pageObj.switchScreen('LIST');
- this.unload();
- this.load();
- },
- load: function() {
- let param = $('#ITP_FORM_RTNMNG03010_SEARCH').serializeObject();
- param.gridSize = $.jgrid.defaults.rowNum;
-
- var option = {
- multiselect: true,
- autowidth: true,
- gridId: RTNMNG03010_GRID_ID,
- colModel: gridColModel.list,
- param: param,
- url: DOMAIN + API_DETAIL_GRID_LIST,
- rownumbers: false,
- pager: RTNMNG03010_GRID_PAGER,
- loadComplete: function(data) {
- itp_fn_grid_load_complete(data, RTNMNG03010_GRID_ID, true, 'number', 'RTNMNG03010', listObj.itp_RTNMNG03010_search, listObj.empty, true, data.gridRecords, true);
- var ids = $(RTNMNG03010_GRID_ID).getDataIDs();
- $.each(ids, function(idx, rowId) {
- $(RTNMNG03010_GRID_ID).jqGrid('setCell', rowId, 'storeId', '', ITP_GRID_COL_STYLE.link);
- });
- },
- onPaging: function(action) {
- itp_fn_grid_paging(RTNMNG03010_GRID_ID, action, param);
- }
- };
- itp_fn_grid_make_remote(option);
- },
- button: {
- },
- unload : function() {
- $.jgrid.gridUnload(RTNMNG03010_GRID_ID);
- },
- clearData : function() {
- $(RTNMNG03010_GRID_ID).jqGrid('clearGridData', true);
- $(RTNMNG03010_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
- $(RTNMNG03010_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
- $(RTNMNG03010_GRID_EMPTY).show();
- }
- },
- excelDown: function() {
- var param = {
- 'url': API_DETAIL_GRID_LIST,
- 'param': $('#ITP_FORM_RTNMNG03010_SEARCH').serializeObject(),
- 'gridColumns': $(RTNMNG03010_GRID_ID).jqGrid('getGridParam', 'colModel'),
- 'fileName': '반품발주대상정보.xlsx',
- 'sheetName': '반품발주대상리스트'
- };
- itp_fn_remote_to_excel(param);
- }
- };
- /*수정화면 Object*/
- let modifyObj = {
- init: function (param) {
- this.load(param);
- },
- button: {
- modify: function (param) {
- itp_fn_form_clear_validate(null, '#ITP_FORM_RTNMNG03010_DETAIL');
- const selectVal = $('#ITP_FORM_RTNMNG03010_VIEW_STORE_ID').val();
- const key = {brandId:fn_make_user_info.get('brandId'), storeId: selectVal, viewCd: 'R'};
- var param = $.param(key);
- modifyObj.load(param);
- },
- cancel: function() {
- document.getElementById('ITP_FORM_RTNMNG03010_DETAIL').reset();
- document.getElementById('ITP_FORM_RTNMNG03010_NDETAIL').reset();
- listObj.grid.search();
- },
- rejectSave: function(param) {
-
- var modalFn = {
- callBack: () => {
- var searhFn = function () {
- ITP_FORM_RTNMNG03010_DETAIL_IS_WRITING = false;
- pageObj.grid.clearData();
- modifyObj.button.cancel();
- }
- fn_ajax_call(API_DETAIL_REJECT, param, searhFn, 'GET');
- }
- };
- itp_fn_modal_confirm('반품요청 반려 하시겠습니까?', modalFn);
- },
- save: function() {
- $('body').trigger('click');
- const formId = (SCREEN_MODE == 'NPC' ? '#ITP_FORM_RTNMNG03010_NDETAIL' : '#ITP_FORM_RTNMNG03010_DETAIL');
- itp_fn_form_clear_validate(null, formId);
- if (itp_fn_form_event.isValid(formId)) {
- if (SCREEN_MODE == 'NPC') {
- const rowData1 = $(RTNMNG03010_NDETAIL_GRID_ID).getRowData();
-
- var dataCnt = 0;
- $.each(rowData1, function(key, value) {
- if (value.viewCd != 'D') {
- dataCnt = dataCnt + 1;
- }
- });
-
- if (dataCnt == 0) {
- itp_fn_modal_alert( "발주 생성할 품목내역이 없습니다.");
- return ;
- }
- }
-
- var jobCd = "";
- if (SCREEN_MODE == 'NPC') {
- jobCd = $('#ITP_FORM_RTNMNG03010_NDETAIL_JOB_CD').val()
- } else {
- jobCd = $('#ITP_FORM_RTNMNG03010_DETAIL_JOB_CD').val()
- }
-
- var chkQtyYn = true;
- var chkQtyYn2 = true;
- const rowData2 = (SCREEN_MODE == 'NPC' ? $(RTNMNG03010_NDETAIL_GRID_ID).getRowData() : $(RTNMNG03010_DETAIL_GRID_ID).getRowData());
- $.each(rowData2, function(key, value) {
- if (value.rtnQty == '' || parseInt(value.rtnQty) < 1 ) {
- chkQtyYn = false;
- }
- if (jobCd == 'R' && parseInt(value.rtnQty) > parseInt(value.rtnReqQty) ) {
- chkQtyYn2 = false;
- }
- });
-
- if (chkQtyYn == false) {
- itp_fn_modal_alert("반품발주수량을 입력해주세요!");
- return;
- }
- if (chkQtyYn2 == false) {
- itp_fn_modal_alert("반품발주수량이 반품요청수량보다 클수 없습니다!");
- return;
- }
-
- //수거요처일
- var now = new Date();
- var today = now.getFullYear() +
- "." + (now.getMonth()+1 > 9 ? (now.getMonth()+1).toString() : "0" + (now.getMonth()+1).toString()) +
- "." + (now.getDate() > 9 ? now.getDate().toString() : "0" + now.getDate().toString());
-
- var colReqDt = '' ;
-
- if (SCREEN_MODE == 'NPC') {
- colReqDt = $('#ITP_FORM_RTNMNG03010_NDETAIL_COL_REQ_DT').val()
- } else {
- colReqDt = $('#ITP_FORM_RTNMNG03010_DETAIL_COL_REQ_DT').val()
- }
-
- if (today > colReqDt) {
- alert("수거요청일은 오늘 이후이어야 합니다.");
- return;
- }
-
-
- // 수거구분 값 가져오기
- var colDvsn = $('#ITP_FORM_RTNMNG03010_DETAIL_COL_DVSN').val();
-
- if (colDvsn == 'C001') {
- var whsId = $('#ITP_FORM_RTNMNG03010_DETAIL_WHS_ID').val();
- var location = $('ITP_FORM_RTNMNG03010_DETAIL_LOCATION').val();
-
- if (whsId == '' || location == '') {
- itp_fn_modal_alert("반품입고창고를 선택해주세요!");
- return;
- }
-
- }
-
- var modalFn = {
- callBack: () => {
-
- if (SCREEN_MODE == 'NPC') {
- itp_fn_form_event.removeChar('#ITP_FORM_OPER03010_NDETAIL');
- } else {
- itp_fn_form_event.removeChar('#ITP_FORM_OPER03010_DETAIL');
- }
-
- let gridInsertData = [];
- const rowData = (SCREEN_MODE == 'NPC' ? $(RTNMNG03010_NDETAIL_GRID_ID).getRowData() : $(RTNMNG03010_DETAIL_GRID_ID).getRowData());
-
- $.each(rowData, function(key, value) {
- gridInsertData.push(value);
- });
-
- if (SCREEN_MODE == 'POC') {
- $('#ITP_FORM_RTNMNG03010_DETAIL_COL_DVSN').attr("disabled", false);
- }
-
-
- let param = $(formId).serializeObject();
-
- if (SCREEN_MODE == 'POC') {
- $('#ITP_FORM_RTNMNG03010_DETAIL_COL_DVSN').attr("disabled", true);
- }
-
- param.gridInsertData = gridInsertData;
- console.log( JSON.stringify(param));
- var searhFn = function () {
-
- ITP_FORM_RTNMNG03010_DETAIL_IS_WRITING = false;
- pageObj.grid.clearData();
- modifyObj.button.cancel();
- }
- fn_ajax_call(API_DETAIL_SAVE, JSON.stringify(param), searhFn, 'POST');
- }
- };
- itp_fn_modal_confirm('반품발주를 진행 하시겠습니까?', modalFn);
- }
- }
- },
-
- load: function(param) {
- fn_ajax_call(API_DETAIL_PO_INIT_INFO, JSON.stringify(param), this.callback, 'POST');
- },
- callback: function (result) {
- pageObj.switchScreen('POC');
- $('#ITP_FORM_RTNMNG03010_DETAIL #ITP_FORM_RTNMNG03010_DETAIL_VIEW_CD').val('C');
- $('#ITP_FORM_RTNMNG03010_DETAIL #ITP_FORM_RTNMNG03010_DETAIL_BRAND_ID').val(result.brandId);
- $('#ITP_FORM_RTNMNG03010_DETAIL #ITP_FORM_RTNMNG03010_DETAIL_STORE_ID').val(result.storeId);
- $('#ITP_FORM_RTNMNG03010_DETAIL #ITP_FORM_RTNMNG03010_DETAIL_RTN_REQ_DVSN').val(result.rtnReqDvsn);
- $('#ITP_FORM_RTNMNG03010_DETAIL #ITP_FORM_RTNMNG03010_DETAIL_SPPLY_ID').val(result.spplyId);
- $('#ITP_FORM_RTNMNG03010_DETAIL #ITP_FORM_RTNMNG03010_DETAIL_COL_REQ_DT').val(result.colReqDt);
- $('#ITP_FORM_RTNMNG03010_DETAIL #ITP_FORM_RTNMNG03010_DETAIL_RTN_WHS_ID').val(result.rtnWhsId);
- $('#ITP_FORM_RTNMNG03010_DETAIL #ITP_FORM_RTNMNG03010_DETAIL_RTN_LOCATION').val(result.rtnLocation);
- //$('#ITP_FORM_RTNMNG03010_DETAIL #ITP_FORM_RTNMNG03010_DETAIL_RTN_WHS_NM').val(result.rtnWhsNm);
- $('#ITP_FORM_RTNMNG03010_DETAIL #ITP_FORM_RTNMNG03010_DETAIL_COL_DVSN').val(result.colDvsn);
- $('#ITP_FORM_RTNMNG03010_DETAIL #ITP_FORM_RTNMNG03010_DETAIL_WHS_ID').val(result.whsId);
- $('#ITP_FORM_RTNMNG03010_DETAIL #ITP_FORM_RTNMNG03010_DETAIL_LOCATION').val(result.location);
- $('#ITP_FORM_RTNMNG03010_DETAIL #ITP_FORM_RTNMNG03010_DETAIL_WHS_NM').val(result.whsNm);
-
- $('#ITP_FORM_RTNMNG03010_DETAIL .fnBrandNm').text(result.brandNm);
- $('#ITP_FORM_RTNMNG03010_DETAIL .fnSpplyNm').text(result.spplyNm);
- $('#ITP_FORM_RTNMNG03010_DETAIL .fnPodrMgrNm').text(result.rtnMgrNm);
- $('#ITP_FORM_RTNMNG03010_DETAIL .fnPodrMgrMblNo').text(result.rtnMgrTelNo);
- $('#ITP_FORM_RTNMNG03010_DETAIL .fnRtnDodrTotalAmt').text(itp_fn_number_comma(result.rtnDodrTotalAmt));
- // TODO 수거장소
- $('#ITP_FORM_RTNMNG03010_DETAIL .fnRtnWhsNme').text(result.rtnWhsNm);
-
- if (result.colDvsn == 'C001') { //본사수거
- $('#ITP_BTN_RTNMNG03010_DETAIL_SRH').attr("disabled", false);
- $('#ITP_BTN_RTNMNG03010_DETAIL_MODIFY').attr("disabled", false);
- } else {
- $('#ITP_BTN_RTNMNG03010_DETAIL_SRH').attr("disabled", true);
- $('#ITP_BTN_RTNMNG03010_DETAIL_MODIFY').attr("disabled", true);
- }
-
- // 품목 리스트 조회
- pageObj.grid.init('POC', result.itemList);
- },
- whsPassQty: function(param) {
-
- },
- passQtyCallback: function (result) {
-
- }
- };
- /*신규화면 Object*/
- let createObj = {
- init: function () {
- $('#ITP_FORM_RTNMNG03010_NDETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
- itp_fn_form_clear_validate(null, '#ITP_FORM_RTNMNG03010_NDETAIL');
- const key = {brandId:fn_make_user_info.get('brandId'), viewCd: 'R'};
- var param = $.param(key);
- createObj.load(param);
-
- },
- button: {
- cancel: function() {
- document.getElementById('ITP_FORM_RTNMNG03010_DETAIL').reset();
- listObj.grid.search();
- },
- save: function() {
- const formId = '#ITP_FORM_RTNMNG03010_DETAIL';
- itp_fn_form_clear_validate(null, formId);
- if (itp_fn_form_event.isValid(formId)) {
- var modalFn = {
- callBack: (args) => {
- itp_fn_form_event.removeChar('#ITP_FORM_OPER03010_DETAIL');
- let param = $(formId).serializeObject();
- var searhFn = function () {
- ITP_FORM_RTNMNG03010_DETAIL_IS_WRITING = false;
- listObj.grid.search();
- }
- fn_ajax_call(API_DETAIL_SAVE, JSON.stringify(param), searhFn, 'POST');
- }
- };
- itp_fn_modal_confirm('저장 하시겠습니까?', modalFn);
- }
- }
- },
- load: function(param) {
- fn_ajax_call(API_DETAIL_NEW_INIT_INFO, param, this.callback, 'GET');
- },
- callback: function (result) {
-
- //pageObj.switchScreen('NPC');
- $('#ITP_FORM_RTNMNG03010_NDETAIL #ITP_FORM_RTNMNG03010_DETAIL_VIEW_CD').val('C');
- $('#ITP_FORM_RTNMNG03010_NDETAIL #ITP_FORM_RTNMNG03010_NDETAIL_BRAND_ID').val(result.brandId);
- $('#ITP_FORM_RTNMNG03010_NDETAIL #ITP_FORM_RTNMNG03010_NDETAIL_RTN_REQ_DVSN').val(result.rtnReqDvsn);
- $('#ITP_FORM_RTNMNG03010_NDETAIL #ITP_FORM_RTNMNG03010_NDETAIL_RTN_MGR_ID').val(result.rtnMgrId);
- $('#ITP_FORM_RTNMNG03010_NDETAIL #ITP_FORM_RTNMNG03010_NDETAIL_COL_DVSN').val(result.colDvsn);
-
- $('#ITP_FORM_RTNMNG03010_NDETAIL .fnBrandNm').text(result.brandNm);
- $('#ITP_FORM_RTNMNG03010_NDETAIL .fnRtnMgrNm').text(result.rtnMgrNm);
- $('#ITP_FORM_RTNMNG03010_NDETAIL .fnRtnMgrTelNo').text(result.rtnMgrTelNo);
- $('#ITP_FORM_RTNMNG03010_NDETAIL .fnColDvsnNm').text(result.colDvsnNm);
-
- $('#ITP_FORM_RTNMNG03010_NDETAIL .fnRtnMgrTelNo').text(result.rtnMgrTelNo);
-
-
- var now = new Date();
- $('#ITP_TAB_RTNMNG03010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
- $('#ITP_FORM_RTNMNG03010_NDETAIL_COL_REQ_DT').datepicker('setDate', new Date(now.setDate(now.getDate()+5)));
-
- // 품목 리스트 조회
- // pageObj.grid.init('DETAIL', result.itemList);
-
- }
- };
|