public without sharing class summonsPDFController {
|
public Consumable_order__c coc { get; set; }
|
private String ESetId = '';
|
private Map<String,Date> productkucun = new Map<String,Date>();
|
//医院经销商分离
|
public List<ConsumableorderdetailsInfo> consumableorderdetailsRecords { get; set; }
|
private List<Consumable_orderdetails__c> consumableorderdetailsSelected = new List<Consumable_orderdetails__c>();
|
private String userId = '';
|
private String accountid = '';
|
private String accountName = null;
|
public summonsPDFController() {
|
ESetId = ApexPages.currentPage().getParameters().get('esetId');
|
coc = new Consumable_order__c();
|
}
|
public void init() {
|
userId = UserInfo.getUserId();
|
List<user> Useracc = New List<user>();
|
Useracc = [select accountid from user where id =:userId];
|
accountid = Useracc[0].accountid;
|
List<account> accountInfo = [SELECT Name FROM account WHERE id =:accountid];
|
accountName = accountInfo[0].Name;
|
coc = [select Id,Name,SummonsStatus_c__c,Order_ForDealerText__c,ShipmentAccount__c,
|
Order_ForDealer__r.Name,Dealer_Info__r.Name,Order_Dealer_Info__c,Order_ForCustomerText__c,
|
Order_ForHospital__r.Name,SummonsForDirction__c,
|
Order_date__c,Order_status__c
|
From Consumable_order__c
|
Where Id =:ESetId
|
and Order_type__c = '传票'];
|
// 選択済みの明细を取得
|
consumableorderdetailsSelected = new List<Consumable_orderdetails__c>();
|
consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
|
if(ESetId==null||ESetId==''){
|
}else{
|
consumableorderdetailsSelected = [select Id,
|
Name,
|
Consumable_order__c,
|
Consumable_Product__c,
|
Consumable_Product__r.Name,
|
Shipment_Count__c,
|
Consumable_Product__r.Intra_Trade_List_RMB__c,
|
Consumable_Product__r.Asset_Model_No__c,
|
Sum_of_money__c,
|
Consumable_Product__r.Name__c,
|
Box_Piece__c
|
from Consumable_orderdetails__c
|
where Consumable_order__c = :ESetId
|
order by Name ];
|
for (Integer i = 0; i < consumableorderdetailsSelected.size(); i++) {
|
consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(consumableorderdetailsSelected[i]));
|
}
|
datelimitSearch();
|
for(ConsumableorderdetailsInfo bss : consumableorderdetailsRecords){
|
if(productkucun.get(bss.Prod.Id) != null){
|
bss.guaranteeperiod = productkucun.get(bss.Prod.Id);
|
}
|
}
|
}
|
}
|
//消费期限
|
public void datelimitSearch(){
|
List<Consumable_order_details2__c> orderkucun = [SELECT Id,Bar_Code__c, Name,Consumable_Product__c,Recordtypeid,
|
Guarantee_period_for_products__c,Sterilization_limit__c
|
FROM Consumable_order_details2__c
|
WHERE Dealer_Arrive__c = true
|
AND Dealer_Shipment__c = false
|
AND Dealer_Saled__c = false
|
AND Lose_Flag__c = false
|
AND Bar_Code__c !=null
|
AND Dealer_Info_text__c = :accountName
|
//AND Consumable_order_minor__r.Dealer_Info__c = :accountid
|
ORDER BY Consumable_Product__c, Sterilization_limit__c asc ];
|
for(Integer i = 0 ; i< orderkucun.size();i++){
|
if(productkucun.containsKey(orderkucun[i].Consumable_Product__c)){
|
continue;
|
}else{
|
productkucun.put(orderkucun[i].Consumable_Product__c, orderkucun[i].Sterilization_limit__c);
|
}
|
}
|
System.debug('productkucun ++++' + productkucun);
|
}
|
|
class ConsumableorderdetailsInfo {
|
public Consumable_orderdetails__c esd { get; set; }
|
public Product2__c Prod { get; set; }
|
public Date guaranteeperiod { get; set; }
|
|
// 已存在备品set明细用
|
public ConsumableorderdetailsInfo(Consumable_orderdetails__c e) {
|
esd = e;
|
Prod = e.Consumable_Product__r;
|
}
|
// 排序
|
/*public Integer compareTo(Object compareTo) {
|
return null;
|
}*/
|
}
|
}
|