예제 #1
0
 /// <summary>
 /// GEP 상품 저장
 /// </summary>
 /// <param name="data">GepItemsData Class</param>
 public void Save(GepItemsData data)
 {
     List<GepItemsData> List = new List<GepItemsData>();
     GEPMongoDacHelper MongoHelper = new GEPMongoDacHelper("gep", "gep_items");
     MongoHelper.Save<GepItemsData>(data);
 }
예제 #2
0
 private void UpdateGmarketVerifyGepItemDb(GepItemsData data, string statusResult, string selResult, string itemResult, string deliveryResult)
 {
     string result = string.Empty; ;
     if (statusResult != "S")
     {
         result += result == "" ? statusResult : "," + statusResult;
     }
     if (selResult != "S")
     {
         result += result == "" ? selResult : "," + selResult;
     }
     if (itemResult != "S")
     {
         result += result == "" ? itemResult : "," + itemResult;
     }
     if (deliveryResult != "S")
     {
         result += result == "" ? deliveryResult : "," + deliveryResult;
     }
     if (statusResult == "S" && selResult == "S" && itemResult == "S" && deliveryResult == "S")
     {
         result = "OK";
     }
     data.ver_code = result;
     new GepItemsDac().Save(data);
 }
예제 #3
0
 /// <summary>
 /// 임시 GEP 상품 상태 수정
 /// </summary>
 public void UpdateGEPItem(GepItemsData item)
 {
     GEPMongoDacHelper MongoHelper = new GEPMongoDacHelper(dataBase, collection);
     MongoHelper.Save<GepItemsData>(item);
 }
