コード例 #1
0
ファイル: GmktRegItemService.cs プロジェクト: tomochandv/Test
        /// <summary>
        /// 클론 상품 상품 재등록 (주문수정)
        /// </summary>
        /// <param name="data">eBay 리스팅 대기상품</param>
        /// <returns></returns>
        private ClonItemCreateResult EditGMKTCloneProduct(eBayItemsData data)
        {
            //리턴할 클래스 인스턴스화
            ClonItemCreateResult result = new ClonItemCreateResult();

            //string lCategory = data.gep_info.lcategory.cid;
            //string mCategory = data.gep_info.mcategory.cid;
            //string sCategory = data.gep_info.scategory.cid;

            /*테스트 테이트*/
            //data.gep_info = new GEPItem();
            //data.gep_info.src_no = "201599393";
            //data.gep_info.src_price = 20000;
            //data.gep_info.src_settle_price = 18400;
            //data.gep_info.sel_name = "고리 : 펄스타킹-검";
            //data.gep_info.sel_price = 1000;
            //data.gep_info.sel_qty = 60;
            //string lCategory = "100000003";
            //string mCategory = "200000498";
            //string sCategory = "300004668";

            //2.	GEP Clone Item생성(김정덕, 이승현)
            //testok, test4plan id로 상품생성
            GEPCloneItemRegT cloneItemRegT = new GEPCloneItemRegT();

            /* GEP상품에 대한 입력 값 */
            cloneItemRegT.ItemNo = data.cln_itemno; //cloneItemNo;	//클론 상품번호
            cloneItemRegT.OrgItemNo = data.gep_info.src_no; //orgItemNo;	//소스 상품번호

            //최소 재고 수량
            int minQty = ((0 < data.gep_info.src_qty && data.gep_info.src_qty < data.gep_info.sel_qty) ?
                                                                    data.gep_info.src_qty : data.gep_info.sel_qty);

            //주문정보
            cloneItemRegT.OrderInfo = new Gmkt.Common.Item.OrderInfoT();
            cloneItemRegT.OrderInfo.CostPrice = data.gep_info.src_settle_price; //공급원가
            cloneItemRegT.OrderInfo.SellPrice = data.gep_info.src_price;			//판매가
            cloneItemRegT.OrderInfo.StockQty = minQty;				//수량
            cloneItemRegT.OrderInfo.DisplayDate = new PeriodT();
            cloneItemRegT.OrderInfo.DisplayDate.StartDate = DateTime.Now;

            //추가 전시 기간 : 7일
            int default_days = 7;

            cloneItemRegT.OrderInfo.DisplayDate.EndDate = DateTime.Now.AddDays(data.dynamicData.ListingDuration + default_days);

            /* 밑으로는 고정값 */
            cloneItemRegT.IsCopy = false;
            cloneItemRegT.IsCopyItemOpinion = false;
            cloneItemRegT.IsChangeStatOldItem = false;
            cloneItemRegT.ChannelType = ChannelEnum.GEP;

            cloneItemRegT.Admin = new AdminT();
            cloneItemRegT.Admin.AdminID = "System";
            cloneItemRegT.LogUserInfo = new LogUserInfoT();
            cloneItemRegT.LogUserInfo.UserIP = "127.0.0.1";
            cloneItemRegT.LogUserInfo.Location = "GEP clone 상품등록";

            try
            {
                //주문 전시일,재고등 수정
                result.GepCloneItemRegResultT = new ItemGEPControl().EditCloneItemOrder(cloneItemRegT);
                result.isException = false;

            }
            catch (InvalidUserInputException ex)
            {
                result.isException = true;
                result.exceptionMessage = ex.Message.ToString();
            }
            catch (BusinessRuleException ex)
            {
                result.isException = true;
                result.exceptionMessage = ex.Message.ToString();
            }
            catch (GmktException ex)
            {
                result.isException = true;
                result.exceptionMessage = ex.Message.ToString();
            }
            catch (Exception ex)
            {
                result.isException = true;
                result.exceptionMessage = ex.Message.ToString();
            }

            return result;
        }
