public without sharing class ConsumptionListController { /*****************検索用******************/ //public Consumable_order__c coc { get; set; } /*****************画面初始化用********************************/ /******20160313_add**************/ //public String IdCheck{get;set;} //暂用20160323 /*****************画面表示Bean******************/ /*public List 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 consumableorderdetailsSelected = new List(); private List product2Selected = new List(); // 产品 ID private String ESetId = '';*/ public ConsumptionListController() { //Apexpages.currentPage().getHeaders().put('X-UA-Compatible', 'IE=8'); //baseUrl = URL.getSalesforceBaseUrl().toExternalForm(); //ESetId = ApexPages.currentPage().getParameters().get('esetId'); //consumableorderdetailsRecords = new List(); } // 画面初始化 /*public void init() { IdCheck = EsetId; consumableorderdetailsRecords = new List(); if(ESetId== NULL || ESetId==''){ }else{ List qs = New List(); qs = [select Id,ShipmentAccount__c,Order_Indication__c, Name,Consumable_pdf_insert_day__c,Inventory_date__c,Consume_date__c,Order_ForDealerText__c,Arrive_Order__c 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, Consumable_Product__r.Name__c, Sterilization_limit__c, Consumable_Count__c, Deliver_date__c,Intra_Trade_List_RMB__c, Asset_Model_No__c, Sum_of_money__c, ProductPacking_list_manual__c, Box_Piece__c, Guarantee_period_for_products__c, Order_details_Piece__c from Consumable_order_details__c where Consumable_Sale_order__c = :ESetId order by Name ]; //输出 for (Integer i = 0; i < consumableorderdetailsSelected.size(); i++) { consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(consumableorderdetailsSelected[i])); } } // 排序 this.sortKey = '1'; this.preSortKey = '1'; this.sortOrderAsc = false; this.sortOrder = new String[1]; this.sortOrder = new String[]{'', '↓'}; } //上传纳品书 public PageReference FilesUpload(){ PageReference ref = new Pagereference('/p/attach/NoteAttach?pid='+ESetid+'&retURL=%2F' + '/ConsumptionList?ESetid=' +ESetid); ref.setRedirect(true); return ref; } //限制性排序 /* public void SortLimited(){ List reSet = new List(); 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_Sale_order__c = \''+ESetId+'\''; soql += ' order by ' + this.columus[Integer.valueOf(this.sortKey)] + ' ' + (this.sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last'); List queryList = Database.query(soql); // 選択済みの明细を取得 Map selectedIdMap = new Map(); for (Integer i = 0; i < queryList.size(); i++) { // 未选择的消耗品明细 reSet.add(new ConsumableorderdetailsInfo(queryList[i])); } consumableorderdetailsRecords = reSet; // 显示数据条数信息 } } */ // 撤销错误数据 /*public PageReference ConsumableorderDel() { if(coc.Consume_date__c <> date.today()){ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '只允许撤销当天的销售记录')); return null; } List qs = New List(); List Dqs= New List(); Consumable_order__c Consumable_order= New Consumable_order__c(); List orderDetails= New List(); qs = [select Id From Consumable_order__c Where Id =:ESetId]; System.debug('+++++Order_Indication__c' + coc.Order_Indication__c); List ConsumableorderdetailsRecordsdummy = new List(); if (qs.size()>0){ try { if(coc.Order_Indication__c ==null || coc.Order_Indication__c ==''){ orderDetails = [select Id, Name, Consumable_order__c, Consumable_Product__c,Consumable_Product__r.Name, Consumable_Product__r.Name__c, 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_principal__c =:coc.Arrive_Order__c]; for (Integer i = 0; i < consumableorderdetailsSelected.size(); i++) { ConsumableorderdetailsRecordsdummy.add(new ConsumableorderdetailsInfo(orderDetails[i])); } for (ConsumableorderdetailsInfo ass : ConsumableorderdetailsRecordsdummy) { Consumable_order_details__c Updet = new Consumable_order_details__c(); Updet.Id = ass.esd.Id; Updet.Consumable_Sale_order__c = null; Dqs.add(Updet); } delete qs; update Dqs; }else{ Consumable_order.Id = coc.Order_Indication__c; Consumable_order.SummonsStatus_c__c = '出库单已打印'; update Consumable_order; delete qs; } } catch (Exception e) { ApexPages.addMessages(e); return null; } } if(coc.Order_Indication__c =='' || coc.Order_Indication__c == null){ PageReference ref = new Pagereference('/SaleAndDelivery'); ref.setRedirect(true); return ref; }else{ PageReference ref = new Pagereference('/summonsCreat?ESetid=' + coc.Order_Indication__c); ref.setRedirect(true); return ref; } } // 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 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; } }*/ }