예제 #4
0
        /// <summary>
        /// GEP로 소스상품 이관 
        /// </summary>
        public string SetGEPItems(List<GepItemsData> reqMotherItems, string ta_id)
        {
            List<string> sMsg = new List<string>(); // 생성완료 건 안내
            string fMsg = ""; // 실패 건 안내

            List<GepItemsData> resultGEPItems = new List<GepItemsData>(); // 최종저장할 GepItemsData

            // 넘어온 reqMotherItems에는 소스상품번호(src_info.no)와 이미지(img)만 값이 들어있다.
            foreach (GepItemsData motherItem in reqMotherItems)
            {
                string gd_no = motherItem.src_info.no;
                string gd_img = motherItem.img;

                // 임시저장된 필수선택 리스트(TempGEPItem)를 가져온다.
                List<GepItemsData> tmpGEPItems = new GmarketItemBiz().GetTempGEPItemList(ta_id, gd_no);

                if (tmpGEPItems != null && tmpGEPItems.Count > 0)
                {
                    foreach (GepItemsData t in tmpGEPItems)
                    {
                        t.stat = "S2";
                        new GmarketItemDac().UpdateGEPItem(t); // 상태만 S1 -> S2 바로 업데이트
                        // History
                        string sel = GmktUtil.GetOptionNoString(t.src_info.sel_no.RawValues);
                        new GmarketItemDac().SetSourceItemHistory(ta_id, gd_no, t._id, sel, t.src_info.sel_name, t.src_info.sel_price, t.src_info.sel_qty);
                    }

                    sMsg.Add(gd_no);
                }
                else
                {
                    // 필수선택이 없는 소스상품은 Insert를 위해 필터링 DB에서 나머지를 채운다.
                    SourceItemInfoT info = new GmarketItemBiz().GetSourceItem(ta_id, gd_no);
                    string Desc = new GmarketItemBiz().GetSourceItemDescription(gd_no);

                    // 본 상품이 해외배송 불가, 판매자 미동의 상품인 경우 선택저장불가
                    if (info.OverseasDeliveryYn.ToUpper() == "N" || info.AgreeYn.ToUpper() == "N")
                    {
                        if (fMsg == "") fMsg += gd_no;
                        else fMsg += ", " + gd_no;
                        continue;
                    }

                    // eBay VeRO 체크
                    string matchKeyword = null;
                    bool isLimit = new eBayItemBiz().ContainseBayVeroKeyword(info.Name, out matchKeyword);
                    if (isLimit == true)
                    {
                        if (fMsg == "") fMsg += gd_no;
                        else fMsg += ", " + gd_no;
                        continue;
                    }
                    if (string.IsNullOrWhiteSpace(info.EngName) == false)
                    {
                        isLimit = new eBayItemBiz().ContainseBayVeroKeyword(info.EngName, out matchKeyword);
                        if (isLimit == true)
                        {
                            if (fMsg == "") fMsg += gd_no;
                            else fMsg += ", " + gd_no;
                            continue;
                        }
                    }

                    GepItemsData resultGEPItem = new GepItemsData();
                    resultGEPItem._id = GetNextGEPItemID();
                    resultGEPItem.stat = "S2"; // resultGEPItemStatusEnum.Active;
                    resultGEPItem.img = gd_img;
                    resultGEPItem.src_site = "GMKT";
                    resultGEPItem.src_info = new src_info();
                    resultGEPItem.src_info.no = gd_no;
                    resultGEPItem.src_info.name = info.Name;
                    resultGEPItem.src_info.eng_name = info.EngName;
                    resultGEPItem.src_info.seller = new seller();
                    resultGEPItem.src_info.seller.no = info.SellerNo;
                    resultGEPItem.src_info.seller.sid = info.SellerID;
                    resultGEPItem.src_info.seller.name = info.SellerName;
                    resultGEPItem.src_info.seller.tel = info.SellerTel;
                    resultGEPItem.src_info.seller.cell = info.SellerCell;
                    resultGEPItem.src_info.seller.email = info.SellerEmail;
                    resultGEPItem.src_info.lcategory = new lcategory();
                    resultGEPItem.src_info.lcategory.cid = info.LCategoryCode;
                    resultGEPItem.src_info.lcategory.name = info.LCategoryName;
                    resultGEPItem.src_info.mcategory = new mcategory();
                    resultGEPItem.src_info.mcategory.cid = info.MCategoryCode;
                    resultGEPItem.src_info.mcategory.name = info.MCategoryName;
                    resultGEPItem.src_info.scategory = new scategory();
                    resultGEPItem.src_info.scategory.cid = info.SCategoryCode;
                    resultGEPItem.src_info.scategory.name = info.SCategoryName;
                    resultGEPItem.src_info.desc = Desc;
                    resultGEPItem.src_info.price = Util.GetSafeInt(info.SellPrice);
                    resultGEPItem.src_info.settle_price = Util.GetSafeInt(info.CostPrice);
                    resultGEPItem.src_info.qty = info.StockQty;
                    resultGEPItem.src_info.weight = Util.GetSafeInt(info.Weight);
                    resultGEPItem.src_info.dc = Util.GetSafeInt(info.SellerDiscountPrice);
                    resultGEPItem.src_info.origin = info.Origin;
                    resultGEPItem.src_info.dlv = new dlv();
                    resultGEPItem.src_info.dlv.dlv_gr_no = info.DeliveryGroupNo;
                    resultGEPItem.src_info.dlv.dlv_gr_nm = info.DeliveryGroupName;
                    resultGEPItem.src_info.dlv.bs_money = Util.GetSafeInt(info.BasisMoney);
                    resultGEPItem.src_info.dlv.dlv_fee = Util.GetSafeInt(info.DeliveryFee);
                    resultGEPItem.src_info.dlv.who_fee = info.WhoFee;
                    resultGEPItem.src_info.dlv.bs_weight = Util.GetSafeInt(info.BasisWeight);
                    resultGEPItem.src_info.dlv.bs_amt = Util.GetSafeInt(info.BasisAmount);
                    resultGEPItem.src_info.dlv.bs_type = info.BasisType;
                    resultGEPItem.src_info.dlv.dlv_fee_yn = info.DeliveryFeeYn;
                    resultGEPItem.src_info.dlv.dlv_fee_cond = info.DeliveryFeeCondition;
                    //resultGEPItem.src_info.sel_no
                    //resultGEPItem.src_info.sel_name
                    //resultGEPItem.src_info.sel_price
                    //resultGEPItem.src_info.sel_qty
                    resultGEPItem.src_info.overseas_sold_cnt = info.OverseasSoldCount;
                    resultGEPItem.src_info.total_price = Util.GetSafeInt(info.SellPrice + info.DeliveryFee - info.SellerDiscountPrice);
                    resultGEPItem.ver_code = "";
                    resultGEPItem.trans = new List<trans>();
                    resultGEPItem.is_exp = false;
                    resultGEPItem.rdate = DateTime.Now;
                    resultGEPItem.udate = DateTime.Now;
                    resultGEPItem.ta = ta_id;
                    resultGEPItem.total_exp_count = 0;
                    resultGEPItem.latest_exp_date = DateTime.Now;
                    resultGEPItem.exp_ta = "";

                    resultGEPItems.Add(resultGEPItem);
                }
            }

            // Batch Insert
            if (resultGEPItems.Count > 0)
            {
                new GmarketItemDac().InsertGEPItem(resultGEPItems);

                // 이관 History (Batch Insert한 건들은 필수선택이 없으므로 opt_no는 빈 값으로 넘김
                foreach (GepItemsData i in resultGEPItems)
                {
                    new GmarketItemDac().SetSourceItemHistory(ta_id, i.src_info.no, i._id, "", "", 0, 0);
                }
            }

            string resultMsg = "[작업완료]";
            if (sMsg.Count > 0)
            {
                resultMsg += "\n성공 : " + sMsg[0] + " 외 " + sMsg.Count + "건";
            }
            if (fMsg != "")
            {
                resultMsg += "\n실패 : " + fMsg;
            }

            return resultMsg;
        }
