Ejemplo n.º 1
0
        /// <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;
        }
Ejemplo n.º 2
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;
        }
        private GEPContractDetail GetGEPContractDetail(GepWarehouse t)
        {
            var TransWays = (from k in t.trans_way_hist
                      orderby k.reg_dt descending
                      select k).ToList();

            return new GEPContractDetail()
            {
                ArrivedDate = (null == t.arrived_dt ? "" : t.arrived_dt.Value.ToString("yyyy-MM-dd HH:mm:ss"))
                ,
                //ContractDate = t.transinfo.gep_order_dt.ToString("yyyy-MM-dd HH:mm:ss")
                ContractDate = t.transinfo.clone_contr_dt.ToString("yyyy-MM-dd HH:mm:ss")
                ,
                ContractID = t.sitetransinfo.sender_name
                ,
                DeliveryAddress = t.sitetransinfo.receiver_addr
                ,
                DeliveryNation = t.sitetransinfo.receiver_country_name
                ,
                EMSChagneDate = TransWays.Count > 1 ? TransWays[0].reg_dt.ToString("yyyy-MM-dd HH:mm:ss") : ""
                ,
                ExpectedWeight = t.trns_cost.org_weight.ToString()
                ,
                ExpectedWeightCost = t.trns_cost.org_transport_cost.ToString()
                ,
                ForeingConutryInvoiceNum = t.transinfo.oversea_invoice_no
                ,
                ForeingConutryTransc = TransWays[0].transport_way
                ,
                InvoiceNum = t.transinfo.local_invoice_no
                ,
                LocalTransc = t.transinfo.local_express_nm
                ,
                ObjectID = t._id.ToString()
                ,
                OrderNum = t.contr_no.ToString()
                ,
                ProductAmt = t.transinfo.gep_order_count.ToString()
                ,
                ProductName = t.transinfo.clone_item_name
                ,
                ProductNum = t.transinfo.clone_item_no
                ,
                ProductOption = t.transinfo.clone_option_info
                ,
                RealWeight = t.trns_cost.real_weight.ToString()
                ,
                RealWeightCost = t.trns_cost.real_transport_cost.ToString()
                ,
                ReceiverContact = t.sitetransinfo.receiver_tel_no
                ,
                ReceiverName = t.sitetransinfo.receiver_name
                ,
                SellerID = t.transinfo.clone_buyer_id
                ,
                SellerName = t.transinfo.clone_buyer_name
                ,
                //State = t.GetState
                State = GEP.Framework.data.EnumDHelper.GetDescription(t.transinfo.state)
                ,
                UserID = t.excel_output_id
            };
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 배송상태 변경
        /// </summary>
        /// <param name="scanValue"></param>
        /// <param name="state"></param>
        /// <param name="userID"></param>
        /// <returns></returns>
        public bool SetTransportState(ref GepWarehouse gepData, WarehouseStateEnum state, string userID)
        {
            if (gepData == null)
            {
                return false;
            }

            if (state == WarehouseStateEnum.Arrival)
            {
                gepData.state = state;
                gepData.arrived_dt = DateTime.Now;
                gepData.arrived_id = userID;
                gepData.transinfo.state = GepShippingStateEnum.InWarehouse;
            }
            else if (state == WarehouseStateEnum.PackingBox)
            {
                gepData.state = state;
                gepData.check_weight_dt = DateTime.Now;
                gepData.check_weight_id = userID;
                gepData.transinfo.state = GepShippingStateEnum.ShippingStandBy;
            }
            else if (state == WarehouseStateEnum.Submitting)
            {
                gepData.state = state;
                gepData.excel_ouput_dt = DateTime.Now;
                gepData.excel_output_id = userID;
            }
            else if (state == WarehouseStateEnum.InputInvoice)
            {
                gepData.state = state;
                gepData.invoice_input_dt = DateTime.Now;
                gepData.invoice_input_id = userID;
                gepData.transinfo.state = GepShippingStateEnum.Tracking;
            }
            else
            {
                return false;
            }

            return true;
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 도큐먼트를 저장한다.
 /// </summary>
 /// <param name="data">도큐먼트 데이타</param>
 internal void Save(GepWarehouse data)
 {
     new GEPMongoDacHelper(GepMongoEnv.Database.GEP, _CollectionName).Save<GepWarehouse>(data);
 }