public without sharing class ShipmentController {

    /*****************検索用******************/
    //public Consumable_order__c coc { get; set; }
    /*****************画面表示Bean******************/
    /*public List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecords { get; set; }
    public String baseUrl {get;private set;}
    //排序用
    public String sortKey { get; set; }
    public String preSortKey { get; private set; }
    public Boolean sortOrderAsc { get; private set; }
    public String[] sortOrder { get; private set; }
    private String[] columus = new String[]{ 'Name'};
    // 已选择备品set明细
    private List<Consumable_order_details__c> ConsumableorderdetailsSelected = new List<Consumable_order_details__c>();

    // 产品 ID
    private String ESetId = '';
    */
    public ShipmentController() {
        //Apexpages.currentPage().getHeaders().put('X-UA-Compatible', 'IE=8');
        //baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
        //ESetId = ApexPages.currentPage().getParameters().get('esetId');
        //ConsumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
    }
    /*
    // 画面初始化
    public void init() {
        String userId = UserInfo.getUserId();
        List<user> Useracc = New List<user>();
        Useracc = [select accountid from user where id =:userId];
        String accountid = Useracc[0].accountid;

        coc = new Consumable_order__c();
        list<Dealer_elationship__c> Dealerelationship = new list<Dealer_elationship__c>();
        Dealerelationship = [select Dealer_subordinate__c,Dealer_subordinate__r.Name 
                                from Dealer_elationship__c
                                where Dealer_principal__c =:accountid ];

        ConsumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
        List<Consumable_order_details__c> CountSet = new List<Consumable_order_details__c>();       
        if(ESetId== NULL || ESetId==''){

        }else{

            List<Consumable_order__c> qs = New List<Consumable_order__c>();
            qs = [select id,name,Order_reason__c,
                        Arrive_Order__c,
                        recordtypeid,
                        Order_status__c,
                        Deliver_date__c,
                        Order_ForHospital__c,
                        Order_ForDealer__r.Name
                    from Consumable_order__c
                    where id =:ESetId];
         if (qs.size()>0){
                coc = qs[0];
            }
            // 選択済みの明细を取得
            ConsumableorderdetailsSelected = [select Id,
                                                    Name,
                                                    Consumable_order__c,
                                                    Consumable_Product__c,
                                                    Consumable_Product__r.Name,
                                                    Sterilization_limit__c,
                                                    Consumable_Count__c,
                                                    Deliver_date__c,
                                                    Intra_Trade_List_RMB__c,
                                                    Asset_Model_No__c,
                                                    Sum_of_money__c
                                                from Consumable_order_details__c
                                                where  Consumable_Shipment_order__c = :ESetId
                                                order by Name ];
            //输出allnumber
            
            for (Integer i = 0; i < ConsumableorderdetailsSelected.size(); i++) {
                ConsumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(ConsumableorderdetailsSelected[i]));
            }
        }
        // 显示数据条数信息
        //makeMessage();
        this.sortKey = '1';
        this.preSortKey = '1';
        this.sortOrderAsc = false;
        this.sortOrder = new String[1];
        this.sortOrder = new String[]{'', '↓'};
    }
    //限制性排序
/*    public void SortLimited(){
        List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>();
        if (this.sortKey == this.preSortKey) {
            // 方向が変わるのみ
            this.sortOrderAsc = !this.sortOrderAsc;
            this.sortOrder[Integer.valueOf(this.sortKey)] = (this.sortOrderAsc == true ? '↑' : '↓');
        } else {
            this.sortOrderAsc = true;
            this.sortOrder[Integer.valueOf(this.preSortKey)] = '';
            this.sortOrder[Integer.valueOf(this.sortKey)] = (this.sortOrderAsc == true ? '↑' : '↓');
        }
        this.preSortKey = this.sortKey;
        if(EsetId==null||ESetId==''){
        }else{
        // 出库产品取得
        String soql = 'select Id,  Name, Consumable_order__c, Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,Consumable_Count__c,Deliver_date__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,Sum_of_money__c from Consumable_order_details__c where   Consumable_Shipment_order__c = \''+ESetId+'\'';
        soql += ' order by ' + this.columus[Integer.valueOf(this.sortKey)] + ' ' + (this.sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last');
        List<Consumable_order_details__c> queryList = Database.query(soql);
        // 選択済みの明细を取得
        Map<String, String> selectedIdMap = new Map<String, String>();
        for (Integer i = 0; i < queryList.size(); i++) {
            reSet.add(new ConsumableorderdetailsInfo(queryList[i]));
        } 
            ConsumableorderdetailsRecords = reSet;
            // 显示数据条数信息
        }
    }
    */
    // Data Bean
    /*class ConsumableorderdetailsInfo implements Comparable {
        public Boolean check { get; set; }
        public Boolean oldCheck { get; set; }
        public Consumable_order_details__c esd { get; set; }
        public Product2__c Prod { get; set; }
        public Decimal allmoney { get; set; }
        public Decimal allnumber { get; set; }
        public Decimal oldConsumableCount { get; set; }
        public Boolean canSelect { get; set; }
        
        // 已存在备品set明细用
        public ConsumableorderdetailsInfo(Consumable_order_details__c e) {
            check = true;
            oldCheck = true;
            esd = e;
            Prod = e.Consumable_Product__r;
            oldConsumableCount = e.Consumable_Count__c;
            canSelect = true; 
        }
        // 排序
        public Integer compareTo(Object compareTo) { 
            return null; 
        }  
    }*/
}