| | |
| | | public Boolean errormessageFlg = false; |
| | | private List <Sample_order_list_detail__c> orderListDelList; |
| | | public String QueryTemp { get; set;} |
| | | public String provinceName{get; set;} |
| | | public String cityName{get; set;} |
| | | // add fxk |
| | | // public OrdergoodsController() { |
| | | // public OrdergoodsController() {cityops |
| | | // accId = ApexPages.currentPage().getParameters().get('accId'); |
| | | // orderListId = ApexPages.currentPage().getParameters().get('Id'); |
| | | // } |
| | |
| | | accId = ApexPages.currentPage().getParameters().get('accId'); |
| | | orderListId = ApexPages.currentPage().getParameters().get('Id'); |
| | | } |
| | | |
| | | //省 |
| | | public List<SelectOption> getprovinceop(){ |
| | | List<SelectOption> provincesops = new List<SelectOption>(); |
| | | List<Address_Level__c> provinces=[select name,id from Address_Level__c]; |
| | | provincesops.add(new SelectOption('','----')); |
| | | for(Address_Level__c province:provinces){ |
| | | provincesops.add(new SelectOption(province.Name,province.Name)); |
| | | } |
| | | return provincesops; |
| | | } |
| | | |
| | | //市 |
| | | public List<SelectOption> getCityop(){ |
| | | List<Address_Level__c> provinces=[select name,id from Address_Level__c where name=: provinceName]; |
| | | List<SelectOption> cityops = new List<SelectOption>(); |
| | | cityops.add(new SelectOption('','----')); |
| | | if(provinces.size()>0){ |
| | | id TheId=provinces[0].id; |
| | | List<Address_Level2__c> citys=[select name,id from Address_Level2__c where Address_Level__c=:TheId]; |
| | | for(Address_Level2__c city:citys){ |
| | | cityops.add(new SelectOption(city.Name,city.Name)); |
| | | } |
| | | } |
| | | return cityops; |
| | | } |
| | | |
| | | // add fxk 初始化显示 |
| | | public void init() { |
| | | errormessageFlg = false; |
| | | //displayFlg = true; |
| | | sampleOrder = new Sample_order_list__c(); |
| | | productInfoList = new List < ProductInfo > (); |
| | | AccName = new Account(); |
| | | // 页面获取客户名称 |
| | | if (String.isNotBlank(accId)) { |
| | | AccName = [select Id, Name, Address__c, Phone from Account where id = : accId]; |
| | |
| | | //编辑页面 |
| | | if (String.isNotBlank(orderListId)) { |
| | | List<Sample_order_list__c> orderLists = [select Id, DeliveryAddress__c, Status__c, ReceivePart__c, DeliveryPhone__c, |
| | | DeliveryContact__c, AgentCode__c, Send_Date__c, Account__c, Account__r.Name |
| | | DeliveryContact__c, AgentCode__c, Send_Date__c, Account__c, Account__r.Name, province__c, city__c |
| | | from Sample_order_list__c where Id = : orderListId]; |
| | | if (orderLists.size() > 0) { |
| | | // 页面显示订货单信息 |
| | | sampleOrder = orderLists.get(0); |
| | | provinceName = sampleOrder.province__c; |
| | | cityName = sampleOrder.city__c; |
| | | AccName = [select Id, Name, Address__c, Phone from Account where id = : sampleOrder.Account__c]; |
| | | orderListDelList = [select Id, Name, Pro_Name__c, Term_Date__c, Pro_model__c, Product__c, Standards__c, ItemQuantity__c, Sample_Classification__c, |
| | | Total__c, TermDate__c, Product__r.Asset_Model_No__c, Product__r.Name, Product__r.SFDA_Expiration_Date__c, Product__r.Sample_Classification__c, |
| | |
| | | errormessageFlg = true; |
| | | return null; |
| | | } |
| | | sampleOrder.province__c=provinceName; |
| | | if(!String.isNotBlank(provinceName)){ |
| | | sampleOrder.province__c.addError('省不能为空!'); |
| | | errormessageFlg = true; |
| | | return null; |
| | | } |
| | | sampleOrder.city__c=cityName; |
| | | if(!String.isNotBlank(cityName)){ |
| | | sampleOrder.city__c.addError('市不能为空!'); |
| | | errormessageFlg = true; |
| | | return null; |
| | | } |
| | | |
| | | Map<Id, Sample_order_list_detail__c> orderListDelMap = new Map<Id, Sample_order_list_detail__c>(); |
| | | if (String.isNotBlank(orderListId) && orderListDelList.size() > 0) { |
| | | for(Sample_order_list_detail__c orderListDel : orderListDelList){ |