/// <summary>
        /// 도착 확인 스캔
        /// </summary>
        /// <param name="scanNumber">송장번호</param>
        /// <param name="userID">사용자 아이디</param>
        /// <returns>스캔 결과</returns>
        public TransportResultSet ArriveScan(int scanNumber, string userID)
        {
            TransportResultSet transportResultSet = new TransportResultSet();

            GepWarehouse gepWarehouse = new TransportGepWarehouseDac().FindOne(scanNumber);

            if (gepWarehouse == null)
            {
                gepWarehouse = new GepWarehouse();

                gepWarehouse.contr_no = scanNumber;
                gepWarehouse.state = WarehouseStateEnum.Arrival;
                gepWarehouse.arrived_dt = DateTime.Now;
                gepWarehouse.arrived_id = userID;
                gepWarehouse.isCanceled = false;
                gepWarehouse.label_print_dt = DateTime.Now;
                gepWarehouse.label_print_id = userID;

            }
            else if (gepWarehouse.state == WarehouseStateEnum.Arrival)
            {
                transportResultSet.KeyValue = scanNumber.ToString();
                transportResultSet.Code = ResultCodeEnum.Error;
                transportResultSet.Message = "이미 도착확인된 상품입니다.";
                return transportResultSet;
            }
            else if (gepWarehouse.state != WarehouseStateEnum.Ready)
            {
                transportResultSet.KeyValue = scanNumber.ToString();
                transportResultSet.Code = ResultCodeEnum.Error;
                transportResultSet.Message = String.Format("이미 처리된 상품입니다.\n (상태: {0})", gepWarehouse.state);
                return transportResultSet;
            }

            //배송상태 체크
            transportResultSet = new TransportCommonBiz().CheckCoreTranseportState(scanNumber);

            if (ResultCodeEnum.Error == transportResultSet.Code)
                return transportResultSet;

            /*
            //2012.04.14 jdkim SetGepWarehouseFromOrderData()로 변경
            //주문정보 및 국내배송정보조회
            GepTransInfo gepTransInfo = new TransportCommonBiz().GetGepTransInfoData(scanNumber, ref gepWarehouse);

            if (gepTransInfo == null)
            {
                transportResultSet.KeyValue = scanNumber.ToString();
                transportResultSet.Code = ResultCodeEnum.Error;
                transportResultSet.Message = "Gep 배송 정보가 없습니다.";
                return transportResultSet;
            }
            */

            transportResultSet = new TransportCommonBiz().SetGepWarehouseFromOrderData(scanNumber.ToString(), userID, ref gepWarehouse);

            if (ResultCodeEnum.OK != transportResultSet.Code)
                return transportResultSet;

            //Warehouse 저장
            new TransportGepWarehouseDac().Save(gepWarehouse);

            //상태변경
            if (!new TransportCommonBiz().SetTransportState(scanNumber, WarehouseStateEnum.Arrival, userID))
            {
                transportResultSet.KeyValue = scanNumber.ToString();
                transportResultSet.Code = ResultCodeEnum.Error;
                transportResultSet.Message = "gopm상태값 변경에 문제가 있습니다.";
                return transportResultSet;
            }

            //국내 배송완료
            TransportD4UpdateT transportD4UpdateT = new TransportCommonBiz().TransportD4Update(scanNumber, userID, "S", "GEP국내배송처리", "N");

            if (transportD4UpdateT.Error != 0)
            {
                transportResultSet.KeyValue = scanNumber.ToString();
                transportResultSet.Code = ResultCodeEnum.Error;
                transportResultSet.Message = "국내배송 도착확인 처리에 문제가 있습니다.";
                //Result.Message = D4Data.RetMsg;
                return transportResultSet;
            }

            transportResultSet.KeyValue = scanNumber.ToString();
            transportResultSet.Code = ResultCodeEnum.OK;
            transportResultSet.Message = "";

            return transportResultSet;
        }
        /// <summary>
        /// 묶음 배송된 상품 도착 확인
        /// </summary>
        /// <param name="scanValue">송장번호</param>
        /// <param name="userID">유저 아이디</param>
        /// <returns>도착 확인 결과</returns>
        public List<TransportResultSet> SetSummeryArrive(int scanValue, string userID)
        {
            List<TransportResultSet> listTransportResultSet = new List<TransportResultSet>();

            GepWarehouse gepWarehouse = new TransportGepWarehouseDac().FindOne(scanValue);

            if (gepWarehouse == null)
            {
                listTransportResultSet.Add(new TransportResultSet()
                {
                    KeyValue = scanValue.ToString()
                    ,
                    Code = ResultCodeEnum.Error
                    ,
                    Message = "도착 확인된 건이 아닙니다."
                });

                return listTransportResultSet;
            }

            string LocalInvoceNum = gepWarehouse.transinfo.local_invoice_no;

            List<GepTransInfo> listGepTransInfo = new TransportCommonBiz().GetGepTransInfoDatas(LocalInvoceNum);

            if (listGepTransInfo == null)
            {
                listTransportResultSet.Add(new TransportResultSet()
                {
                    KeyValue = scanValue.ToString()
                    ,
                    Code = ResultCodeEnum.Error
                    ,
                    Message = "Gep 연동 데이터가 없습니다."
                });

                return listTransportResultSet;
            }

            var q = (from t in listGepTransInfo
                     where t.contr_no != scanValue
                     select t).ToList();

            foreach (var t in q)
            {
                listTransportResultSet.Add(ArriveScan(t.contr_no, userID));
            }

            return listTransportResultSet;
        }
        /// <summary>
        /// 배송완료 상품 송장입력
        /// </summary>
        /// <param name="orderNums">송장번호들 (구분자 ^)</param>
        /// <param name="invoiceNums">해외송장번호들 (구분자 ^)</param>
        /// <param name="userID">사용자 아이디</param>
        /// <returns></returns>
        public List<TransportResultSet> SetInvoceNums(int[] orderNums, string[] invoiceNums, string userID)
        {
            List<TransportResultSet> Results = new List<TransportResultSet>();

            if (orderNums.Length != invoiceNums.Length)
            {
                Results.Add(new TransportResultSet() {
                    KeyValue = ""
                    ,Code = ResultCodeEnum.Error
                    ,Message = "인자값이 잘못되었습니다."
                });
                return Results;
            }

            for (int k = 0; k < orderNums.Length; k++)
            {
                GepWarehouse gepWarehouse = new TransportGepWarehouseDac().FindOne(orderNums[k]);

                if (gepWarehouse == null)
                {
                    Results.Add(new TransportResultSet()
                    {
                        KeyValue = orderNums[k].ToString()
                        ,
                        Code = ResultCodeEnum.Error
                        ,
                        Message = "도착확인되지 않은 상품입니다."
                    });
                    continue;
                }

                var q = (from t in gepWarehouse.trans_way_hist
                         orderby t.reg_dt descending
                         select t).ToList();

                if (q.Count == 0)
                {
                    Results.Add(new TransportResultSet()
                    {
                        KeyValue = orderNums[k].ToString()
                        ,
                        Code = ResultCodeEnum.Error
                        ,
                        Message = "상품 배송 방법 정보가 없습니다"
                    });
                    continue;
                }

                string transWayCode = new TransportCommonBiz().GetTransWayCode(q[0].transport_way);
                if (transWayCode != "SP" && transWayCode != "RR")
                {
                    Results.Add(new TransportResultSet()
                    {
                        KeyValue = orderNums[k].ToString()
                        ,
                        Code = ResultCodeEnum.Error
                        ,
                        Message = "항공소형포장건 입니다."
                    });
                    continue;
                }

                if (gepWarehouse.state != WarehouseStateEnum.Submitting && gepWarehouse.state != WarehouseStateEnum.InputInvoice)
                {
                    Results.Add(new TransportResultSet()
                    {
                        KeyValue = orderNums[k].ToString()
                        ,
                        Code = ResultCodeEnum.Error
                        ,
                        Message = "gopm 상태값이 송장 입력할수 있는 상태가 아닙니다."
                    });
                    continue;
                }

                gepWarehouse.invoice_input_dt = DateTime.Now;
                gepWarehouse.invoice_input_id = userID;
                gepWarehouse.state = WarehouseStateEnum.InputInvoice;
                gepWarehouse.transinfo.state = GepShippingStateEnum.Tracking;

                gepWarehouse.transinfo.oversea_invoice_no = invoiceNums[k];

                new TransportGepWarehouseDac().Save(gepWarehouse);

                new TransportCommonBiz().SetTransportState(orderNums[k], WarehouseStateEnum.InputInvoice, userID);

                Results.Add(new TransportResultSet() {
                    KeyValue = gepWarehouse.contr_no.ToString()
                    ,Code = ResultCodeEnum.OK
                    ,Message = ""
                });
            }

            return Results;
        }
        /// <summary>
        /// 묶음 배송된 상품 데이터 취득
        /// </summary>
        /// <param name="scanValue">송장번호</param>
        /// <returns>해당하는 송장의 국내 배송번호가 같은 상품 데이터</returns>
        public List<ArriveGridData> GetSummeryArriveData(int scanValue)
        {
            GepWarehouse gepWarehouse = new TransportGepWarehouseDac().FindOne(scanValue);

            if (gepWarehouse == null || gepWarehouse.transinfo == null || gepWarehouse.transinfo.local_invoice_no == null)
            {
                return null;
            }

            List<GepWarehouse> listGepWarehouse = new TransportGepWarehouseDac().Find(gepWarehouse.transinfo.local_invoice_no);

            if (listGepWarehouse == null)
            {
                return null;
            }

            List<GepTransInfo> listGepTransInfo = new TransportCommonBiz().GetGepTransInfoDatas(gepWarehouse.transinfo.local_invoice_no);

            if (listGepTransInfo == null)
            {
                return null;
            }

            List<ArriveGridData> listArriveGridData = new List<ArriveGridData>();

            int k = 0;
            foreach (var t in listGepTransInfo)
            {
                if (t == null)
                {
                    continue;
                }

                k++;

                int Count = 0;

                if (listGepWarehouse != null && listGepWarehouse.Count != 0)
                {
                    Count = (from f in listGepWarehouse
                                 where t.contr_no == f.contr_no
                                 select t).Count();
                }

                listArriveGridData.Add(new ArriveGridData()
                {
                    Idx = k.ToString()
                    ,
                    ArrivedDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
                    ,
                    BuyerID = t.clone_buyer_id
                    ,
                    BuyerName = t.clone_buyer_name
                    ,
                    EbayContractDate = ""
                    ,
                    ForeingConutryTransc = t.trans_way.transport_way
                    ,
                    InvoiceNum = t.local_invoice_no
                    ,
                    LocalTransc = t.local_express_nm
                    ,
                    ObjectID = ObjectId.GenerateNewId().ToString()
                    ,
                    OrderNum = t.contr_no.ToString()
                    ,
                    ProductAmt = t.gep_order_count.ToString()
                    ,
                    ProductName = t.clone_item_name
                    ,
                    ProductNum = t.clone_item_no.ToString()
                    ,
                    ProductOption = t.clone_option_info
                    ,
                    SellerID = t.clone_seller_id
                    ,
                    SellerName = t.clone_seller_name
                    ,
                    State = Count == 0 ? "입고" : "도착"
                });
            }

            return listArriveGridData;
        }
        /// <summary>
        /// 배송대기 스캔
        /// </summary>
        /// <param name="scanValue">체결번호</param>
        /// <param name="userID">사용자 아이디</param>
        /// <returns>스캔 결과</returns>
        public TransportResultSet SetDeliveryReadyWaitScan(int scanValue, string userID)
        {
            TransportResultSet transportResultSet = new TransportResultSet();

            transportResultSet.KeyValue = scanValue.ToString();

            GepWarehouse gepWarehouse = new TransportGepWarehouseDac().FindOne(scanValue);

            if (gepWarehouse == null)
            {
                transportResultSet = new TransportCommonBiz().CheckCoreTranseportState(scanValue);
                if (0 < transportResultSet.Message.IndexOf("해외배송"))
                {
                    return transportResultSet;
                }
                else
                {
                    transportResultSet.KeyValue = scanValue.ToString();
                    transportResultSet.Code = ResultCodeEnum.Error;
                    transportResultSet.Message = "GEP 물류센터정보에 등록되어 있지 않는 건입니다.";
                    return transportResultSet;
                }
            }

            var q = (from t in gepWarehouse.trans_way_hist
                     orderby t.reg_dt descending
                     select t).ToList();

            if (q[0].transport_way != "SP" && q[0].transport_way != "RR")
            {
                transportResultSet.Message = "GEP-EMS 해외배송건 입니다.";
                transportResultSet.Code = ResultCodeEnum.Error;
                return transportResultSet;
            }

            if (gepWarehouse.state != WarehouseStateEnum.PackingBox && gepWarehouse.state != WarehouseStateEnum.Submitting)
            {
                transportResultSet.KeyValue = scanValue.ToString();
                transportResultSet.Code = ResultCodeEnum.Error;
                transportResultSet.Message = "상품 상태값이 배송대기 스캔할 수 없는 상태입니다.";
                return transportResultSet;
            }

            //배송상태 체크
            transportResultSet = new TransportCommonBiz().CheckCoreTranseportState(scanValue);

            if (ResultCodeEnum.Error == transportResultSet.Code)
                return transportResultSet;

            transportResultSet.Code = ResultCodeEnum.OK;
            transportResultSet.Message = "";

            return transportResultSet;
        }
        /// <summary>
        /// 무게 수신 정보 저장
        /// </summary>
        /// <param name="contrNo">체결번호</param>
        /// <param name="scanWeight">무게</param>
        /// <param name="userID">사용자 아이디</param>
        /// <returns>무게 수신 결과</returns>
        public TransportResultSet SetDeliveryReadyWeightSave(int contrNo, int scanWeight, string userID)
        {
            TransportResultSet transportResultSet = new TransportResultSet();

            transportResultSet.KeyValue = contrNo.ToString();

            GepWarehouse gepWarehouse = new TransportGepWarehouseDac().FindOne(contrNo);

            if (gepWarehouse == null)
            {
                transportResultSet.KeyValue = contrNo.ToString();
                transportResultSet.Code = ResultCodeEnum.Error;
                transportResultSet.Message = "GEP 물류센터정보에 등록되어 있지 않는 건입니다.";
                return transportResultSet;
            }

            if (gepWarehouse.state != WarehouseStateEnum.Arrival && gepWarehouse.state != WarehouseStateEnum.PackingBox)
            {
                transportResultSet.KeyValue = contrNo.ToString();
                transportResultSet.Code = ResultCodeEnum.Error;
                transportResultSet.Message = "상품 상태값이 배송준비 스캔할 수 없는 상태입니다.";
                return transportResultSet;
            }

            var tw = (from t in gepWarehouse.trans_way_hist
                      orderby t.reg_dt descending
                      select t).ToList();

            int Cost = new TransportCommonBiz().GetTransportCostForWeight(scanWeight,
                                                            gepWarehouse.sitetransinfo.sender_iso_country_code,
                                                            gepWarehouse.sitetransinfo.receiver_iso_country_code,
                                                            gepWarehouse.sitetransinfo.trans_way,
                                                            ShippingRateTypeEnum.GmktToExpress);

            if (Cost == 0)
            {
                transportResultSet.KeyValue = contrNo.ToString();
                transportResultSet.Code = ResultCodeEnum.Error;
                transportResultSet.Message = "배송비 계산에 문제가 있습니다.";
                return transportResultSet;
            }

            gepWarehouse.trns_cost.real_weight = scanWeight;
            gepWarehouse.trns_cost.real_transport_cost = Cost;
            gepWarehouse.trns_cost.reg_dt = DateTime.Now;
            gepWarehouse.trns_cost.reg_id = userID;
            gepWarehouse.check_weight_dt = DateTime.Now;
            gepWarehouse.check_weight_id = userID;

            //new TransportGepWarehouseDac().Save(gepWarehouse);

            //if (!new TransportCommonBiz().SetTransportState(contrNo, WarehouseStateEnum.PackingBox, userID))
            //{
            //    transportResultSet.KeyValue = contrNo.ToString();
            //    transportResultSet.Code = ResultCodeEnum.Error;
            //    transportResultSet.Message = "gopm상태값 변경에 문제가 있습니다.";
            //    return transportResultSet;
            //}

            if (false == new TransportCommonBiz().SetTransportState(ref gepWarehouse, WarehouseStateEnum.PackingBox, userID))
            {
                transportResultSet.KeyValue = contrNo.ToString();
                transportResultSet.Code = ResultCodeEnum.Error;
                transportResultSet.Message = "gopm상태값 변경에 문제가 있습니다.";
                return transportResultSet;
            }

            //상태변경하고 저장
            new TransportGepWarehouseDac().Save(gepWarehouse);

            //실측무게 배송비 전달용
            transportResultSet.KeyValue = Cost.ToString();

            if (scanWeight > 2000)
            {
                transportResultSet.Code = ResultCodeEnum.MustChagneEMS;
                transportResultSet.Message = "EMS로 전환 요청";
            }
            else
            {
                transportResultSet.Code = ResultCodeEnum.OK;
                transportResultSet.Message = "";

                //gep 무게 업데이트
                new TransportCommonBiz().SetGepItemWeight(gepWarehouse.transinfo.gep_item_id.ToString(), scanWeight);
            }

            return transportResultSet;
        }
        /// <summary>
        /// 항공소형포장 EMS로 전환
        /// </summary>
        /// <param name="contrNo">체결번호</param>
        /// <param name="userID">사용자 아이디</param>
        /// <returns>전환 결과</returns>
        public TransportResultSet SetChagneEMS(int contrNo, string userID)
        {
            GepWarehouse gepWarehouse = new TransportGepWarehouseDac().FindOne(contrNo);

            if (gepWarehouse == null)
            {
                return new TransportResultSet()
                {
                    KeyValue = contrNo.ToString()
                    ,
                    Code = ResultCodeEnum.Error
                    ,
                    Message = "GEP 물류센터정보에 등록되어 있지 않는 건입니다."
                };
            }
            GepTransWay transWayInfo = new TransportCommonBiz().GetTransWayInfo("EMS");
            transWayInfo.transport_way = "EMS-2";
            transWayInfo.reg_dt = DateTime.Now;
            transWayInfo.reg_id = userID;

            gepWarehouse.trans_way_hist.Add(transWayInfo);
            gepWarehouse.transinfo.trans_way = transWayInfo;

            new TransportGepWarehouseDac().Save(gepWarehouse);

            return new TransportResultSet()
            {
                KeyValue = contrNo.ToString()
                ,Code = ResultCodeEnum.OK
                ,Message = "EMS 전환이 완료되었습니다."
            };
        }
        /// <summary>
        /// 배송준비 스캔
        /// </summary>
        /// <param name="scanValue">송장번호</param>
        /// <returns>스캔 결과</returns>
        public TransportResultSet SetDeliveryReadyScan(int scanValue)
        {
            TransportResultSet transportResultSet = new TransportResultSet();

            transportResultSet.KeyValue = scanValue.ToString();

            GepWarehouse gepWarehouse = new TransportGepWarehouseDac().FindOne(scanValue);

            if (gepWarehouse == null)
            {
                transportResultSet = new TransportCommonBiz().CheckCoreTranseportState(scanValue);
                if (0 < transportResultSet.Message.IndexOf("해외배송"))
                {
                    return transportResultSet;
                }
                else
                {
                    transportResultSet.KeyValue = scanValue.ToString();
                    transportResultSet.Code = ResultCodeEnum.Error;
                    transportResultSet.Message = "GEP 물류센터정보에 등록되어 있지 않는 건입니다.";
                    return transportResultSet;
                }
            }

            if (gepWarehouse.state != WarehouseStateEnum.Arrival && gepWarehouse.state != WarehouseStateEnum.PackingBox)
            {
                transportResultSet.KeyValue = scanValue.ToString();
                transportResultSet.Code = ResultCodeEnum.Error;
                transportResultSet.Message = "상품 상태값이 배송준비 스캔할 수 없는 상태입니다.";
                return transportResultSet;
            }

            if (gepWarehouse.trans_way_hist == null)
            {
                transportResultSet.Message = "상품 배송 방법 정보가 없습니다";
                transportResultSet.Code = ResultCodeEnum.Error;
                return transportResultSet;
            }

            var q = (from t in gepWarehouse.trans_way_hist
                    orderby t.reg_dt descending
                    select t).ToList();

            if(q.Count == 0)
            {
                transportResultSet.Message = "상품 배송 방법 정보가 없습니다";
                transportResultSet.Code = ResultCodeEnum.Error;
                return transportResultSet;
            }

            string transWayCode = new TransportCommonBiz().GetTransWayCode(q[0].transport_way);
            if (transWayCode != "SP" && transWayCode != "RR")
            {
                transportResultSet.Message = "GEP-EMS 해외배송건 입니다.";
                transportResultSet.Code = ResultCodeEnum.Error;
                return transportResultSet;
            }

            //배송상태 체크
            transportResultSet = new TransportCommonBiz().CheckCoreTranseportState(scanValue);

            if (ResultCodeEnum.Error == transportResultSet.Code)
                return transportResultSet;

            transportResultSet.Message = "";
            transportResultSet.Code = ResultCodeEnum.OK;
            return transportResultSet;
        }
