|
@@ -0,0 +1,42 @@
|
|
|
|
+package nckd.jimin.jyyy.fi.plugin.form;
|
|
|
|
+
|
|
|
|
+import kd.bos.bill.AbstractBillPlugIn;
|
|
|
|
+import kd.bos.dataentity.OperateOption;
|
|
|
|
+import kd.bos.dataentity.entity.DynamicObject;
|
|
|
|
+import kd.bos.entity.operate.result.OperationResult;
|
|
|
|
+import kd.bos.form.events.AfterDoOperationEventArgs;
|
|
|
|
+import kd.bos.servicehelper.operation.OperationServiceHelper;
|
|
|
|
+import kd.sdk.plugin.Plugin;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 单据界面插件
|
|
|
|
+ */
|
|
|
|
+public class VoucherEditPlugin extends AbstractBillPlugIn implements Plugin {
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void afterDoOperation(AfterDoOperationEventArgs e) {
|
|
|
|
+ super.afterDoOperation(e);
|
|
|
|
+ String key = e.getOperateKey();
|
|
|
|
+ StringBuilder errorInfo = new StringBuilder();
|
|
|
|
+ /***
|
|
|
|
+ * 审核后,调用SAP同步操作
|
|
|
|
+ */
|
|
|
|
+ if ("audit".equals(key)) {
|
|
|
|
+ OperationResult operationResult = e.getOperationResult();
|
|
|
|
+ if (operationResult.isSuccess()) { // 审核已经成功
|
|
|
|
+ DynamicObject voucher = this.getModel().getDataEntity();
|
|
|
|
+ OperationResult opResult = OperationServiceHelper.executeOperate("synsap", "gl_voucher", new DynamicObject[]{voucher}, OperateOption.create());
|
|
|
|
+ if (opResult != null && opResult.isSuccess()){
|
|
|
|
+ errorInfo.append(opResult.getMessage());
|
|
|
|
+ }else{
|
|
|
|
+ errorInfo.append(opResult.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (errorInfo.length() > 0) {
|
|
|
|
+ this.getView().showTipNotification(errorInfo.toString(), 2500);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|