예제 #5
0
        /// <summary>
        /// 필수선택 임시저장
        /// </summary>
        public void SetTempGEPItems(List<GepItemsData> selections, string ta_id)
        {
            List<GepItemsData> resultGEPItems = new List<GepItemsData>(); // 최종저장할 GepItemsData

            foreach (GepItemsData sel in selections)
            {
                if (sel.src_info.sel_qty <= 0) continue; // 품절일 때 선택저장불가

                string gd_no = sel.src_info.no;
                string gd_img = sel.img;

                // 필터링으로부터 상품만들기
                SourceItemInfoT info = new GmarketItemBiz().GetSourceItem(ta_id, gd_no);
                string Desc = new GmarketItemBiz().GetSourceItemDescription(gd_no);

                // 본 상품이 해외배송 불가, 판매자 미동의 상품인 경우 선택저장불가
                if (info.OverseasDeliveryYn.ToUpper() == "N" || info.AgreeYn.ToUpper() == "N") continue;

                // eBay VeRO 체크 - 한 상품에 대한 임시저장이므로 첫번째 항목에서 걸리면 전체를 중지하고 throw하면 된다.
                string matchKeyword = null;
                bool isLimit = new eBayItemBiz().ContainseBayVeroKeyword(info.Name, out matchKeyword);
                if (isLimit == true)
                {
                    throw new ValidationException("상품명에 입력된 [" + matchKeyword + "] 단어는 eBay VeRO 정책에 적합하지 않습니다. 작업을 중지합니다.");
                }
                if (string.IsNullOrWhiteSpace(info.EngName) == false)
                {
                    isLimit = new eBayItemBiz().ContainseBayVeroKeyword(info.EngName, out matchKeyword);
                    if (isLimit == true)
                    {
                        throw new ValidationException("영문상품명에 입력된 [" + matchKeyword + "] 단어는 eBay VeRO 정책에 적합하지 않습니다. 작업을 중지합니다.");
                    }
                }

                GepItemsData resultGEPItem = new GepItemsData();
                resultGEPItem._id = GetNextGEPItemID();
                resultGEPItem.stat = "S1"; // resultGEPItemStatusEnum.StanBy;
                resultGEPItem.img = gd_img;
                resultGEPItem.src_site = "GMKT";
                resultGEPItem.src_info = new src_info();
                resultGEPItem.src_info.no = gd_no;
                resultGEPItem.src_info.name = info.Name;
                resultGEPItem.src_info.eng_name = info.EngName;
                resultGEPItem.src_info.seller = new seller();
                resultGEPItem.src_info.seller.no = info.SellerNo;
                resultGEPItem.src_info.seller.sid = info.SellerID;
                resultGEPItem.src_info.seller.name = info.SellerName;
                resultGEPItem.src_info.seller.tel = info.SellerTel;
                resultGEPItem.src_info.seller.cell = info.SellerCell;
                resultGEPItem.src_info.seller.email = info.SellerEmail;
                resultGEPItem.src_info.lcategory = new lcategory();
                resultGEPItem.src_info.lcategory.cid = info.LCategoryCode;
                resultGEPItem.src_info.lcategory.name = info.LCategoryName;
                resultGEPItem.src_info.mcategory = new mcategory();
                resultGEPItem.src_info.mcategory.cid = info.MCategoryCode;
                resultGEPItem.src_info.mcategory.name = info.MCategoryName;
                resultGEPItem.src_info.scategory = new scategory();
                resultGEPItem.src_info.scategory.cid = info.SCategoryCode;
                resultGEPItem.src_info.scategory.name = info.SCategoryName;
                resultGEPItem.src_info.desc = Desc;
                resultGEPItem.src_info.price = Util.GetSafeInt(info.SellPrice);
                resultGEPItem.src_info.settle_price = Util.GetSafeInt(info.CostPrice);
                resultGEPItem.src_info.qty = info.StockQty;
                resultGEPItem.src_info.weight = Util.GetSafeInt(info.Weight);
                resultGEPItem.src_info.dc = Util.GetSafeInt(info.SellerDiscountPrice);
                resultGEPItem.src_info.origin = info.Origin;
                resultGEPItem.src_info.dlv = new dlv();
                resultGEPItem.src_info.dlv.dlv_gr_no = info.DeliveryGroupNo;
                resultGEPItem.src_info.dlv.dlv_gr_nm = info.DeliveryGroupName;
                resultGEPItem.src_info.dlv.bs_money = Util.GetSafeInt(info.BasisMoney);
                resultGEPItem.src_info.dlv.dlv_fee = Util.GetSafeInt(info.DeliveryFee);
                resultGEPItem.src_info.dlv.who_fee = info.WhoFee;
                resultGEPItem.src_info.dlv.bs_weight = Util.GetSafeInt(info.BasisWeight);
                resultGEPItem.src_info.dlv.bs_amt = Util.GetSafeInt(info.BasisAmount);
                resultGEPItem.src_info.dlv.bs_type = info.BasisType;
                resultGEPItem.src_info.dlv.dlv_fee_yn = info.DeliveryFeeYn;
                resultGEPItem.src_info.dlv.dlv_fee_cond = info.DeliveryFeeCondition;
                // 필수선택 정보 들어감
                resultGEPItem.src_info.sel_no = sel.src_info.sel_no;
                resultGEPItem.src_info.sel_name = sel.src_info.sel_name;
                resultGEPItem.src_info.sel_price = sel.src_info.sel_price;
                resultGEPItem.src_info.sel_qty = sel.src_info.sel_qty;
                // 필수선택 정보 들어감
                resultGEPItem.src_info.overseas_sold_cnt = info.OverseasSoldCount;
                resultGEPItem.src_info.total_price = Util.GetSafeInt(info.SellPrice + info.DeliveryFee - info.SellerDiscountPrice);
                resultGEPItem.ver_code = "";
                resultGEPItem.trans = new List<trans>();
                resultGEPItem.is_exp = false;
                resultGEPItem.rdate = DateTime.Now;
                resultGEPItem.udate = DateTime.Now;
                resultGEPItem.ta = ta_id;
                resultGEPItem.total_exp_count = 0;
                resultGEPItem.latest_exp_date = DateTime.Now;
                resultGEPItem.exp_ta = "";

                resultGEPItems.Add(resultGEPItem);
            }

            // Batch Insert (임시저장은 히스토리를 남기지 않음)
            new GmarketItemDac().InsertGEPItem(resultGEPItems);
        }
