FLH 2 days ago
parent
commit
a27efec913

+ 1 - 1
3.Service/XYY.Service.Standard.ChannelApi/JD/Api.cs

@@ -204,7 +204,7 @@ namespace XYY.Service.Standard.ChannelApi.JD
             int printQty = _order_OrderPrintQtyRepository.GetPackagePrintQty(order.SystemNo);
             string orderNumber = order.TransferNumber.Replace("XYY", config.companyCode) + "-" + printQty;//不要出现XYY字眼
             var wayBillDto = CreateWayBillDto(config.customerCode, sellerId, storeId, order, goods, channel, orderNumber, config);
-            RequestInfo requestInfo = CreateRequestInfo();
+            RequestInfo requestInfo = CreateRequestInfo(config);
 
             //string wayBillJson = Newtonsoft.Json.JsonConvert.SerializeObject(wayBillDto);
             //string requestInfoJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestInfo);

+ 5 - 5
3.Service/XYY.Service.Standard.ChannelApi/JD/Api_CreateParams.cs

@@ -139,14 +139,14 @@ namespace XYY.Service.Standard.ChannelApi.JD
             return waybillWares;
         }
 
-        private RequestInfo CreateRequestInfo()
+        private RequestInfo CreateRequestInfo(JDConfig config)
         {
             RequestInfo requestInfo = new RequestInfo
             {
-                customerCode = customerCode,
-                gatewayUser = pin,
-                @operator = @operator,
-                sourceSystem = sourceSystem,
+                customerCode = config.customerCode,
+                gatewayUser = config.pin,
+                @operator = config.@operator,
+                sourceSystem = config.sourceSystem,
                 systemType = 10
             };
             return requestInfo;

+ 68 - 2
3.Service/XYY.Service.Standard.ChannelApi/UBI/Api.cs

@@ -566,13 +566,79 @@ namespace XYY.Service.Standard.ChannelApi.UBI
             return errors;
         }
 
+        //如果好用,请收藏地址,帮忙分享。
+        public class GetTrackingResultItem
+        {
+            /// <summary>
+            /// 
+            /// </summary>
+            public string status { get; set; }
+            /// <summary>
+            /// 
+            /// </summary>
+            public string errors { get; set; }
+            /// <summary>
+            /// 
+            /// </summary>
+            public string warnings { get; set; }
+            /// <summary>
+            /// 
+            /// </summary>
+            public string orderId { get; set; }
+            /// <summary>
+            /// 
+            /// </summary>
+            public int relabelStatus { get; set; }
+            /// <summary>
+            /// 
+            /// </summary>
+            public string trackingNo { get; set; }
+            /// <summary>
+            /// 
+            /// </summary>
+            public string lastMileCarrier { get; set; }
+        }
+
+        public class GetTrackingResult
+        {
+            /// <summary>
+            /// 
+            /// </summary>
+            public string status { get; set; }
+            /// <summary>
+            /// 
+            /// </summary>
+            public string errors { get; set; }
+            /// <summary>
+            /// 
+            /// </summary>
+            public List<DataItem> data { get; set; }
+            /// <summary>
+            /// 
+            /// </summary>
+            public string warnings { get; set; }
+        }
+
         public async Task CannelOrders(List<string> systemNO)
         {
             throw new NotImplementedException();
         }
