一级付款事项保存生成辅助资料

This commit is contained in:
zengweihai 2024-07-01 18:03:54 +08:00
parent 35089d0383
commit b79ec03395
1 changed files with 65 additions and 0 deletions

View File

@ -0,0 +1,65 @@
package shkd.esc.ggsz;
import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.context.RequestContext;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.entity.operate.result.OperationResult;
import kd.bos.form.events.AfterDoOperationEventArgs;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.operation.OperationServiceHelper;
import kd.bos.servicehelper.user.UserServiceHelper;
import kd.sdk.plugin.Plugin;
import java.util.EventObject;
/**
* 单据界面插件
*/
public class ShkdPaymentBillFormPlugin extends AbstractBillPlugIn implements Plugin {
/**
* 初始化默认设置人员创建组织
* @param e
*/
@Override
public void afterCreateNewData(EventObject e) {
super.afterCreateNewData(e);
QFilter createorg_qf = new QFilter("number", QCP.equals, "16005873");
//查询创建组织
DynamicObject bos_org = BusinessDataServiceHelper.loadSingle("bos_org", "id", createorg_qf.toArray());
this.getModel().setValue("createorg",bos_org);
}
@Override
public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) {
super.afterDoOperation(afterDoOperationEventArgs);
String operateKey = afterDoOperationEventArgs.getOperateKey();
if ("audit".equals(operateKey)){//当操作为审核时
DynamicObject dataEntity = this.getModel().getDataEntity();
DynamicObject newDynamicObject = BusinessDataServiceHelper.newDynamicObject("bos_assistantdata_detail");
newDynamicObject.set("number",dataEntity.getString("number"));//设置编码
newDynamicObject.set("name",dataEntity.getString("name"));//设置名称
QFilter payment_qf = new QFilter("number", QCP.equals, "FKSX");
//查询流程事项类别
DynamicObject bos_assistantdatagroup = BusinessDataServiceHelper.loadSingle("bos_assistantdatagroup", "id", payment_qf.toArray());
newDynamicObject.set("group",bos_assistantdatagroup);//设置类别
QFilter createorg_qf = new QFilter("number", QCP.equals, "16005873");
//查询创建组织
DynamicObject bos_org = BusinessDataServiceHelper.loadSingle("bos_org", "id", createorg_qf.toArray());
newDynamicObject.set("createorg",bos_org);//设置创建组织
newDynamicObject.set("ctrlstrategy","6");//设置控制策略
newDynamicObject.set("enable","1");//设置使用状态为可用
newDynamicObject.set("status","A");//设置数据状态为暂存
newDynamicObject.set("level",1);//设置级别为1
newDynamicObject.set("isleaf","1");//设置为叶子节点
newDynamicObject.set("seq","0");//设置显示顺序为0
OperationResult operationSaveResult = OperationServiceHelper.executeOperate("save", "bos_assistantdata_detail", new DynamicObject[]{newDynamicObject}, null);
OperationResult operationSubmitResult = OperationServiceHelper.executeOperate("submit", "bos_assistantdata_detail", new DynamicObject[]{newDynamicObject}, null);
OperationResult operationAuditResult = OperationServiceHelper.executeOperate("audit", "bos_assistantdata_detail", new DynamicObject[]{newDynamicObject}, null);
}
}
}