예제 #6
0
        private static void SaveExportHistory(string loginId, BsonDocument bsonDocument, ExportSecondSite exportSite, GepItemsData gepItem)
        {
            GepeBayExportHistory history = new GepeBayExportHistory();
            history._id = ObjectId.GenerateNewId();
            history.gep_id = gepItem._id;
            history.gep_img = gepItem.img;
            history.gep_stat = gepItem.stat;
            history.expt_site = exportSite.second_siteId;
            history.lang = exportSite.lang;
            foreach (var trans in gepItem.trans)
            {
                string lang = "EN";
                if (trans.lang == "US" || trans.lang == "UK" || trans.lang == "AU")
                {
                    lang = "EN";
                }
                else
                {
                    lang = trans.lang;
                }

                if (exportSite.lang == lang)
                {
                    history.tran_name = trans.name;
                    history.tran_sel = trans.sel_name;
                    history.tran_desc = trans.desc;
                }
            }
            foreach (var documentCollection in bsonDocument)
            {
                if (documentCollection.Name == "_id")
                {
                    history.tmpl_id = documentCollection.Value.ToString();
                }
            }
            history.ta = loginId;
            history.expt_date = DateTime.Now;
            new eBayItemDac().SaveExportHistory(history);
        }
        /// <summary>
        /// 임시 GEP 코드 생성
        /// </summary>
        public JsonResult SetGmarketOptionInfoSave(ReqTempData dataList)
        {
            if (dataList == null) return Json(false);

            string[] ItemNo = dataList.ArrayNo.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            string[] ItemImage = dataList.ArrayImage.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            string[] SelName = dataList.ArraySelName.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            string[] SelStock = dataList.ArraySelStock.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            string[] SelPrice = dataList.ArraySelPrice.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            string[] SelNo = dataList.ArraySelNo.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

            if (ItemNo.Length != SelNo.Length) return Json(false);

            List<GepItemsData> reqItem = new List<GepItemsData>();

            for (int i = 0; i < ItemNo.Length; i++)
            {
                if (Util.GetSafeInt(SelStock[i]) > 0) // 재고가 없으면 선택 불가
                {
                    GepItemsData item = new GepItemsData();
                    item.img = ItemImage[i];
                    item.src_info = new src_info();
                    item.src_info.no = ItemNo[i];
                    item.src_info.sel_name = SelName[i];
                    item.src_info.sel_qty = Util.GetSafeInt(SelStock[i]);
                    item.src_info.sel_price = Util.GetSafeInt(SelPrice[i]);
                    item.src_info.sel_no = new MongoDB.Bson.BsonArray();

                    string[] s = SelNo[i].Split(new char[] { '_' }, StringSplitOptions.RemoveEmptyEntries);
                    for (int j = 0; j < s.Length; j++)
                    {
                        item.src_info.sel_no.Add(s[j]);
                    }

                    reqItem.Add(item);
                }
            }

            try
            {
                new GmarketItemBiz().SetTempGEPItems(reqItem, MemberContext.LoginID);
            }
            catch
            {
                return Json(false);
            }

            return Json(true);
        }
        public JsonResult SetCreateGepItem(ReqData dataList)
        {
            if (dataList == null) return Json(false);
            MemberContext member = ViewBag.memberContext;

            string[] ItemNo = dataList.ArrayNo.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            string[] ItemImage = dataList.ArrayImage.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

            if (ItemNo.Length != ItemImage.Length) return Json(false);

            List<GepItemsData> reqItem = new List<GepItemsData>();

            for (int i = 0; i < ItemNo.Length; i++)
            {
                GepItemsData item = new GepItemsData();
                item.img = ItemImage[i];
                item.src_info = new src_info();
                item.src_info.no = ItemNo[i];

                reqItem.Add(item);
            }

            string msg = "";

            try
            {
                msg = new GmarketItemBiz().SetGEPItems(reqItem, member.LoginID);
            }
            catch
            {
                msg = "알 수 없는 오류로 작업에 실패하였습니다.";
            }

            var result = new
            {
                result_msg = msg
            };

            return Json(result);
        }
