|
@@ -1,19 +1,27 @@
|
|
|
package nckd.poc602.plugin.task;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.HashSet;
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Set;
|
|
|
|
|
|
import kd.bos.context.RequestContext;
|
|
|
+import kd.bos.dataentity.OperateOption;
|
|
|
import kd.bos.dataentity.entity.DynamicObject;
|
|
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
|
+import kd.bos.dataentity.metadata.dynamicobject.DynamicObjectType;
|
|
|
+import kd.bos.entity.EntityMetadataCache;
|
|
|
+import kd.bos.entity.MainEntityType;
|
|
|
+import kd.bos.entity.operate.result.OperationResult;
|
|
|
import kd.bos.exception.KDException;
|
|
|
import kd.bos.orm.query.QCP;
|
|
|
import kd.bos.orm.query.QFilter;
|
|
|
import kd.bos.schedule.executor.AbstractTask;
|
|
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|
|
import kd.bos.servicehelper.QueryServiceHelper;
|
|
|
+import kd.bos.servicehelper.operation.OperationServiceHelper;
|
|
|
|
|
|
/**
|
|
|
* Module :供应链-合同管理
|
|
@@ -67,7 +75,31 @@ public class PurContractHaveNotJGSDTask extends AbstractTask {
|
|
|
bf.append(cght.toString());
|
|
|
bf.append(System.lineSeparator());
|
|
|
}
|
|
|
+ this.buildBGYJD(bf.toString());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private void buildBGYJD(String error) {
|
|
|
+ String entityNumSupplier = "nckd_cght_bg_yjd";
|
|
|
+ DynamicObject yjd = BusinessDataServiceHelper.newDynamicObject(entityNumSupplier);
|
|
|
+ //结算组织
|
|
|
+ yjd.set("nckd_error", error);
|
|
|
+
|
|
|
+ List<DynamicObject> yjds = new ArrayList<>();
|
|
|
+ yjds.add(yjd);
|
|
|
+ //保存单据
|
|
|
+ OperationResult sRet = OperationServiceHelper.executeOperate("save","nckd_cght_bg_yjd",yjds.toArray(new DynamicObject[yjds.size()]),OperateOption.create());
|
|
|
+ if(sRet.isSuccess()) {
|
|
|
+ MainEntityType dt = EntityMetadataCache.getDataEntityType("nckd_cght_bg_yjd");
|
|
|
+ List<Object> yjdids = sRet.getSuccessPkIds();
|
|
|
+ DynamicObject[] yjdobs = BusinessDataServiceHelper.load(yjdids.toArray(), (DynamicObjectType)dt);
|
|
|
+ sRet = OperationServiceHelper.executeOperate("submit","nckd_cght_bg_yjd",yjdobs,OperateOption.create());
|
|
|
+ if(sRet.isSuccess()) {
|
|
|
+ yjdids = sRet.getSuccessPkIds();
|
|
|
+ yjdobs = BusinessDataServiceHelper.load(yjdids.toArray(), (DynamicObjectType)dt);
|
|
|
+ sRet = OperationServiceHelper.executeOperate("audit","nckd_cght_bg_yjd",yjdobs,OperateOption.create());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|