Esempio n. 9
0
        /// <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;
        }
Esempio n. 10
0
        /// <summary>
        /// 배송방법별 - 배송사 정보 조회
        /// </summary>
        /// <param name="site_trans_way"></param>
        /// <returns></returns>
        public GepTransWay GetTransWayInfo(string trans_way)
        {
            string transWayCode = new TransportCommonBiz().GetTransWayCode(trans_way);

            GepTransWay gepTransWay = null;
            string appSettings = ConfigurationManager.AppSettings["TransWayConfigSettingUrl"];

            XmlDocument xDoc = new XmlDocument();

            xDoc.Load(appSettings);

            if (xDoc.DocumentElement == null || xDoc.DocumentElement.ChildNodes == null)
                return gepTransWay;

            XmlNodeList childNodes = xDoc.DocumentElement.ChildNodes;

            foreach (XmlNode node in childNodes)
            {
                if (node.Attributes["type"].Value == transWayCode)
                    gepTransWay = XmlToGepTrnasWay(node);
            }

            gepTransWay.reg_dt = DateTime.Now;
            gepTransWay.reg_id = "";

            return gepTransWay;
        }
Esempio n. 11
0
        private MainData GetMainDataCollect(string taId)
        {
            MainData data = new MainData();
            data.ta = taId;
            data.rdate = DateTime.Now;
            // eBay 결제 대기 건수
            data.ebay_wait_pay = Util.GetSafeInt(new eBayOrderBiz().GeteBayUnPaymentOrderCount(taId, 7));
            // eBay 결제 완료 건수
            data.ebay_paid = Util.GetSafeInt(new eBayOrderBiz().GeteBayPaidOrderCount(taId, 7));

            // eBay 반품 요청 건수
            Dictionary<string, long> diceBayReturn = new eBayOrderBiz().GeteBayReturnCount(taId, 7);
            List<MaineBayReturn> listeBayReturn = new List<MaineBayReturn>();
            foreach (var returnData in diceBayReturn)
            {
                MaineBayReturn eBayReturn = new MaineBayReturn();
                eBayReturn.acc_id = returnData.Key;
                eBayReturn.count = returnData.Value;
                listeBayReturn.Add(eBayReturn);
            }
            data.ebay_return = listeBayReturn;

            // G마켓 주문불가상품 건수
            data.gmkt_limit_pay = new GEPOrderBiz().GetGmktDisableOrderCount(taId, 7);
            //판매중지요청
            data.stop_listing = Util.GetSafeInt(GeteBayStopRequest(taId));

            GepShippingSummaryT gepShipping = new TransportCommonBiz().GetShippingSummary(taId);
            // 국내 배송 대기 건수
            data.local_trans = gepShipping.LocalWaitCnt;
            // 국내 배송 중 건수
            data.local_trans_wait = gepShipping.LocalShippingCnt;
            // 물류센터입고 건수
            data.gu_center_in = gepShipping.InWarehouseCnt;
            // 해외배송중 건수
            data.oversea_trans = gepShipping.InWarehouseCnt;
            return data;
        }
        /// <summary>
        /// 배송대기 스캔
        /// </summary>
        /// <param name="scanValue">송장번호</param>
        /// <param name="userID">사용자 아이디</param>
        /// <returns>스캔 결과</returns>
        public TransportResultSet SetDeliveryReadyWaitScan(int scanValue, string userID)
        {
            TransportResultSet transportResultSet = new TransportResultSet();

            transportResultSet.KeyValue = scanValue.ToString();

            GepWarehouse gepWarehouse = new TransportGepWarehouseDac().FindOne(scanValue);

            if (gepWarehouse == null)
            {
                transportResultSet = new TransportCommonBiz().CheckCoreTranseportState(scanValue);
                if (0 < transportResultSet.Message.IndexOf("해외배송"))
                {
                    return transportResultSet;
                }
                else
                {
                    transportResultSet.KeyValue = scanValue.ToString();
                    transportResultSet.Code = ResultCodeEnum.Error;
                    transportResultSet.Message = "GEP 물류센터정보에 등록되어 있지 않는 건입니다.";
                    return transportResultSet;
                }
            }

            var q = (from t in gepWarehouse.trans_way_hist
                     orderby t.reg_dt descending
                     select t).ToList();

            if (q.Count == 0)
            {
                transportResultSet.Message = "상품 배송 방법 정보가 없습니다";
                transportResultSet.Code = ResultCodeEnum.Error;
                return transportResultSet;
            }

            if (q[0].transport_way.IndexOf("EMS") < 0)
            {
                transportResultSet.Message = "항공소형포장건 입니다.";
                transportResultSet.Code = ResultCodeEnum.Error;
                return transportResultSet;
            }

            if (gepWarehouse.state != WarehouseStateEnum.PackingBox && gepWarehouse.state != WarehouseStateEnum.Submitting)
            {
                transportResultSet.KeyValue = scanValue.ToString();
                transportResultSet.Code = ResultCodeEnum.Error;
                transportResultSet.Message = "상품 상태값이 배송대기 스캔할 수 없는 상태입니다.";
                return transportResultSet;
            }

            //int CheckResult = new TransportCommonBiz().CheckCoreTranseportState(gepWarehouse.contr_no);

            //int TranseportCheck = new TransportCommonBiz().CheckCoreTranseportState(scanValue);

            //if (TranseportCheck == 1)
            //{
            //    transportResultSet.KeyValue = scanValue.ToString();
            //    transportResultSet.Code = ResultCodeEnum.Error;
            //    transportResultSet.Message = "반품된 상품 입니다.";
            //    return transportResultSet;
            //}

            //if (TranseportCheck == -11)
            //{
            //    transportResultSet.KeyValue = scanValue.ToString();
            //    transportResultSet.Code = ResultCodeEnum.Error;
            //    transportResultSet.Message = "G마켓 해외배송 상품입니다.";
            //    return transportResultSet;
            //}

            //if (TranseportCheck < 0)
            //{
            //    transportResultSet.KeyValue = scanValue.ToString();
            //    transportResultSet.Code = ResultCodeEnum.Error;
            //    transportResultSet.Message = "에러 입니다.";
            //    return transportResultSet;
            //}

            //배송상태 체크
            transportResultSet = new TransportCommonBiz().CheckCoreTranseportState(scanValue);

            if (ResultCodeEnum.Error == transportResultSet.Code)
                return transportResultSet;

            transportResultSet.Code = ResultCodeEnum.OK;
            transportResultSet.Message = "";

            return transportResultSet;
        }
