/// <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>
        /// 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>
        /// GEP 통합주문 정보 조회
        /// </summary>
        /// <param name="contrNo"></param>
        /// <returns></returns>
        public GEPOrderInfoT GetGepOrderInfo(int contrNo)
        {
            //GEP 에서 데이터 가져오기
            GEPOrderInfoT gepOrderInfoT = new GEPOrderDac().GetGEPOrderInfo(Query.EQ("GMKTOrder.ContrNo", contrNo));

            return gepOrderInfoT;
        }
        /// <summary>
        /// GEP 배송자및 수취인 정보 취득
        /// </summary>
        /// <param name="contrNo">Gmkt 체결번호</param>
        /// <returns>수취인 정보</returns>
        public ExportSiteTransInfo GetExportSiteTransInfo(int contrNo)
        {
            GEPOrderInfoT gEPOrderInfoT = new GEPOrderDac().GetGEPOrderInfo((Query.EQ("GMKTOrder.ContrNo", contrNo)));

            if (gEPOrderInfoT == null || gEPOrderInfoT.ExportSiteTrans == null)
            {
                return null;
            }

            List<GepNationInfoT> listGepNationInfoT = GetNationMappingList(gEPOrderInfoT.ExportSiteTrans.receiver_iso_country_code);

            if (listGepNationInfoT.Count == 1)
            {
                gEPOrderInfoT.ExportSiteTrans.receiver_country_code = listGepNationInfoT[0].NationPhoneNo;
            }
            else
            {
                return null;
            }

            listGepNationInfoT = GetNationMappingList(gEPOrderInfoT.ExportSiteTrans.sender_iso_country_code);

            if (listGepNationInfoT.Count == 1)
            {
                gEPOrderInfoT.ExportSiteTrans.sender_country_code = listGepNationInfoT[0].NationPhoneNo;
            }
            else
            {
                return null;
            }

            return gEPOrderInfoT.ExportSiteTrans;
        }
Exemple #5
0
        public void InsertDisableOrder(long gepOrderNo)
        {
            GEPOrderInfoT gepOrderInfoT = new GEPOrderDac().GetGEPOrderInfo(Query.EQ("GEPOrderNo", gepOrderNo));

            GEPDisableOrderInfoT disableOrderT = new GEPDisableOrderInfoT();
            disableOrderT.GEPOrderNo = gepOrderInfoT.GEPOrderNo;
            disableOrderT.ExportSite = gepOrderInfoT.ExportSite;
            disableOrderT.ExportSiteTrans = gepOrderInfoT.ExportSiteTrans;
            disableOrderT.Item = gepOrderInfoT.Item;
            disableOrderT.GEPOrder = gepOrderInfoT.GEPOrder;
            disableOrderT.GMKTOrder = gepOrderInfoT.GMKTOrder;
            disableOrderT.TaId = gepOrderInfoT.TaId;
            disableOrderT.Memo = "";
            disableOrderT.InvoiceNo = "";
            disableOrderT.TransportWay = "";
            disableOrderT.UpdateDt = disableOrderT.CreateDt = DateTime.Now;
            disableOrderT.GMKTOrder.OrderStatus = GmktOrderStatus.CantOrder;

            //GEP_ORDER 에 주문불가 상태 업데이트
            UpdateGEPOrderGMKTOrderStatus(gepOrderInfoT.GEPOrderNo, GmktOrderStatus.CantOrder);

            new GEPOrderDac().InsertDisableOrder(disableOrderT);
        }
