52 lines
2.4 KiB
Java
52 lines
2.4 KiB
Java
|
package shkd.repc.recos.opplugin;
|
||
|
|
||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||
|
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||
|
import kd.bos.entity.plugin.PreparePropertysEventArgs;
|
||
|
import kd.bos.entity.plugin.args.AfterOperationArgs;
|
||
|
import kd.bos.orm.query.QCP;
|
||
|
import kd.bos.orm.query.QFilter;
|
||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||
|
import kd.sdk.plugin.Plugin;
|
||
|
|
||
|
/**
|
||
|
* 单据操作插件
|
||
|
*/
|
||
|
public class DelBackTargetVersionOpPlugin extends AbstractOperationServicePlugIn implements Plugin {
|
||
|
|
||
|
@Override
|
||
|
public void onPreparePropertys(PreparePropertysEventArgs e) {
|
||
|
super.onPreparePropertys(e);
|
||
|
e.getFieldKeys().add("measurecostid");
|
||
|
e.getFieldKeys().add("shapetype");
|
||
|
e.getFieldKeys().add("project");
|
||
|
e.getFieldKeys().add("project.id");
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
|
||
|
super.afterExecuteOperationTransaction(e);
|
||
|
DynamicObject[] dataEntities1 = e.getDataEntities();
|
||
|
if(dataEntities1!=null&&dataEntities1.length!=0){
|
||
|
for (int i1 = 0; i1 < dataEntities1.length; i1++) {
|
||
|
DynamicObject dynamicObject2 = dataEntities1[i1];
|
||
|
if("0".equals(dynamicObject2.getString("shapetype"))){
|
||
|
DynamicObject dynamicObject = dynamicObject2;
|
||
|
QFilter measurecostid = new QFilter("project", QCP.equals, dynamicObject.getDynamicObject("project").getPkValue())
|
||
|
.and("qeug_aimversionflag",QCP.equals,true);
|
||
|
DynamicObject[] recos_measurecosts = BusinessDataServiceHelper.load("recos_measurecost", "id", measurecostid.toArray());
|
||
|
if(recos_measurecosts!=null&&recos_measurecosts.length!=0){
|
||
|
for (int i = 0; i < recos_measurecosts.length; i++) {
|
||
|
DynamicObject recos_measurecost = recos_measurecosts[i];
|
||
|
DynamicObject dynamicObject1 = BusinessDataServiceHelper.loadSingle(recos_measurecost.getPkValue(), "recos_measurecost");
|
||
|
dynamicObject1.set("qeug_aimversionflag",false);
|
||
|
// dynamicObject1.set("aimversionflag",false);刷新所有目标版
|
||
|
SaveServiceHelper.update(dynamicObject1);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|