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; }
public DomesticDeliveryStatusT MakeDomesticDeliveryStatus(DomesticDeliveryStatusParamT reqDomDelStatus) { TransCompanyInfoT transCompanyInfo = new TransCompanyInfoT(); DomesticDeliveryStatusT rtnDomDelStatus = new DomesticDeliveryStatusT(); rtnDomDelStatus.DeliveryStat = reqDomDelStatus.StatInfo; if (reqDomDelStatus.StatInfo == "배송중" || reqDomDelStatus.StatInfo == "배송완료") { rtnDomDelStatus.DeliveryStat = reqDomDelStatus.StatInfo; transCompanyInfo = MakeTransCompanyInfo(reqDomDelStatus.TranscNm, reqDomDelStatus.InvoiceNo); if(reqDomDelStatus.IsDeliveryGoodsYn == "Y") { if (reqDomDelStatus.TranscNm.IndexOf("대한") > 0) { rtnDomDelStatus.TranscTel = "1577-1275"; } } if (transCompanyInfo.TranscHomepage != "-") { rtnDomDelStatus.TranscHomepage = transCompanyInfo.TranscHomepage; } rtnDomDelStatus.DeliveryStat = statFunc(reqDomDelStatus.StatInfo, reqDomDelStatus.GdShopkind, reqDomDelStatus.GdShopkind2, reqDomDelStatus.GdShopkind3); rtnDomDelStatus.TranscName = reqDomDelStatus.TranscNm; rtnDomDelStatus.TranscTel = transCompanyInfo.TranscTel; rtnDomDelStatus.InvoiceNo = reqDomDelStatus.InvoiceNo; rtnDomDelStatus.TranscName = reqDomDelStatus.TranscNm; rtnDomDelStatus.TransDate = reqDomDelStatus.TransDate; rtnDomDelStatus.IsDeliveryGoodsYn = reqDomDelStatus.IsDeliveryGoodsYn; rtnDomDelStatus.ItemName = reqDomDelStatus.ItemName; rtnDomDelStatus.Type = "A"; } else { if (reqDomDelStatus.StatInfo == "배송요청") { if (reqDomDelStatus.DelivLtpExtendDt != string.Empty && reqDomDelStatus.DelivLtpStat == "S6") { rtnDomDelStatus.DeliveryStat = "배송요청"; string tmpDeliveryLtpExtDt; DateTime deliveryLtpExtendDate; tmpDeliveryLtpExtDt = reqDomDelStatus.DelivLtpExtendDt.Substring(0, 4) + "-" + reqDomDelStatus.DelivLtpExtendDt.Substring(4, 2) + "-" + reqDomDelStatus.DelivLtpExtendDt.Substring(6, 2); deliveryLtpExtendDate = DateTime.Parse(tmpDeliveryLtpExtDt); deliveryLtpExtendDate = CheckBusinessDay(deliveryLtpExtendDate, 30, 112); rtnDomDelStatus.DelLimitExtendDt = deliveryLtpExtendDate.ToString("yyyy-mm-dd"); rtnDomDelStatus.Type = "B"; } else if (DateTime.Parse(reqDomDelStatus.SendPlanDt) < DateTime.Today.Date && reqDomDelStatus.SendPlanDt != "1/1/0001 12:00:00 AM") { rtnDomDelStatus.DeliveryStat = "발송지연"; rtnDomDelStatus.Type = "C"; } else if (reqDomDelStatus.SendPlanDt != string.Empty && reqDomDelStatus.SendPlanDt != null && reqDomDelStatus.SendPlanDt != "1/1/0001 12:00:00 AM") { rtnDomDelStatus.DeliveryStat = "발송예정"; rtnDomDelStatus.SendPlanDt = reqDomDelStatus.SendPlanDt; rtnDomDelStatus.Type = "D"; if (reqDomDelStatus.SendPlanRec != null || reqDomDelStatus.SendPlanRec != string.Empty) { rtnDomDelStatus.SendPlanRec = reqDomDelStatus.SendPlanRec; rtnDomDelStatus.Type = "E"; } } else { rtnDomDelStatus.DeliveryStat = statFunc(reqDomDelStatus.StatInfo, reqDomDelStatus.GdShopkind, reqDomDelStatus.GdShopkind2, reqDomDelStatus.GdShopkind3); rtnDomDelStatus.Type = "C"; } } else { if (reqDomDelStatus.StatInfo == "신고처리중") { rtnDomDelStatus.DeliveryStat = reqDomDelStatus.StatInfo; rtnDomDelStatus.Type = "C"; } else { rtnDomDelStatus.DeliveryStat = statFunc(reqDomDelStatus.StatInfo, reqDomDelStatus.GdShopkind, reqDomDelStatus.GdShopkind2, reqDomDelStatus.GdShopkind3); rtnDomDelStatus.Type = "C"; } } } return rtnDomDelStatus; }