예제 #9
0
        /// <summary>
        /// 필수선택 임시저장
        /// </summary>
        public void SetTempGEPItems(List<GepItemsData> selections, string ta_id)
        {
            List<GepItemsData> resultGEPItems = new List<GepItemsData>(); // 최종저장할 GepItemsData

            foreach (GepItemsData sel in selections)
            {
                if (sel.src_info.sel_qty <= 0) continue; // 품절일 때 선택저장불가

                string gd_no = sel.src_info.no;
                string gd_img = sel.img;

                // 필터링으로부터 상품만들기
                SourceItemInfoT info = new SourceItemBiz().GetSourceItem(ta_id, gd_no);
                string Desc = new SourceItemBiz().GetSourceItemDescription(gd_no);

                GepItemsData resultGEPItem = new GepItemsData();
                resultGEPItem._id = GetNextGEPItemID();
                resultGEPItem.stat = "S1"; // resultGEPItemStatusEnum.StanBy;
                resultGEPItem.img = gd_img;
                resultGEPItem.src_site = "GMKT";
                resultGEPItem.src_info = new src_info();
                resultGEPItem.src_info.no = gd_no;
                resultGEPItem.src_info.name = info.Name;
                resultGEPItem.src_info.seller = new seller();
                resultGEPItem.src_info.seller.no = info.SellerNo;
                resultGEPItem.src_info.seller.sid = info.SellerID;
                resultGEPItem.src_info.seller.name = info.SellerName;
                resultGEPItem.src_info.seller.tel = info.SellerTel;
                resultGEPItem.src_info.seller.cell = info.SellerCell;
                resultGEPItem.src_info.seller.email = info.SellerEmail;
                resultGEPItem.src_info.lcategory = new lcategory();
                resultGEPItem.src_info.lcategory.cid = info.LCategoryCode;
                resultGEPItem.src_info.lcategory.name = info.LCategoryName;
                resultGEPItem.src_info.mcategory = new mcategory();
                resultGEPItem.src_info.mcategory.cid = info.MCategoryCode;
                resultGEPItem.src_info.mcategory.name = info.MCategoryName;
                resultGEPItem.src_info.scategory = new scategory();
                resultGEPItem.src_info.scategory.cid = info.SCategoryCode;
                resultGEPItem.src_info.scategory.name = info.SCategoryName;
                resultGEPItem.src_info.desc = Desc;
                resultGEPItem.src_info.price = Util.GetSafeInt(info.SellPrice);
                resultGEPItem.src_info.settle_price = Util.GetSafeInt(info.CostPrice);
                resultGEPItem.src_info.qty = info.StockQty;
                resultGEPItem.src_info.weight = Util.GetSafeInt(info.Weight);
                resultGEPItem.src_info.dc = Util.GetSafeInt(info.SellerDiscountPrice);
                resultGEPItem.src_info.origin = info.Origin;
                resultGEPItem.src_info.dlv = new dlv();
                resultGEPItem.src_info.dlv.dlv_gr_no = info.DeliveryGroupNo;
                resultGEPItem.src_info.dlv.dlv_gr_nm = info.DeliveryGroupName;
                resultGEPItem.src_info.dlv.bs_money = Util.GetSafeInt(info.BasisMoney);
                resultGEPItem.src_info.dlv.dlv_fee = Util.GetSafeInt(info.DeliveryFee);
                resultGEPItem.src_info.dlv.who_fee = info.WhoFee;
                resultGEPItem.src_info.dlv.bs_weight = Util.GetSafeInt(info.BasisWeight);
                resultGEPItem.src_info.dlv.bs_amt = Util.GetSafeInt(info.BasisAmount);
                resultGEPItem.src_info.dlv.bs_type = info.BasisType;
                resultGEPItem.src_info.dlv.dlv_fee_yn = info.DeliveryFeeYn;
                resultGEPItem.src_info.dlv.dlv_fee_cond = info.DeliveryFeeCondition;
                // 필수선택 정보 들어감
                resultGEPItem.src_info.sel_no = sel.src_info.sel_no;
                resultGEPItem.src_info.sel_name = sel.src_info.sel_name;
                resultGEPItem.src_info.sel_price = sel.src_info.sel_price;
                resultGEPItem.src_info.sel_qty = sel.src_info.sel_qty;
                // 필수선택 정보 들어감
                resultGEPItem.src_info.overseas_sold_cnt = info.OverseasSoldCount;
                resultGEPItem.src_info.total_price = Util.GetSafeInt(info.SellPrice + info.DeliveryFee - info.SellerDiscountPrice);
                resultGEPItem.ver_code = "";
                resultGEPItem.trans = new List<trans>();
                resultGEPItem.is_exp = false;
                resultGEPItem.rdate = DateTime.Now;
                resultGEPItem.udate = DateTime.Now;
                resultGEPItem.ta = ta_id;
                resultGEPItem.total_exp_count = 0;
                resultGEPItem.latest_exp_date = DateTime.Now;
                resultGEPItem.exp_ta = "";

                resultGEPItems.Add(resultGEPItem);
            }

            // Batch Insert (임시저장은 히스토리를 남기지 않음)
            new SourceItemDac().InsertGEPItem(resultGEPItems);
        }
