public without sharing class Morethan7daysAllController {
|
// 订单 ID
|
//private String orderId = '';
|
public List<showRecords> MorethansevendaysIifo { get; set; }
|
public String type { get; set; }
|
public Morethan7daysAllController() {
|
//orderId = ApexPages.currentPage().getParameters().get('Id');
|
MorethansevendaysIifo = new List<showRecords>();
|
type = ApexPages.currentPage().getParameters().get('type');
|
}
|
|
// 画面初始化
|
public void init() {
|
String userId = UserInfo.getUserId();
|
List<User> userList = [SELECT accountid, Work_Location__c,UserPro_Type__c
|
FROM user
|
WHERE id = :userId ];
|
String accountid = userList[0].accountid;
|
String userPro_Type = userList[0].UserPro_Type__c;
|
String userWorklocation = userList[0].Work_Location__c;
|
Date orderdate = Date.today().addDays(-7);
|
String rtTypeDelivery = System.Label.RT_ConOrder_Delivery;
|
List<Consumable_order__c> conorderlist = new List<Consumable_order__c>();
|
//20200916 ljh update start
|
if(Test.isRunningTest()){
|
//conorderlist = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >=0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
|
if(type !=null && type.equals('all')){
|
conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c >= 0 or Delivery_detail_count__c >=0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
|
}else{
|
conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >=0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
|
}
|
|
}else{
|
//conorderlist = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
|
if(type !=null && type.equals('all')){
|
conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0) and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
|
}else{
|
conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c >0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
|
}
|
}
|
system.debug('==============>conorderlist'+conorderlist);
|
system.debug('==============>conorderlist'+conorderlist.size());
|
//20200916 ljh update end
|
// List<Consumable_order__c> conorderlist = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c > 0 and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
|
System.debug('======'+conorderlist+'daxiao:'+conorderlist.size());
|
for(Consumable_order__c conorder : conorderlist){
|
System.debug('======'+conorder.Owner.Name+'======');
|
}
|
Set<String> orderId = new Set<String>();
|
for(Consumable_order__c conorder : conorderlist){
|
orderId.add(conorder.Id);
|
}
|
System.debug('ANY o'+orderId);
|
List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
|
if(Test.isRunningTest()){
|
conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c ];
|
}else{
|
//20200916 ljh update start
|
//conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
|
if(type !=null && type.equals('all')){
|
system.debug('all============');
|
conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
|
system.debug('allconList==========='+conList.size());
|
}else{
|
system.debug('notall=============');
|
conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
|
system.debug('notallconList==========='+conList.size());
|
}
|
//20200916 ljh update end
|
}
|
// List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
|
Map<String,String> srtMap = new Map<String,String>();
|
for(Consumable_order_details2__c con : conList){
|
srtMap.put(con.Bar_Code__c, con.Id);
|
}
|
List<String> str = new List<String>();
|
for(String s : srtMap.keySet()){
|
str.add(srtMap.get(s));
|
}
|
List<AggregateResult> Morethan7daysList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
|
WHERE Id =: str and Cancellation_Flag__c = false
|
AND Consumable_order_minor__c != null
|
AND Dealer_Shipment__c = false
|
AND Dealer_Arrive__c = false
|
AND Dealer_Saled__c = false
|
AND Consumable_order_minor__r.showFalseNotshowTrue__c = false
|
AND Deliver_date__c < LAST_N_DAYS:7
|
GROUP BY Asset_Model_No__c];
|
system.debug('Morethan7daysList================>'+Morethan7daysList.size());
|
for(Integer i = 0 ; i< Morethan7daysList.size() ; i++){
|
MorethansevendaysIifo.add(new showRecords(Morethan7daysList[i]));
|
system.debug('MorethansevendaysIifo+++++++'+MorethansevendaysIifo);
|
}
|
}
|
|
// Data Bean
|
class showRecords implements Comparable {
|
|
public Decimal recordCount { get; set; }
|
public String prodModel { get; set; }
|
|
|
public showRecords(AggregateResult e) {
|
recordCount =Integer.valueOf(e.get('recordCount'));
|
prodModel = String.valueOf(e.get('prodModel'));
|
}
|
// 排序
|
public Integer compareTo(Object compareTo) {
|
return null;
|
}
|
}
|
}
|