global class RentalQueueShippmentDate0Batch implements Database.Batchable<sObject> {
|
public String query;
|
|
global RentalQueueShippmentDate0Batch() {
|
this.query = query;
|
}
|
|
global Database.QueryLocator start(Database.BatchableContext bc) {
|
query = 'select Id,QueueShippmentDate__c FROM Rental_Apply__c where Queue_Count__c > 0 AND QueueShippmentDate__c != null';
|
return Database.getQueryLocator(query);
|
}
|
|
global void execute(Database.BatchableContext BC, list<Sobject> scope) {
|
// 清空有排队明细的申请书汇总
|
List<Rental_Apply__c> claerRaList = scope;
|
for(Rental_Apply__c ra:claerRaList){
|
ra.QueueShippmentDate__c = null;
|
}
|
update claerRaList;
|
// 清空排队中有 排队备品预计出库时间 一览
|
// 排队备品预计出库时间 QueueShippmentDate__c
|
// 回寄日 Asset_return_Day__c
|
// 欠品OK时间 Lost_item_check_OK__c
|
// 排队备品预计明细 QueueDetail__c
|
List<Rental_Apply_Equipment_Set__c> claerRaeList = [select Id,
|
QueueShippmentDate__c,
|
Asset_return_Day__c,
|
Lost_item_check_OK__c,
|
QueueDetail__c
|
from Rental_Apply_Equipment_Set__c where Rental_Apply__c in:claerRaList AND QueueShippmentDate__c != null and First_RAESD__r.RAESD_Status__c = '排队中'];
|
for(Rental_Apply_Equipment_Set__c rae:claerRaeList){
|
rae.QueueShippmentDate__c = null;
|
rae.Asset_return_Day__c = null;
|
rae.Lost_item_check_OK__c = null;
|
rae.QueueDetail__c = '';
|
}
|
update claerRaeList;
|
|
}
|
|
global void finish(Database.BatchableContext BC) {
|
database.executebatch(new RentalQueueShippmentDateBatch(),50);
|
}
|
}
|