示例#1
0
        // 2018-06-01 jsy : 중국YTO 내륙 송장번호 가져오기 - 여러개
        public static int GetYTOLocalWaybillNo_Multi(
            ref List <OrdMaster> INVOICE_LIST
            , ref string error_str
            )
        {
            error_str = "";

            int success = 0;

            // 송장데이터 체크
            if (INVOICE_LIST == null || INVOICE_LIST.Count == 0)
            {
                error_str = comm_global.Language.Resources.API_NO_DATA;
                return(success);
            }

            // SETTINGS 테이블에서 API 연동에 필요한 key값을 가져온다
            Dictionary <string, string> SETTINGS_DIC = SettingsDatabase.GetSettingsDic(INVOICE_LIST[0].EST_CODE, "_api_cn_yto_local_");

            if (SETTINGS_DIC == null)
            {
                SETTINGS_DIC = new Dictionary <string, string>();
            }

            YTOLocalApiModel model = new YTOLocalApiModel();

            model.CLIENT_ID       = (SETTINGS_DIC.ContainsKey("_api_cn_yto_local_client_id") ? SETTINGS_DIC["_api_cn_yto_local_client_id"] : "");
            model.PARTNER_ID      = (SETTINGS_DIC.ContainsKey("_api_cn_yto_local_partner_id") ? SETTINGS_DIC["_api_cn_yto_local_partner_id"] : "");
            model.ORDERTYPE       = (SETTINGS_DIC.ContainsKey("_api_cn_yto_local_order_type") ? SETTINGS_DIC["_api_cn_yto_local_order_type"] : "1");
            model.SENDER_POSTCODE = (SETTINGS_DIC.ContainsKey("_api_cn_yto_local_sender_postcode") ? SETTINGS_DIC["_api_cn_yto_local_sender_postcode"] : "");
            model.SENDER_MOBILE   = (SETTINGS_DIC.ContainsKey("_api_cn_yto_local_sender_mobile") ? SETTINGS_DIC["_api_cn_yto_local_sender_mobile"] : "");
            model.SENDER_PROV     = (SETTINGS_DIC.ContainsKey("_api_cn_yto_local_sender_prov") ? SETTINGS_DIC["_api_cn_yto_local_sender_prov"] : "");
            model.SENDER_CITY     = (SETTINGS_DIC.ContainsKey("_api_cn_yto_local_sender_city") ? SETTINGS_DIC["_api_cn_yto_local_sender_city"] : "");
            model.SENDER_ADDR     = (SETTINGS_DIC.ContainsKey("_api_cn_yto_local_sender_addr") ? SETTINGS_DIC["_api_cn_yto_local_sender_addr"] : "");

            // 중국YTO 내륙 API 연동에 필요한 값을 체크한다
            if (model.CLIENT_ID.Length == 0 || model.PARTNER_ID.Length == 0)
            {
                error_str = "환경설정에서 API 연동에 필요한 값을 먼저 설정해야 합니다.";
                return(success);
            }

            // 환율 데이터를 가져온다
            List <CurrencyModels> CURRENCY_LIST = ConfigDatabase.GetCurrencyDataList(INVOICE_LIST[0].EST_CODE);



            for (int i = 0; i < INVOICE_LIST.Count; i++)
            {
                OrdMaster INVOICE = INVOICE_LIST[i];
                string    err1    = "";
                string    DELVNO  = GetYTOLocalWaybillNo(ref INVOICE, ref err1, model, CURRENCY_LIST);
                INVOICE_LIST[i] = INVOICE;

                if (DELVNO.Length == 0)
                {
                    error_str += err1 + "\n";
                }
                else
                {
                    success++;
                }
            }

            return(success);
        }