-        public Task<string> GetTrackingNumber(string SystemNo, string TrackingNumber, string ServiceOrderNo, Logistics_Channel channel)
+        public async Task<string> GetTrackingNumber(string SystemNo, string TrackingNumber, string ServiceOrderNo, Logistics_Channel channel)
         {
-            string str = Send(channel,null, "Post", "/services/shippping/queryorders/{JDQ002445701000931502}")
+            string str = await Send(channel, new string[] { TrackingNumber }, "Post", "/services/shippping/trackingNumbers");
+            GetTrackingResult trackingResult = Newtonsoft.Json.JsonConvert.DeserializeObject<GetTrackingResult>(str);
+            if (trackingResult.status == "Success")
+            {
+                if (trackingResult != null && trackingResult.data != null && trackingResult.data.Count > 0)
+                {
+                    if (trackingResult.data[0].status == "Success")
+                    {
+                        return trackingResult.data[0].trackingNo;
+                    }
+                }
+            }
+            return "";
+
         }
         public async Task CannelOrdersByModel(logistics_ChannelCancel logistics_ChannelCancel)
         {

+ 4 - 4
3.Service/XYY.Service.Standard.Order/OrderService.cs

@@ -1142,7 +1142,7 @@ where a.OrderStatus<3 and a.SystemNo in @SystemNo";//小于三属于未装箱数
             DateTime updateLast = DateTime.Now.AddHours(-2);
             DateTime receiveLast = DateTime.Now.AddHours(-4);
             DateTime receiveFirst = DateTime.Now.AddDays(-24);
-            string sql = @$"select top 100  IsOnline,CustomerId,SourceType,CustomerOrderNo,ERPApiId,Id,ServicesOrderNo,SystemNo,case  when ChannelId in (702,703) then ServiceOrderNumber3 else TrackingNumber end TrackingNumber,ChannelId,datediff(HOUR,ReceiveTime,getdate()) from Order_Order(nolock) 
+            string sql = @$"select top 100  IsOnline,CustomerId,SourceType,CustomerOrderNo,ERPApiId,Id,ServicesOrderNo,SystemNo,case  when ChannelId in (702,703) then ServiceOrderNumber3  when channelId in (977) then ServiceOrderNumber2 else TrackingNumber end TrackingNumber,ChannelId,datediff(HOUR,ReceiveTime,getdate()) from Order_Order(nolock) 
                                 where  orderStatus<4 and OrderStatus>=2 
 									and ReceiveTime>'{receiveFirst.ToString_yyyyMMddHHmmss()}'
 									and ReceiveTime<'{receiveLast.ToString_yyyyMMddHHmmss()}'
@@ -1152,11 +1152,11 @@ where a.OrderStatus<3 and a.SystemNo in @SystemNo";//小于三属于未装箱数
             //string sql = @$"select top {qty} SourceType,CustomerOrderNo,ERPApiId,Id,ServicesOrderNo,SystemNo,TrackingNumber,ChannelId,datediff(HOUR,ReceiveTime,getdate()) from Order_Order(nolock) 
             //                    where WaitSysncServiceTrackingNumber=1 and orderStatus<>4 and OrderStatus>=2 and datediff(HOUR,UpdateTime,getdate())>2  and ReceiveTime>'2022-05-05' and datediff(HOUR,ReceiveTime,getdate())>4  and datediff(day,ReceiveTime,getdate())<24";
             //sql = @"select SourceType,CustomerOrderNo,ERPApiId,Id,ServicesOrderNo,SystemNo,case  when ChannelId in (702,703) then ServiceOrderNumber3 else TrackingNumber end TrackingNumber,ChannelId,datediff(HOUR,ReceiveTime,getdate()) from order_order where SystemNo = 'XYYEX0032515406YQ'";
-            string testSql = @$"select top 100  IsOnline,CustomerId,SourceType,CustomerOrderNo,ERPApiId,Id,ServicesOrderNo,SystemNo,case  when ChannelId in (702,703) then ServiceOrderNumber3 else TrackingNumber end TrackingNumber,ChannelId,datediff(HOUR,ReceiveTime,getdate()) from Order_Order(nolock) 
-                                where  SystemNo='XYYEX0033401618YQ'
+            string testSql = @$"select top 100  IsOnline,CustomerId,SourceType,CustomerOrderNo,ERPApiId,Id,ServicesOrderNo,SystemNo,case  when ChannelId in (702,703) then ServiceOrderNumber3  when channelId in (977) then ServiceOrderNumber2  else TrackingNumber end TrackingNumber,ChannelId,datediff(HOUR,ReceiveTime,getdate()) from Order_Order(nolock) 
+                                where  SystemNo='XYYEX0034582669YQ'
                                 ";
 
-            var data = await _orderRepository.QueryBySqlAsync(sql);
+            var data = await _orderRepository.QueryBySqlAsync(testSql);
             List<Task> tasks = new List<Task>();
             foreach (var item in data.GroupBy(x => x.ChannelId))
             {