parent
6c60bffed8
commit
af77e5de72
|
@ -0,0 +1,102 @@
|
||||||
|
package shkd.sys.sys.plugin.list;
|
||||||
|
|
||||||
|
import com.alibaba.druid.util.StringUtils;
|
||||||
|
import kd.bos.dataentity.OperateOption;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.entity.operate.result.OperateErrorInfo;
|
||||||
|
import kd.bos.entity.operate.result.OperationResult;
|
||||||
|
import kd.bos.form.ConfirmTypes;
|
||||||
|
import kd.bos.form.MessageBoxOptions;
|
||||||
|
import kd.bos.form.events.AfterDoOperationEventArgs;
|
||||||
|
import kd.bos.list.plugin.AbstractListPlugin;
|
||||||
|
import kd.bos.logging.Log;
|
||||||
|
import kd.bos.logging.LogFactory;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.bos.servicehelper.botp.BFTrackerServiceHelper;
|
||||||
|
import kd.bos.servicehelper.operation.OperationServiceHelper;
|
||||||
|
import kd.tmc.cdm.common.constant.CdmEntityConst;
|
||||||
|
import shkd.sys.sys.plugin.report.FinanceReportPlugin;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class ReceivableListPlugin extends AbstractListPlugin {
|
||||||
|
|
||||||
|
private static final Log logger = LogFactory.getLog(ReceivableListPlugin.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) {
|
||||||
|
super.afterDoOperation(afterDoOperationEventArgs);
|
||||||
|
String operateKey = afterDoOperationEventArgs.getOperateKey();
|
||||||
|
if ("autogenrecbill".equals(operateKey)){
|
||||||
|
OperationResult operationResult = afterDoOperationEventArgs.getOperationResult();
|
||||||
|
if (operationResult.getSuccessPkIds().size()!=0){
|
||||||
|
List<Object> successPkIds = operationResult.getSuccessPkIds();
|
||||||
|
for (Object successPkId : successPkIds) {
|
||||||
|
Map<String, HashSet<Long>> cdm_receivablebill = BFTrackerServiceHelper.findTargetBills("cdm_receivablebill", new Long[]{(Long) successPkId});
|
||||||
|
System.out.println(cdm_receivablebill);
|
||||||
|
HashSet<Long> cas_recbill = cdm_receivablebill.get("cas_recbill");
|
||||||
|
QFilter filter = new QFilter("shkd_zdxtid", QCP.equals, "true");
|
||||||
|
filter.and(new QFilter("id", QCP.in, cas_recbill));
|
||||||
|
DynamicObject[] CDM_PAYABLEBILLs = BusinessDataServiceHelper.load("cas_recbill", "id,billno,org", filter.toArray());
|
||||||
|
List<Long> list = new ArrayList<>();
|
||||||
|
for (int i = 0; i < CDM_PAYABLEBILLs.length; i++) {
|
||||||
|
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(CDM_PAYABLEBILLs[i].get("id"), "cas_recbill");
|
||||||
|
list.add(dynamicObject.getLong("id"));
|
||||||
|
}
|
||||||
|
StringBuilder Builder = new StringBuilder("");
|
||||||
|
//调用方法执行数据 - 自动兑付下推
|
||||||
|
OperationResult operationResult1 = OperationServiceHelper.executeOperate("submit",
|
||||||
|
"cas_recbill",
|
||||||
|
list.toArray(), OperateOption.create());
|
||||||
|
logger.info("operationResult1:"+operationResult1);
|
||||||
|
// if (operationResult1.getAllErrorInfo().size()!=0){
|
||||||
|
// List<OperateErrorInfo> allErrorInfo = operationResult1.getAllErrorInfo();
|
||||||
|
// for (int i = 0; i < allErrorInfo.size(); i++) {
|
||||||
|
// String message = allErrorInfo.get(i).getMessage();
|
||||||
|
// Builder.append(message+"\n");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
OperationResult operationResult2=null;
|
||||||
|
if ( operationResult1.getSuccessPkIds().size()!=0){
|
||||||
|
operationResult2 = OperationServiceHelper.executeOperate("audit",
|
||||||
|
"cas_recbill",
|
||||||
|
operationResult1.getSuccessPkIds().toArray(), OperateOption.create());
|
||||||
|
// if (operationResult2.getAllErrorInfo().size()!=0){
|
||||||
|
// List<OperateErrorInfo> allErrorInfo = operationResult2.getAllErrorInfo();
|
||||||
|
// for (int i = 0; i < allErrorInfo.size(); i++) {
|
||||||
|
// String message = allErrorInfo.get(i).getMessage();
|
||||||
|
// Builder.append(message+"\n");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
logger.info("operationResult2:"+operationResult2);
|
||||||
|
|
||||||
|
OperationResult operationResult3=null;
|
||||||
|
if ( operationResult2.getSuccessPkIds().size()!=0){
|
||||||
|
operationResult3 = OperationServiceHelper.executeOperate("receivingrec",
|
||||||
|
"cas_recbill",
|
||||||
|
operationResult2.getSuccessPkIds().toArray(), OperateOption.create());
|
||||||
|
// if (operationResult3.getAllErrorInfo().size()!=0){
|
||||||
|
// List<OperateErrorInfo> allErrorInfo = operationResult3.getAllErrorInfo();
|
||||||
|
// for (int i = 0; i < allErrorInfo.size(); i++) {
|
||||||
|
// String message = allErrorInfo.get(i).getMessage();
|
||||||
|
// Builder.append(message+"\n");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
logger.info("operationResult3:"+operationResult3);
|
||||||
|
|
||||||
|
// if (StringUtils.isEmpty(Builder.toString())){
|
||||||
|
// this.getView().showConfirm("操作失败",Builder.toString() , MessageBoxOptions.None, ConfirmTypes.Default, null);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue