public without sharing class LogisticsDisplayController {
    @AuraEnabled
    public static RequestData getFrameNumManage(String DNId){ 
        System.debug('DNId'+DNId); 
        // 根据DN去请求接口获取数据并保存 测试
        // NFM118Controller.callout('', '65295120');
        // 根据 DN 获取数据
        // 处理 dnID
        DNId = DNId.substring(2);
        try {
            OTS_order__c order = [select id,name,waybill__c from OTS_order__c where so_dn__c = :DNId];
            waybill__c waybill = [select id,name,hasNewStatus__c,request_time__c,receive_time__c,delay_reason__c,shipping_time__c,waybill_status__c from waybill__c where id = :order.waybill__c];
            if (waybill.hasNewStatus__c == true) {
                waybill.hasNewStatus__c = false;
                update waybill;
            }    
            System.debug('打印数据：'+order);
            List<transinfo__c> transinfoLists =[select id,name,op_place__c,cmemo__c,op_time__c,op_way__c,op_man__c,waybill__c  from transinfo__c where waybill__c =:order.waybill__c ORDER BY op_time__c DESC,op_way__c DESC];

            List<Transinfo> TransinfoList = new List<Transinfo>();
            if (transinfoLists.size()>0) {
                for (transinfo__c t : transinfoLists) {
                    Transinfo tr =  new Transinfo();
                    tr.cmemo = t.cmemo__c;
                    tr.op_man = t.op_man__c;
                    tr.op_place = t.op_place__c;
                    tr.op_time = t.op_time__c.format('yyyy-MM-dd HH:mm:ss');
                    tr.op_way = t.op_way__c;
                    TransinfoList.add(tr);
                }
            }
            Waybill w = new Waybill();
            if (waybill.request_time__c != null ) {
                w.request_time = waybill.request_time__c.format('yyyy-MM-dd HH:mm:ss');
            }
            w.delay_reason = waybill.delay_reason__c;
            if (waybill.shipping_time__c != null ) {
                w.shipping_time = waybill.shipping_time__c.format('yyyy-MM-dd HH:mm:ss');
            }
            w.waybill_status = waybill.waybill_status__c;
            if (waybill.receive_time__c != null ) {
                w.receive_time = waybill.receive_time__c.format('yyyy-MM-dd HH:mm:ss');
            }
            RequestData res = new RequestData();
            res.t = TransinfoList;
            res.w = w;
            System.debug('打印结果：'+TransinfoList);
            return res;
        } catch (Exception e) {
            System.debug('错误信息：'+e.getMessage());
            return null;
        }
       
    }
    public class Transinfo{
        @AuraEnabled
        public String op_time;
        @AuraEnabled
        public String op_place;
        @AuraEnabled
        public String op_way;
        @AuraEnabled
        public String cmemo;
        @AuraEnabled
        public String op_man;
    }
    public class Waybill{
        @AuraEnabled
        public String request_time;
        @AuraEnabled
        public String delay_reason;
        @AuraEnabled
        public String shipping_time;
        @AuraEnabled
        public String waybill_status;
        @AuraEnabled
        public String receive_time;
    }
    public class RequestData{
        @AuraEnabled
        public List<Transinfo> t;
         @AuraEnabled
         public Waybill w;
    }
}