Esempio n. 13
0
        public OrderDetailT MakeOrderDetailList(int packNo, string custNo)
        {
            List<OrderDetailInfoT> orderDetailList = new List<OrderDetailInfoT>();
            OrderDetailT orderDetail = new OrderDetailT();
            ContrDetailValueT contrDetailValue = new ContrDetailValueT();
            ContrBasicInfoT contrBasicInfo = new ContrBasicInfoT();
            List<GepOrderNoT> gepOrderNoList = new List<GepOrderNoT>();
            Dictionary<long, long> GepOrderNos = new Dictionary<long, long>();
            long gepOrderNo;

            decimal totalPayMoney = 0, totalOriginPayMoney = 0, totalItemPrice = 0, totalDeliveryFee = 0;
            int orderCnt = 0;
            DateTime finalDepositDt;
            string tmpContrDt = string.Empty;
            string orderNos = string.Empty;

            orderDetailList = GetGmarketOrderDetailInfo(packNo, custNo);

            for (int j = 0, orderNosCnt = orderDetailList.Count; j < orderNosCnt; j++)
            {
                if (j == 0)
                {
                    orderNos = orderDetailList[j].BuyOrderNo.ToString();
                }
                else
                {
                    orderNos = orderNos + "," + orderDetailList[j].BuyOrderNo.ToString();
                }
            }

            gepOrderNoList = GetGepOrderNo(orderNos);
            for (int k = 0, gepOrderNoListCnt = gepOrderNoList.Count; k < gepOrderNoListCnt; k++)
            {
                GepOrderNos.Add((int)gepOrderNoList[k].OrderNo, gepOrderNoList[k].GepOrderNo);
            }

            for (int i = 0, orderDetailListCnt = orderDetailList.Count; i < orderDetailListCnt; i++)
            {
                OrderDetailValueT detailValue = new OrderDetailValueT();
                GEPOrderInfoT gepOrderInfo = new GEPOrderInfoT();
                DomesticDeliveryStatusParamT domDelStatusParam = new DomesticDeliveryStatusParamT();
                DomesticDeliveryStatusT rtnDelStatus = new DomesticDeliveryStatusT();
                SellerInfoT sellerInfo = new SellerInfoT();
                GepOrderNoT resultGepOrderNo = new GepOrderNoT();

                TransportCommonBiz transBiz = new TransportCommonBiz();
                DeliveryTracking overseaDeliveryTracking = new DeliveryTracking();

                sellerInfo = GetSellerInfo(orderDetailList[i].ChgSellCustNo, "y");
                if (GepOrderNos.TryGetValue(orderDetailList[i].BuyOrderNo, out gepOrderNo))
                {
                    //몽고디비에서 GEP Order 정보 가져오는 부분
                    gepOrderInfo = GetGEPOrderInfo(gepOrderNo);
                }
                else
                {
                    gepOrderInfo = null;
                }

                //해외배송 정보 가져오는 부분
                overseaDeliveryTracking = transBiz.GetDeliveryTracking(orderDetailList[i].ContrNo);

                if (orderDetailList != null)
                {
                    detailValue.ListNo = i;
                    detailValue.ContrNo = orderDetailList[i].ContrNo;
                    detailValue.CloneItemNo = orderDetailList[i].ItemNo;
                    detailValue.CloneItemName = orderDetailList[i].ItemName;
                    detailValue.ContrAmt = orderDetailList[i].ContrAmt;
                    detailValue.ItemPrice = orderDetailList[i].ContrPrice;
                    detailValue.TotalPrice = orderDetailList[i].ContrPrice * orderDetailList[i].ContrAmt + orderDetailList[i].TotSelItemPrice;
                    detailValue.DeliveryFee = orderDetailList[i].DeliveryFee;
                    detailValue.CustKey = CustNoEncode(orderDetailList[i].ChgSellCustNo);
                    detailValue.SellerId = sellerInfo.Nickname;
                    detailValue.SellerPhone = sellerInfo.HelpdeskTelNo;
                    detailValue.SellerEmail = sellerInfo.EMail;

                    detailValue.SelOptInfo = MakeOrderSelOptInfo(orderDetailList[i].ItemNo, orderDetailList[i].OrderNo);

                    domDelStatusParam.StatInfo = orderDetailList[i].StatInfo;
                    domDelStatusParam.IsDeliveryGoodsYn = orderDetailList[i].IsDeliveryGoodsYn;
                    domDelStatusParam.TranscNm = orderDetailList[i].TakbaeName;
                    domDelStatusParam.InvoiceNo = orderDetailList[i].NoSongjang;
                    domDelStatusParam.GdShopkind = orderDetailList[i].GdShopkind;
                    domDelStatusParam.GdShopkind2 = orderDetailList[i].GdShopkind2;
                    domDelStatusParam.GdShopkind3 = orderDetailList[i].GdShopkind3;
                    domDelStatusParam.DelivLtpExtendDt = orderDetailList[i].DelivLtpExtendDt;
                    domDelStatusParam.DelivLtpStat = orderDetailList[i].DelivLtpStat;
                    domDelStatusParam.TransDate = orderDetailList[i].TransDt;
                    domDelStatusParam.SendPlanDt = orderDetailList[i].SendPlanDt.ToString();
                    domDelStatusParam.SendPlanRec = orderDetailList[i].SendPlanRec;
                    domDelStatusParam.ItemName = orderDetailList[i].ItemName;

                    rtnDelStatus = MakeDomesticDeliveryStatus(domDelStatusParam);
                    //detailValue.DomesticDeliveryStatus = rtnDelStatus.DeliveryStat;

                    if(orderDetailList[i].AcntStat != "SC" && orderDetailList[i].AcntStat != "SX" && orderDetailList[i].AcntStat != "SQ")
                    {
                        totalPayMoney = totalPayMoney + detailValue.TotalPrice + detailValue.DeliveryFee - orderDetailList[i].CostPrice;
                    }
                    totalOriginPayMoney = totalOriginPayMoney + detailValue.TotalPrice + detailValue.DeliveryFee - orderDetailList[i].CostPrice;
                    orderCnt = orderCnt + 1;
                    totalItemPrice = totalItemPrice + detailValue.ItemPrice;
                    totalDeliveryFee = totalDeliveryFee + detailValue.DeliveryFee;

                    if (gepOrderInfo != null)
                    {
                        detailValue.MotherItemNo = gepOrderInfo.Item.src_no;
                        detailValue.ExportSiteItemNo = gepOrderInfo.Item.ExportItemId;
                        detailValue.ExportSiteItemName = gepOrderInfo.Item.ExportItemName;
                        detailValue.ExportSiteName = gepOrderInfo.ExportSite.Name;
                        detailValue.OverseaDeliveryState = overseaDeliveryTracking.DeliveryState;
                        if (overseaDeliveryTracking.DeliveryWay == "PS")
                        {
                            detailValue.OverseaDeliveryWay = overseaDeliveryTracking.DeliveryWayKor;
                        }
                        else
                        {
                            detailValue.OverseaDeliveryWay = overseaDeliveryTracking.DeliveryWay;
                        }
                        detailValue.OverseaInvoiceNo = overseaDeliveryTracking.InvoiceNo;
                        detailValue.OverseaTrackingURL = overseaDeliveryTracking.TrackingURL;
                        if (gepOrderInfo.GEPOrder.OrderNo == "0")
                        {
                            detailValue.ExportSiteOrderNo = gepOrderInfo.GEPOrder.OrderNoSub;
                        }
                        else
                        {
                            detailValue.ExportSiteOrderNo = gepOrderInfo.GEPOrder.OrderNo;
                        }

                        detailValue.OverseaAddress = gepOrderInfo.ExportSiteTrans.receiver_addr;
                        detailValue.OverseaRcvNm = gepOrderInfo.ExportSiteTrans.receiver_name;
                        detailValue.OverseaPhone = gepOrderInfo.ExportSiteTrans.receiver_tel_no;
                        detailValue.OverseaEmail = gepOrderInfo.ExportSiteTrans.receiver_email;
                        detailValue.ViewItemURL = gepOrderInfo.Item.ExportSiteViewItemUrl;
                    }
                    orderDetail.DomesticDeliveryStatusList.Add(rtnDelStatus);
                    orderDetail.OrderDetailValueList.Add(detailValue);
                }
                else
                {
                    //아무 디비도 안 나옴
                }
            }
            //결제 정보
            contrDetailValue.ItemCnt = orderCnt;
            contrDetailValue.TotItemPrice = totalItemPrice;
            contrDetailValue.TotDeliveryFee = totalDeliveryFee;
            contrDetailValue.PackTotPayMoney = totalPayMoney;
            contrDetailValue.PackOriginTotPayMoney = totalOriginPayMoney;
            contrDetailValue.PackCancelTotPayMoney = totalOriginPayMoney - totalPayMoney;

            contrBasicInfo.AcntWay = orderDetailList[0].AcntWay;
            contrBasicInfo.CashpayWay = orderDetailList[0].CashpayWay;
            contrBasicInfo.StatInfo = orderDetailList[0].StatInfo;
            tmpContrDt = orderDetailList[0].ContrDt.Substring(0, 4) + "-" + orderDetailList[0].ContrDt.Substring(4, 2) + "-" + orderDetailList[0].ContrDt.Substring(6, 2);
            finalDepositDt = DateTime.Parse(tmpContrDt);
            contrBasicInfo.FinalDeposit = finalDepositDt.AddDays(7).ToString("yyyy-MM-dd");
            contrBasicInfo.PackNo = orderDetailList[0].PackNo;

            if (orderDetailList[0].AcntWay == "A2" || orderDetailList[0].AcntWay == "A7")
            {
                int sttlNoLenth = 0;
                int halbuMonth = orderDetailList[0].Halbumonth;
                contrBasicInfo.SttlName = orderDetailList[0].SttlkindNm;
                if (orderDetailList[0].CardNo != string.Empty)
                {
                    sttlNoLenth = orderDetailList[0].CardNo.Length;
                    contrBasicInfo.SttlNo = orderDetailList[0].CardNo.Substring(0, 8) + "****************";
                    contrBasicInfo.SttlNo = contrBasicInfo.SttlNo.Substring(0, sttlNoLenth);
                    contrBasicInfo.CardAcptDt = orderDetailList[0].AcptDt;
                }

                if (halbuMonth >= 60)
                {
                    halbuMonth = halbuMonth - 60;
                }
                else if (halbuMonth >= 40 && halbuMonth < 60 && halbuMonth != 41)
                {
                    halbuMonth = halbuMonth - 40;
                }

                if (halbuMonth == 0 || halbuMonth == 41)
                {
                    contrBasicInfo.SttlWay = "일시불";
                }
                else
                {
                    if (orderDetailList[0].HalbuType == "C" || orderDetailList[0].HalbuType == "F")
                    {
                        contrBasicInfo.SttlWay = halbuMonth + " 개월 무이자 할부";
                    }
                    else
                    {
                        contrBasicInfo.SttlWay = halbuMonth + " 개월 할부";
                    }
                }
            }
            else
            {
                contrBasicInfo.SttlName = orderDetailList[0].BankNm;
                contrBasicInfo.SttlNo = ShowVAccount(orderDetailList[0].BankAcntNo, orderDetailList[0].GbankNo);
                contrBasicInfo.DepositName = orderDetailList[0].DepositNm;
                contrBasicInfo.SttlWay = "현금";
            }

            contrDetailValue = MakeContrInfo(contrBasicInfo, contrDetailValue);

            orderDetail.ContrValue = contrDetailValue;

            return orderDetail;
        }