예제 #10
0
        /// <summary>
        /// GEP로 소스상품 이관 
        /// </summary>
        public void SetGEPItems(List<GepItemsData> reqMotherItems, string ta_id)
        {
            List<GepItemsData> resultGEPItems = new List<GepItemsData>(); // 최종저장할 GepItemsData

            // 넘어온 reqMotherItems에는 소스상품번호(src_info.no)와 이미지(img)만 값이 들어있다.
            foreach (GepItemsData motherItem in reqMotherItems)
            {
                string gd_no = motherItem.src_info.no;
                string gd_img = motherItem.img;

                // 임시저장된 필수선택 리스트(TempGEPItem)를 가져온다.
                List<GepItemsData> tmpGEPItems = new SourceItemBiz().GetTempGEPItemList(ta_id, gd_no);

                if (tmpGEPItems != null && tmpGEPItems.Count > 0)
                {
                    foreach (GepItemsData t in tmpGEPItems)
                    {
                        t.stat = "S2";
                        new SourceItemDac().UpdateGEPItem(t); // 상태만 S1 -> S2 바로 업데이트

                        long[] sel = GmktUtil.GetOptionNoLongArrayFull(t.src_info.sel_no.RawValues);
                        new SourceItemDac().SetSourceItemHistory(ta_id, gd_no, t._id, sel[0], sel[1], sel[2], sel[3], sel[4]); // History
                    }
                }
                else
                {
                    // 필수선택이 없는 소스상품은 Insert를 위해 필터링 DB에서 나머지를 채운다.
                    SourceItemInfoT info = new SourceItemBiz().GetSourceItem(ta_id, gd_no);
                    string Desc = new SourceItemBiz().GetSourceItemDescription(gd_no);

                    GepItemsData resultGEPItem = new GepItemsData();
                    resultGEPItem._id = GetNextGEPItemID();
                    resultGEPItem.stat = "S2"; // resultGEPItemStatusEnum.Active;
                    resultGEPItem.img = gd_img;
                    resultGEPItem.src_site = "GMKT";
                    resultGEPItem.src_info = new src_info();
                    resultGEPItem.src_info.no = gd_no;
                    resultGEPItem.src_info.name = info.Name;
                    resultGEPItem.src_info.seller = new seller();
                    resultGEPItem.src_info.seller.no = info.SellerNo;
                    resultGEPItem.src_info.seller.sid = info.SellerID;
                    resultGEPItem.src_info.seller.name = info.SellerName;
                    resultGEPItem.src_info.seller.tel = info.SellerTel;
                    resultGEPItem.src_info.seller.cell = info.SellerCell;
                    resultGEPItem.src_info.seller.email = info.SellerEmail;
                    resultGEPItem.src_info.lcategory = new lcategory();
                    resultGEPItem.src_info.lcategory.cid = info.LCategoryCode;
                    resultGEPItem.src_info.lcategory.name = info.LCategoryName;
                    resultGEPItem.src_info.mcategory = new mcategory();
                    resultGEPItem.src_info.mcategory.cid = info.MCategoryCode;
                    resultGEPItem.src_info.mcategory.name = info.MCategoryName;
                    resultGEPItem.src_info.scategory = new scategory();
                    resultGEPItem.src_info.scategory.cid = info.SCategoryCode;
                    resultGEPItem.src_info.scategory.name = info.SCategoryName;
                    resultGEPItem.src_info.desc = Desc;
                    resultGEPItem.src_info.price = Util.GetSafeInt(info.SellPrice);
                    resultGEPItem.src_info.settle_price = Util.GetSafeInt(info.CostPrice);
                    resultGEPItem.src_info.qty = info.StockQty;
                    resultGEPItem.src_info.weight = Util.GetSafeInt(info.Weight);
                    resultGEPItem.src_info.dc = Util.GetSafeInt(info.SellerDiscountPrice);
                    resultGEPItem.src_info.origin = info.Origin;
                    resultGEPItem.src_info.dlv = new dlv();
                    resultGEPItem.src_info.dlv.dlv_gr_no = info.DeliveryGroupNo;
                    resultGEPItem.src_info.dlv.dlv_gr_nm = info.DeliveryGroupName;
                    resultGEPItem.src_info.dlv.bs_money = Util.GetSafeInt(info.BasisMoney);
                    resultGEPItem.src_info.dlv.dlv_fee = Util.GetSafeInt(info.DeliveryFee);
                    resultGEPItem.src_info.dlv.who_fee = info.WhoFee;
                    resultGEPItem.src_info.dlv.bs_weight = Util.GetSafeInt(info.BasisWeight);
                    resultGEPItem.src_info.dlv.bs_amt = Util.GetSafeInt(info.BasisAmount);
                    resultGEPItem.src_info.dlv.bs_type = info.BasisType;
                    resultGEPItem.src_info.dlv.dlv_fee_yn = info.DeliveryFeeYn;
                    resultGEPItem.src_info.dlv.dlv_fee_cond = info.DeliveryFeeCondition;
                    //resultGEPItem.src_info.sel_no
                    //resultGEPItem.src_info.sel_name
                    //resultGEPItem.src_info.sel_price
                    //resultGEPItem.src_info.sel_qty
                    resultGEPItem.src_info.overseas_sold_cnt = info.OverseasSoldCount;
                    resultGEPItem.src_info.total_price = Util.GetSafeInt(info.SellPrice + info.DeliveryFee - info.SellerDiscountPrice);
                    resultGEPItem.ver_code = "";
                    resultGEPItem.trans = new List<trans>();
                    resultGEPItem.is_exp = false;
                    resultGEPItem.rdate = DateTime.Now;
                    resultGEPItem.udate = DateTime.Now;
                    resultGEPItem.ta = ta_id;
                    resultGEPItem.total_exp_count = 0;
                    resultGEPItem.latest_exp_date = DateTime.Now;
                    resultGEPItem.exp_ta = "";

                    resultGEPItems.Add(resultGEPItem);
                }
            }

            // Batch Insert
            if (resultGEPItems.Count > 0)
            {
                new SourceItemDac().InsertGEPItem(resultGEPItems);

                // 이관 History (Batch Insert한 건들은 필수선택이 없으므로 opt_no는 모두 0으로 넘김
                foreach (GepItemsData i in resultGEPItems)
                {
                    new SourceItemDac().SetSourceItemHistory(ta_id, i.src_info.no, i._id, 0, 0, 0, 0, 0);
                }
            }
        }