/// <summary> /// 반품및 G마켓 해외배송 판별(Core 도착확인 수정포함) /// </summary> /// <param name="orderNum">주문번호(체결번호)</param> /// <returns> 0 : 정상 , 1 : 취소/반품, 2 : G마켓 해외배송, -11 : 에러</returns> public TransportResultSet CheckCoreTranseportState(int contrNo) { TransportResultSet result = new TransportResultSet(); TransportClaimInfoT transportClaimInfoT = new TransportGMKTCoreDac().TransportClaimInfo(contrNo); if (transportClaimInfoT != null) { if (transportClaimInfoT.ClaimSolStat != "S4" && (transportClaimInfoT.ClaimType == "CR" || transportClaimInfoT.ClaimType == "CO")) { result.KeyValue = contrNo.ToString(); result.Code = ResultCodeEnum.Error; result.Message = "반품/취소된 상품 입니다."; return result; } else if (transportClaimInfoT.IsChange == "Y" || transportClaimInfoT.IsCancel == "Y") { result.KeyValue = contrNo.ToString(); result.Code = ResultCodeEnum.Error; result.Message = "반품/취소된 상품 입니다."; return result; } else if ( !String.IsNullOrEmpty(transportClaimInfoT.OverSeaBundleNO) ) { result.KeyValue = contrNo.ToString(); result.Code = ResultCodeEnum.Error; result.Message = "G마켓 해외배송 상품입니다."; return result; } else { result.KeyValue = contrNo.ToString(); result.Code = ResultCodeEnum.OK; result.Message = ""; return result; } } else { result.KeyValue = contrNo.ToString(); result.Code = ResultCodeEnum.Error; result.Message = "배송정보가 존재하지 않습니다."; return result; } }
/// <summary> /// GepWarehouse 정보를 gep 통합주문정보와 gmkt주문정보에서 가져온다. /// </summary> /// <param name="scanValue"></param> /// <param name="userID"></param> /// <param name="gepWarehouse"></param> /// <returns></returns> public TransportResultSet SetGepWarehouseFromOrderData(string scanValue, string userID, ref GepWarehouse gepWarehouse) { TransportResultSet result = new TransportResultSet(); result.KeyValue = scanValue; result.Code = ResultCodeEnum.OK; result.Message = ""; //gmkt 에서 데이터 가져오기 OrderInfoT gmktOrder = new TransportGMKTCoreDac().OrderInfo(Util.GetSafeInt(scanValue)); if (null == gmktOrder) { result.KeyValue = scanValue; result.Code = ResultCodeEnum.Error; result.Message = "G마켓 주문 정보가 없습니다."; return result; } //GEP 에서 데이터 가져오기 GEPOrderInfoT gepOrder = new GEPOrderDac().GetGEPOrderInfo(Query.EQ("GMKTOrder.ContrNo", Util.GetSafeInt(scanValue))); if (null == gepOrder) { result.KeyValue = scanValue; result.Code = ResultCodeEnum.Error; result.Message = "GEP 통합주문 정보가 없습니다."; return result; } if (String.IsNullOrEmpty(gepOrder.ExportSiteTrans.trans_way) || "0" == gepOrder.ExportSiteTrans.trans_way) { result.KeyValue = scanValue; result.Code = ResultCodeEnum.Error; result.Message = "GEP 통합주문 정보에 Site배송방법이 없습니다."; return result; } //라벨출력일 gepWarehouse.gsm_label_print_dt = gmktOrder.LabelPrintDt; gepWarehouse.gsm_label_print_id = gmktOrder.SellerId; if (null == gepWarehouse.transinfo) gepWarehouse.transinfo = new GepTransInfo(); gepWarehouse.transinfo.contr_no = Util.GetSafeInt(scanValue); //Gep통합주문정보 --> TransInfo //Gep통합주문정보 --> item 정보 CovertTo(gepOrder, ref gepWarehouse.transinfo); //gmkt주문정보 --> TransInfo CovertTo(gmktOrder, ref gepWarehouse.transinfo); gepWarehouse.transinfo.chg_dt = DateTime.Now; gepWarehouse.transinfo.chg_id = userID; //Gep통합주문정보 --> GEP에 배송방법 gepWarehouse.transinfo.trans_way = new TransportCommonBiz().GetTransWayInfo(gepOrder.ExportSiteTrans.trans_way); gepWarehouse.transinfo.trans_way.reg_dt = DateTime.Now; gepWarehouse.transinfo.trans_way.reg_id = userID; //GOPM 배송방법 이력 if (null == gepWarehouse.trans_way_hist) gepWarehouse.trans_way_hist = new List<GepTransWay>(); gepWarehouse.trans_way_hist.Add(gepWarehouse.transinfo.trans_way); //사이트 주문일로부터 5일이상 경과 시 배송방법 EMS전환 if ((gepWarehouse.transinfo.gep_payment_dt.AddDays(5)) < DateTime.Now && gepWarehouse.transinfo.trans_way.transport_way != "EMS") { GepTransWay gepTransWay = new TransportCommonBiz().GetTransWayInfo("EMS"); gepTransWay.reg_dt = DateTime.Now.AddSeconds(1); gepTransWay.reg_id = userID; gepTransWay.transport_way = "EMS-2"; gepWarehouse.trans_way_hist.Add(gepTransWay); gepWarehouse.transinfo.trans_way = gepTransWay; } //사이트 배송지 정보 if (gepOrder.ExportSiteTrans == null) { result.KeyValue = scanValue; result.Code = ResultCodeEnum.Error; result.Message = "GEP 사이트별 가변 배송정보가 없습니다."; return result; } gepWarehouse.sitetransinfo = gepOrder.ExportSiteTrans; //보내는 사람 주소 //사이트별 배송지 정보 TaInfo ta = new TaInfoBiz().FindTaUser(gmktOrder.BuyerId); if (ta == null) { result.KeyValue = gmktOrder.BuyerId; result.Code = ResultCodeEnum.Error; result.Message = "TA 사용자 정보가 없습니다."; return result; } ConvertTo(ta, ref gepWarehouse.sitetransinfo); //발송인 국가 전화번호 if ("KR" != gepWarehouse.sitetransinfo.sender_iso_country_code) gepWarehouse.sitetransinfo.sender_country_code = new TransportCommonBiz().GetNationPhoneNo(gepWarehouse.sitetransinfo.sender_iso_country_code); //수취인 국가 전화번호 gepWarehouse.sitetransinfo.receiver_country_code = new TransportCommonBiz().GetNationPhoneNo(gepWarehouse.sitetransinfo.receiver_iso_country_code); //예상무게 if (0 < Util.GetSafeLong(gepOrder.Item.gep_id)) { gepWarehouse.trns_cost = new TransportCommonBiz().GetTransportCostForOrigin(Util.GetSafeLong(gepOrder.Item.gep_id) , gepWarehouse.transinfo.clone_item_no , "" , gepWarehouse.sitetransinfo.sender_iso_country_code , gepWarehouse.sitetransinfo.receiver_iso_country_code , gepWarehouse.sitetransinfo.trans_way , userID , ShippingRateTypeEnum.GmktToExpress); } else { gepWarehouse.trns_cost = new TransportCommonBiz().GetTransportCostForOrigin(gepWarehouse.transinfo.clone_item_no , "" , gepWarehouse.sitetransinfo.sender_iso_country_code , gepWarehouse.sitetransinfo.receiver_iso_country_code , gepWarehouse.sitetransinfo.trans_way , userID , ShippingRateTypeEnum.GmktToExpress); } //상품 영문명 GepItemsData gepitem = new GepItemsBiz().GepItemView(gepWarehouse.transinfo.gep_item_id.ToString()); if ( !String.IsNullOrEmpty(gepitem.src_info.mcategory.cid) ) { CategoryGmktEngInfoT category = GetGmktMiddleCategoryEngName(gepitem.src_info.mcategory.cid); if (null != category && !String.IsNullOrEmpty(category.EngName)) gepWarehouse.transinfo.gep_mcategory_ename = category.EngName; if ( !String.IsNullOrEmpty(gepitem.src_info.eng_name) ) gepWarehouse.transinfo.gep_item_ename = gepitem.src_info.eng_name; } return result; }
/// <summary> /// 예상 배송비 계산 (무게단위: g) /// </summary> /// <param name="gd_no">상품번호</param> /// <param name="gdsc_cd">상품 카테고리 번호</param> /// <param name="fromNationIsocode">보내는 국가 번호</param> /// <param name="toNationIsocode">받는 국가 번호</param> /// <param name="trnscoCode">배송 방법</param> /// <param name="userID">사용자 아이디</param> /// <param name="ShippingRateTypeEnum">배송비표 요율타입 1:고객->G마켓 2:G마켓->배송사</param> /// <returns>배송비 정보</returns> public GepTranstCost GetTransportCostForOrigin(string gd_no, string gdsc_cd, string fromNationIsocode, string toNationIsocode, string transWay, string userID, ShippingRateTypeEnum costRateType) { GepTransWay gepTransWay = GetTransWayInfo(transWay); //출발국가 없을때 한국으로 설정 string fromNationISO = String.IsNullOrEmpty(fromNationIsocode) ? "KR" : fromNationIsocode; //예상무게 (단위:g) int itemWeight = new TransportGMKTCoreDac().GetGoodWeight(gd_no, gdsc_cd); //예상무게별 배송비계산 int shippingCost = GetTransportCostByGmkt(itemWeight, fromNationISO, toNationIsocode, gepTransWay.transco_code, costRateType); //추가 배송비 계산(예: RR코드 있는 항공소형포장일 경우) shippingCost += gepTransWay.trans_add_cost; return new GepTranstCost() { org_weight = itemWeight, org_transport_cost = shippingCost, real_transport_cost = 0, real_weight = 0, reg_dt = DateTime.Now, reg_id = userID }; }
/// <summary> /// GMKT 배송비표에 따른 배송비 계산 (무게단위: g) /// 단, RR(SP-RR)은 배송비표가 없으므로 여기서 계산하지 않음 /// </summary> /// <param name="itemWeight">상품무게</param> /// <param name="fromNationIsocode">보내는 국가 번호</param> /// <param name="toNationIsocode">받는 국가 번호</param> /// <param name="trnscoCode">배송 방법</param> /// <param name="userID">사용자 아이디</param> /// <param name="cost_type">배송비표 요율타입 1:고객->G마켓 2:G마켓->배송사</param> /// <returns>배송비 정보</returns> public int GetTransportCostByGmkt(int weight, string fromNationIsocode, string toNationIsocode, int trnscoCode, ShippingRateTypeEnum costRateType) { int shippingCost = 0; //출발국가 없을때 한국으로 설정 string fromNationISO = String.IsNullOrEmpty(fromNationIsocode) ? "KR" : fromNationIsocode; if (costRateType == ShippingRateTypeEnum.CustomerToGmkt) shippingCost = new TransportGMKTCoreDac().GetCostByTotalweight(fromNationISO, toNationIsocode, weight, trnscoCode); else shippingCost = new TransportGMKTCoreDac().GetCostByTotalweightByExpress(fromNationISO, toNationIsocode, weight, trnscoCode); return shippingCost; }
/// <summary> /// SP 배송가능 국가 리스트 /// </summary> /// <returns></returns> public List<GepNationInfoT> GetSpNationList() { List<GepNationInfoT> listGepNationInfoT = null; listGepNationInfoT = new TransportGMKTCoreDac().GetNationList(GmktTransWayEnum.GEP_SP); return listGepNationInfoT; }
public GepShippingSummaryT GetShippingSummary(string ta_gmkt_id) { //국내배송 건수 GepShippingSummaryT sumData = new TransportGMKTCoreDac().ShippingSummary(ta_gmkt_id); //해외배송 건수 GepShippingSummaryT overseaSumData = new TransportGepWarehouseDac().GetShippingSummary(ta_gmkt_id); sumData.InWarehouseCnt = overseaSumData.InWarehouseCnt; sumData.OverseaShippingCnt = overseaSumData.OverseaShippingCnt; return sumData; }
/// <summary> /// 매핑 국가 정보(국가명,국가iso코드,국가한글명,국가전화번호) /// </summary> /// <param name="nationIsoCode"></param> /// <returns></returns> public List<GepNationInfoT> GetNationMappingList(string nationIsoCode) { List<GepNationInfoT> listGepNationInfoT = null; listGepNationInfoT = new TransportGMKTCoreDac().GetNationMappingList(nationIsoCode); return listGepNationInfoT; }
/// <summary> /// GEP체결건 송장번호로 조회 /// </summary> /// <param name="site_trans_way"></param> /// <returns></returns> public List<GmktOrderInfoByInvoiceNoT> GetGmktOrderInfoByInvoiceNo(string invoice_no) { List<GmktOrderInfoByInvoiceNoT> listGmktOrderInfoByInvoiceNoT = null; listGmktOrderInfoByInvoiceNoT = new TransportGMKTCoreDac().GetGmktOrderInfoByInvoiceNo(invoice_no); return listGmktOrderInfoByInvoiceNoT; }
/// <summary> /// Gmkt 주문/배송 정보 조회 /// </summary> /// <param name="contrNo"></param> /// <returns></returns> public OrderInfoT GetGmktOrderInfo(int contrNo) { //gmkt 에서 데이터 가져오기 OrderInfoT orderInfoT = new TransportGMKTCoreDac().OrderInfo(contrNo); return orderInfoT; }
/// <summary> /// 오늘의 USD환율 정보 /// </summary> /// <returns></returns> public GmktExchangeRateInfoT GetGmktExchangeRateInfo() { List<GmktExchangeRateInfoT> listGmktExchangeRateInfoT = new TransportGMKTCoreDac().GetGmktExchangeRateInfoT(DateTime.Now); var q = (from t in listGmktExchangeRateInfoT where t.Exchange == "USD" && t.PaymentMthdNm == "paypal" select t).ToList(); if (q == null || q.Count == 0) { return null; } else { return q[0]; } }
/// <summary> /// GEP 데이터 취득 /// </summary> /// <param name="contrNo"> 체결번호</param> /// <param name="gepWarehouse">Gopm Core 데이터</param> /// <returns>Gep 데이터</returns> //public GepTransInfo GetGepTransInfoData(int contrNo, ref GepWarehouse gepWarehouse) public GepTransInfo GetGepTransInfoData(int contrNo) { //gmkt 에서 데이터 가져오기 OrderInfoT orderInfoT = new TransportGMKTCoreDac().OrderInfo(contrNo); if (orderInfoT == null) { return null; } //GEP 에서 데이터 가져오기 GEPOrderInfoT gepOrderInfoT = new GEPOrderDac().GetGEPOrderInfo(Query.EQ("GMKTOrder.ContrNo", contrNo)); if (gepOrderInfoT == null) { return null; } //gepWarehouse.gsm_label_print_dt = orderInfoT.LabelPrintDt; //gepWarehouse.gsm_label_print_id = orderInfoT.SellerId; return new GepTransInfo() { contr_no = contrNo //Gep와 TransInfo결합 , gep_order_no = gepOrderInfoT.GEPOrderNo , gep_order_count = gepOrderInfoT.GEPOrder.OrderCnt , gep_order_dt = gepOrderInfoT.GEPOrder.OrderDt , gep_item_id = Util.GetSafeLong(gepOrderInfoT.Item.gep_id) , gep_payment_dt = gepOrderInfoT.GEPOrder.PaymentDt , gep_item_ename = "" , trans_way = GetTransWayInfo(gepOrderInfoT.ExportSiteTrans.trans_way) //Core와 TransInfo결합 , clone_contr_price = orderInfoT.ContrPrice , clone_item_name = orderInfoT.ItemName , clone_item_no = orderInfoT.ItemNo , clone_option_info = orderInfoT.Selorder , clone_buyer_id = orderInfoT.BuyerId , clone_buyer_name = orderInfoT.BuyerNm , clone_seller_id = orderInfoT.SellerId , clone_seller_name = orderInfoT.SellerNm , clone_contr_dt = orderInfoT.ContrDt , local_express_nm = orderInfoT.TakbaeName , local_invoice_no = orderInfoT.NoSongjang , chg_dt = DateTime.Now }; }
/// <summary> /// 배송대기 스캔 데이터 취득 /// </summary> /// <param name="scanValue">송장번호</param> /// <returns>스캔한 데이터</returns> public DeliveryWaitGridData GetDeliveryWaitGridData(int scanValue) { GepWarehouse gepWarehouse = new TransportGepWarehouseDac().FindOne(scanValue); if (gepWarehouse == null) { return null; } var transWays = (from t in gepWarehouse.trans_way_hist orderby t.reg_dt descending select t).ToList(); if (transWays.Count == 0) { return null; } if (gepWarehouse.transinfo == null || gepWarehouse.trans_way_hist == null || gepWarehouse.trns_cost == null) { return null; } //미국일때, HSCODE 조회 if ("US" == gepWarehouse.sitetransinfo.receiver_iso_country_code && String.IsNullOrEmpty(gepWarehouse.hscode)) { GepItemsData gepItem = new GepItemsBiz().GepItemView(Util.GetSafeString(gepWarehouse.transinfo.gep_item_id)); if (null != gepItem && null != gepItem.src_info) { List<CategoryHscodeT> data = new TransportGMKTCoreDac().GetCategoryHscodeT(gepItem.src_info.lcategory.cid, gepItem.src_info.mcategory.cid, gepItem.src_info.scategory.cid); if (null != data && 0 < data.Count) { gepWarehouse.hscode = data[0].Hscode; //업데이트 if (!String.IsNullOrEmpty(gepWarehouse.hscode)) new TransportGepWarehouseDac().Save(gepWarehouse); } } } return new DeliveryWaitGridData() { DeliveryAddress = gepWarehouse.sitetransinfo.receiver_addr , DeliveryNation = gepWarehouse.sitetransinfo.receiver_country_name , ForeingConutryTransc = transWays[0].transport_way , idx = "0" , InvoiceNum = "" , ObjectID = gepWarehouse.contr_no.ToString() , OrderNum = gepWarehouse.contr_no.ToString() , RealWeight = gepWarehouse.trns_cost.real_weight.ToString() , ReceiverName = gepWarehouse.sitetransinfo.receiver_name }; }