コード例 #2
0
ファイル: GmktRegItemService.cs プロジェクト: tomochandv/Test
        internal void Process()
        {
            try
            {
                //eBayItems select where Listing 요청 건
                List<eBayItemsData> list = new eBayItemBiz().GetItemListingList();

                logger.InfoFormat("[Target List Count] : " + list.Count);

                foreach (var t in list)
                {
                    logger.InfoFormat("[Start Process id] : " + t._id);
                    //초기화
                    t.listingreq = new ListingRequest();

                    //데몬에서 읽었다는 표시.
                    t.listingreq.is_comp = true;
                    new eBayItemBiz().SaveItem(t);

                    ClonItemCreateResult result = new ClonItemCreateResult();

                    //등록과 재등록의 구분
                    if (string.IsNullOrEmpty(t.cln_itemno))
                    {
                        logger.InfoFormat("[Create Clon Product id] : " + t._id);
                        //클론 상품 생성
                        result = CreateGMKTCloneProduct(t);
                    }
                    else
                    {
                        logger.InfoFormat("[ReCreate Clon Product id] : " + t._id);
                        //등록된 상품 마감처리
                        var closeResult = CloseGMKTCloneProduct(t);
                        if (closeResult.isException)
                        {
                            //마감 처리에 실패했을경우
                            t.listingreq.success = false;
                            t.listingreq.message = closeResult.exceptionMessage;
                            new eBayItemBiz().SaveItem(t);
                            return;
                        }

                        //클론 상품 재등록
                        result = EditGMKTCloneProduct(t);

                    }

                    //실패일 경우 메세지및 상태값 처리한다.
                    if (result.isException || result.GepCloneItemRegResultT.GoodsNo == "")
                    {
                        t.listingreq.success = false;
                        t.listingreq.message = result.exceptionMessage;
                        new eBayItemBiz().SaveItem(t);
                        logger.InfoFormat("[GMKT Clon Fail id] : " + t._id);

                    }
                    //성공일 경우 forSeller와 통신
                    else
                    {
                        //클론상품에 대한 데이터 저장
                        t.cln_itemno = result.GepCloneItemRegResultT.GoodsNo;
                        t.cln_selno = result.GepCloneItemRegResultT.CloneOptionNo;
                        new eBayItemBiz().SaveItem(t);

                        var forSellerResult = SetListItem(t);
                        //메세지가 성공일 경우
                        if (forSellerResult.isResult)
                        {
                            t.listingreq.success = true;
                            t.listingreq.message = "";
                            logger.InfoFormat("[forSeller Success id] : " + t._id);
                        }
                        //메세지가 실패일 경우
                        else
                        {
                            t.listingreq.success = false;
                            t.listingreq.message = forSellerResult.Message;
                            logger.InfoFormat("[forSeller Fail id] : " + t._id);
                        }
                        new eBayItemBiz().SaveItem(t);
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(string.Format("Exception!!\n[StackTrance]\n{0}", ex.StackTrace.ToString()));
                return;
            }
        }
コード例 #3
0
ファイル: GmktRegItemService.cs プロジェクト: tomochandv/Test
        /// <summary>
        /// 클론 상품 상품마감 (주문삭제)
        /// </summary>
        /// <param name="data">eBay 리스팅 대기상품</param>
        /// <returns></returns>
        private ClonItemCreateResult CloseGMKTCloneProduct(eBayItemsData data)
        {
            //리턴할 클래스 인스턴스화
            ClonItemCreateResult result = new ClonItemCreateResult();
            //clone 상품
            GEPCloneItemRegT cloneItemRegT = new GEPCloneItemRegT();

            cloneItemRegT.ItemNo = data.cln_itemno;//cloneItemNo; //클론 상품번호
            cloneItemRegT.OrgItemNo = data.gep_info.src_no;

            /* 밑으로는 고정값 */
            cloneItemRegT.IsCopy = false;
            cloneItemRegT.IsCopyItemOpinion = false;
            cloneItemRegT.IsChangeStatOldItem = false;
            cloneItemRegT.ChannelType = ChannelEnum.GEP;

            cloneItemRegT.Admin = new AdminT();
            cloneItemRegT.Admin.AdminID = "System";
            cloneItemRegT.LogUserInfo = new LogUserInfoT();
            cloneItemRegT.LogUserInfo.UserIP = "127.0.0.1";
            cloneItemRegT.LogUserInfo.Location = "GEP clone 상품등록";

            try
            {
                //상품번호와 AdminID 필요 상품 삭제처리
                result.GepCloneItemRegResultT = new ItemGEPControl().RemoveCloneItemOrder(cloneItemRegT);
                result.isException = false;

            }
            catch (InvalidUserInputException ex)
            {
                result.isException = true;
                result.exceptionMessage = ex.Message.ToString();
            }
            catch (BusinessRuleException ex)
            {
                result.isException = true;
                result.exceptionMessage = ex.Message.ToString();
            }
            catch (GmktException ex)
            {
                result.isException = true;
                result.exceptionMessage = ex.Message.ToString();
            }
            catch (Exception ex)
            {
                result.isException = true;
                result.exceptionMessage = ex.Message.ToString();
            }

            return result;
        }