|
@@ -1,9 +1,20 @@
|
|
|
package nckd.poc602.plugin.form;
|
|
|
|
|
|
+import java.util.HashSet;
|
|
|
+import java.util.Set;
|
|
|
+
|
|
|
import kd.bos.bill.AbstractBillPlugIn;
|
|
|
+import kd.bos.bill.BillShowParameter;
|
|
|
+import kd.bos.dataentity.entity.DynamicObject;
|
|
|
+import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
|
+import kd.bos.form.IFormView;
|
|
|
+import kd.bos.form.ShowType;
|
|
|
import kd.bos.form.events.AfterDoOperationEventArgs;
|
|
|
import kd.bos.form.field.events.BeforeF7SelectEvent;
|
|
|
import kd.bos.form.field.events.BeforeF7SelectListener;
|
|
|
+import kd.bos.orm.query.QCP;
|
|
|
+import kd.bos.orm.query.QFilter;
|
|
|
+import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|
|
|
|
|
/**
|
|
|
* @author xiaobing_wu
|
|
@@ -15,15 +26,51 @@ public class PayBillSubmitFormPlugin extends AbstractBillPlugIn implements Befor
|
|
|
// TODO Auto-generated method stub
|
|
|
super.afterDoOperation(afterDoOperationEventArgs);
|
|
|
String opkey = afterDoOperationEventArgs.getOperateKey();
|
|
|
- Object ceyj = this.getModel().getValue("nckd_ceyj");
|
|
|
- if("beforesubmit".equals(opkey) && ceyj != null && !String.valueOf(ceyj).equals("")) {
|
|
|
- this.getView().showErrorNotification(String.valueOf(ceyj));
|
|
|
- }
|
|
|
+// Object ceyj = this.getModel().getValue("nckd_ceyj");
|
|
|
+// if("beforesubmit".equals(opkey) && ceyj != null && !String.valueOf(ceyj).equals("")) {
|
|
|
+// this.getView().showErrorNotification(String.valueOf(ceyj));
|
|
|
+// }
|
|
|
+ if("querysk".equals(opkey)) {
|
|
|
+ DynamicObject fkd = this.getModel().getDataEntity(true);
|
|
|
+ Set<Object> xshtids = new HashSet<>();
|
|
|
+ DynamicObjectCollection entrys = fkd.getDynamicObjectCollection("entry");
|
|
|
+ for(DynamicObject entryitem : entrys) {
|
|
|
+ DynamicObject xsht = entryitem.getDynamicObject("nckd_refbillfield");
|
|
|
+ if(xsht != null) {
|
|
|
+ xshtids.add(xsht.getPkValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!xshtids.isEmpty()) {
|
|
|
+ String skdentity = "cas_recbill";
|
|
|
+ Set<Object> skdids = new HashSet<>();
|
|
|
+ QFilter qf = new QFilter("entry.nckd_refbillfield1",QCP.in,xshtids);
|
|
|
+ DynamicObject[] skds = BusinessDataServiceHelper.load("cas_recbill", "id", qf.toArray());
|
|
|
+ for(DynamicObject skd : skds) {
|
|
|
+ skdids.add(skd.getPkValue());
|
|
|
+ }
|
|
|
+ if(skdids.size() == 1) {
|
|
|
+ BillShowParameter bsp = new BillShowParameter();
|
|
|
+ bsp.setFormId(skdentity);
|
|
|
+ bsp.setPkId(skdids.toArray()[0]);
|
|
|
+ bsp.getOpenStyle().setShowType(ShowType.MainNewTabPage);
|
|
|
+ bsp.getOpenStyle().setTargetKey("tabap");
|
|
|
+ String pageId = this.generatePage4ListOp(this.getView(),skdentity, skdids.toArray()[0]);
|
|
|
+ bsp.setPageId(pageId);
|
|
|
+ this.getView().showForm(bsp);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ this.getView().showErrorNotification("未找到关联的收款单");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ private String generatePage4ListOp(IFormView currentView, String viewBillFormId, Object pkValue) {
|
|
|
+ return currentView.getPageId() + "_" + viewBillFormId + "_" + pkValue;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void beforeF7Select(BeforeF7SelectEvent arg0) {
|
|
|
// TODO Auto-generated method stub
|
|
|
-
|
|
|
}
|
|
|
}
|