Exemple #6
0
        /// <summary>
        /// GEP 통합 주문 내역 조회
        /// </summary>
        /// <param name="page">현재 페이지</param>
        /// <param name="rows">보여줄 row 수</param>
        /// <param name="paymentStatusKind">결제 상태</param>
        /// <param name="paymentDateKind">조회할 날짜 종류</param>
        /// <param name="site">out bound 사이트 코드</param>
        /// <param name="searchKind">검색 조건</param>
        /// <param name="searchKey">검색 키</param>
        /// <param name="startDt">시작 일자</param>
        /// <param name="endDt">완료 일자</param>
        public MongoPagingResult<GEPOrderGridT> GetGEPOrderGridData(int page, int rows, int paymentStatus, int paymentDateBase, int site, int searchKind, string searchKey, DateTime startDate, DateTime endDate, string TaId)
        {
            List<IMongoQuery> andQuery = new List<IMongoQuery>();
            #region 기본 조건
            andQuery.Add(Query.EQ("TaId", TaId));

            // 원주문 사이트 결제 상태가 완료인 건만 조회 (Unkown, Cancel 은 조회 하지 않음)
            andQuery.Add(Query.EQ("GEPOrder.Status", EnumHelper.GetDBCode(GepOrderStatus.Conclusion).ToString()));
            #endregion

            #region 페이지 검색 조건
            // G마켓 결제불가
            if (paymentStatus == 1)
            {
                andQuery.Add(Query.EQ("GMKTOrder.OrderStatus", EnumHelper.GetDBCode(GmktOrderStatus.CantOrder).ToString()));
            }
            // G마켓 결제완료
            // G마켓 결제완료 날짜 기준 조회시에도 조건 추가
            else if (paymentStatus == 2 || paymentDateBase == 1)
            {
                andQuery.Add(Query.EQ("GMKTOrder.OrderStatus", EnumHelper.GetDBCode(GmktOrderStatus.Conclusion).ToString()));
            }

            // 원주문사이트 결제완료 일자 기준
            if (paymentDateBase == 0)
            {
                andQuery.Add(Query.GTE("GEPOrder.OrderDt", startDate.ToLocalTime()));
                andQuery.Add(Query.LT("GEPOrder.OrderDt", endDate.ToLocalTime()));
            }
            // G마켓 결제완료 일자 기준
            else if (paymentDateBase == 1)
            {
                andQuery.Add(Query.GTE("GMKTOrder.OrderDt", startDate.ToLocalTime()));
                andQuery.Add(Query.LT("GMKTOrder.OrderDt", endDate.ToLocalTime()));
            }

            // 원주문사이트 코드
            andQuery.Add(Query.EQ("ExportSite.Code", site));

            // 검색 구분
            if (searchKey != null && searchKey != "")
            {
                // 원주문사이트 결제번호
                if (searchKind == 0)
                {
                    // GEPOrder.OrderNo 가 '0' 일 경우 GEPOrder.OrderNoSub 로 검색
                    andQuery.Add(Query.Or(
                                        Query.EQ("GEPOrder.OrderNo", searchKey),
                                        Query.And(
                                                Query.EQ("GEPOrder.OrderNo","0"),
                                                Query.EQ("GEPOrder.OrderNoSub",searchKey)
                                                )
                                        )
                                );
                }
                // GEP 상품 코드
                else if (searchKind == 1)
                {
                    andQuery.Add(Query.EQ("Item.GEPId", searchKey));
                }
                // 원주문사이트 상품번호
                else if (searchKind == 2)
                {
                    andQuery.Add(Query.EQ("Item.ExportItemId", searchKey));
                }
                // G마켓 상품번호
                else if (searchKind == 3)
                {
                    andQuery.Add(Query.EQ("Item.SrcId", searchKey));
                }
                // G마켓 Clone 상품 번호
                else if (searchKind == 4)
                {
                    andQuery.Add(Query.EQ("Item.CloneId", searchKey));
                }
                // G마켓 상품명
                else if (searchKind == 5)
                {
                    andQuery.Add(Query.Matches("Item.SrcItemName", BsonRegularExpression.Create(new Regex(searchKey, RegexOptions.IgnoreCase))));
                }
                // 주문자명
                else if (searchKind == 6)
                {
                    andQuery.Add(Query.Matches("GEPOrder.BuyerName", BsonRegularExpression.Create(new Regex(searchKey, RegexOptions.IgnoreCase))));
                }
            }

            #endregion

            IMongoQuery query = Query.And(andQuery.ToArray());
            int take = rows;
            int skip = (page - 1) * rows;
            IMongoSortBy sort = SortBy.Descending("GEPOrderNo");

            MongoPagingResult<GEPOrderGridT> GridData = new GEPOrderDac().GetGEPOrderGridData(query, take, skip, sort);

            GridData.Result = from data in GridData.Result
                              select data.AddTransportInfo(new TransportCommonBiz().GetDeliveryTracking(data.GMKTOrder.ContrNo)
                                                         , new TransportCommonBiz().GetTransportCostForOrigin(data.Item.src_no, "", data.ExportSiteTrans.sender_iso_country_code, data.ExportSiteTrans.receiver_iso_country_code, data.ExportSiteTrans.trans_way, "", ShippingRateTypeEnum.GmktToExpress )
                                                        );
            return GridData;
        }