探亲bug修复
This commit is contained in:
		
							parent
							
								
									869bf3eb35
								
							
						
					
					
						commit
						00b2222090
					
				| 
						 | 
				
			
			@ -0,0 +1,57 @@
 | 
			
		|||
package zcgj.zcdev.zcdev.pr.plugin.form;
 | 
			
		||||
 | 
			
		||||
import kd.bos.bill.AbstractBillPlugIn;
 | 
			
		||||
import kd.bos.dataentity.entity.DynamicObject;
 | 
			
		||||
import kd.bos.dataentity.metadata.IDataEntityType;
 | 
			
		||||
import kd.bos.form.field.BasedataEdit;
 | 
			
		||||
import kd.bos.form.field.events.BeforeF7SelectEvent;
 | 
			
		||||
import kd.bos.form.field.events.BeforeF7SelectListener;
 | 
			
		||||
import kd.bos.list.ListShowParameter;
 | 
			
		||||
import kd.bos.orm.query.QCP;
 | 
			
		||||
import kd.bos.orm.query.QFilter;
 | 
			
		||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
 | 
			
		||||
import kd.sdk.plugin.Plugin;
 | 
			
		||||
 | 
			
		||||
import java.util.EventObject;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 合同修订单
 | 
			
		||||
 *  承包工序根据项目过滤
 | 
			
		||||
 */
 | 
			
		||||
public class ContractProcessRevisionFilterPlugin extends AbstractBillPlugIn implements Plugin, BeforeF7SelectListener {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void registerListener(EventObject e) {
 | 
			
		||||
        super.registerListener(e);
 | 
			
		||||
        BasedataEdit contractprocess = this.getControl("zcgj_contractprocess");
 | 
			
		||||
        if(contractprocess != null) {
 | 
			
		||||
            contractprocess.addBeforeF7SelectListener(this);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void beforeF7Select(BeforeF7SelectEvent beforeF7SelectEvent) {
 | 
			
		||||
        String name1 = beforeF7SelectEvent.getProperty().getName();
 | 
			
		||||
        if(name1.equals("zcgj_contractprocess")) {
 | 
			
		||||
            String name = this.getModel().getDataEntity().getDataEntityType().getName();
 | 
			
		||||
            Object contractObj = this.getModel().getValue("contract");
 | 
			
		||||
            if(contractObj != null) {
 | 
			
		||||
                if(contractObj instanceof DynamicObject) {
 | 
			
		||||
                    DynamicObject contract = (DynamicObject) contractObj;
 | 
			
		||||
                    Object projectObj = contract.getDynamicObject("project");
 | 
			
		||||
                    if(projectObj!=null){
 | 
			
		||||
                        DynamicObject projectInfo = (DynamicObject)projectObj;
 | 
			
		||||
                        QFilter qFilter = new QFilter("project.id", QCP.equals, projectInfo.getLong("id"));
 | 
			
		||||
                        QFilter treeFilter = new QFilter("number", QCP.equals, projectInfo.getString("number"));
 | 
			
		||||
                        ListShowParameter showParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter();
 | 
			
		||||
                        showParameter.getListFilterParameter().getQFilters().add(qFilter);
 | 
			
		||||
                        showParameter.getTreeFilterParameter().getQFilters().add(treeFilter);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
//    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -15,30 +15,32 @@ public class ContractSettleOp extends AbstractOperationServicePlugIn {
 | 
			
		|||
    public void onAddValidators(AddValidatorsEventArgs e) {
 | 
			
		||||
        super.onAddValidators(e);
 | 
			
		||||
        DynamicObject[] dataEntities1 = e.getDataEntities();
 | 
			
		||||
        DynamicObject object = dataEntities1[0];
 | 
			
		||||
        Object changetype = object.getString("changetype");
 | 
			
		||||
        if (changetype != null) {
 | 
			
		||||
            if (changetype.toString().equals("03")) {
 | 
			
		||||
                DynamicObject contract = object.getDynamicObject("contract");
 | 
			
		||||
                String billName = contract.getDataEntityType().getName();
 | 
			
		||||
                DynamicObject zcgjpartb = object.getDynamicObject("zcgj_partb");
 | 
			
		||||
                DynamicObjectCollection zcgjOtherpart = object.getDynamicObjectCollection("zcgj_otherpart");
 | 
			
		||||
                if (billName.equals("ec_out_contract_f7")) {
 | 
			
		||||
                    QFilter f1 = new QFilter("number", "=", contract.getString("number"));
 | 
			
		||||
                    DynamicObject outContractF7 = BusinessDataServiceHelper.loadSingle("ec_out_contract_f7", new QFilter[]{f1});
 | 
			
		||||
                    outContractF7.set("partb", zcgjpartb);
 | 
			
		||||
                    OperationResult saveOperationResult = SaveServiceHelper.saveOperate("ec_out_contract_f7", new DynamicObject[]{outContractF7}, null);//支出合同F7实体
 | 
			
		||||
        if(dataEntities1!=null && dataEntities1.length>0){
 | 
			
		||||
            DynamicObject object = dataEntities1[0];
 | 
			
		||||
            Object changetype = object.getString("changetype");
 | 
			
		||||
            if (changetype != null) {
 | 
			
		||||
                if (changetype.toString().equals("03")) {
 | 
			
		||||
                    DynamicObject contract = object.getDynamicObject("contract");
 | 
			
		||||
                    String billName = contract.getDataEntityType().getName();
 | 
			
		||||
                    DynamicObject zcgjpartb = object.getDynamicObject("zcgj_partb");
 | 
			
		||||
                    DynamicObjectCollection zcgjOtherpart = object.getDynamicObjectCollection("zcgj_otherpart");
 | 
			
		||||
                    if (billName.equals("ec_out_contract_f7")) {
 | 
			
		||||
                        QFilter f1 = new QFilter("number", "=", contract.getString("number"));
 | 
			
		||||
                        DynamicObject outContractF7 = BusinessDataServiceHelper.loadSingle("ec_out_contract_f7", new QFilter[]{f1});
 | 
			
		||||
                        outContractF7.set("partb", zcgjpartb);
 | 
			
		||||
                        OperationResult saveOperationResult = SaveServiceHelper.saveOperate("ec_out_contract_f7", new DynamicObject[]{outContractF7}, null);//支出合同F7实体
 | 
			
		||||
 | 
			
		||||
                    QFilter f2 = new QFilter("billno", "=", contract.getString("number"));
 | 
			
		||||
                    DynamicObject outContract = BusinessDataServiceHelper.loadSingle("ec_out_contract", new QFilter[]{f2});
 | 
			
		||||
                    outContract.set("partb", zcgjpartb);
 | 
			
		||||
                    if (zcgjOtherpart != null) {
 | 
			
		||||
                        QFilter f2 = new QFilter("billno", "=", contract.getString("number"));
 | 
			
		||||
                        DynamicObject outContract = BusinessDataServiceHelper.loadSingle("ec_out_contract", new QFilter[]{f2});
 | 
			
		||||
                        outContract.set("partb", zcgjpartb);
 | 
			
		||||
                        if (zcgjOtherpart != null) {
 | 
			
		||||
//                        DynamicObjectCollection otherpart = (DynamicObjectCollection) this.getModel().getValue("zcgj_otherpart");
 | 
			
		||||
                        outContract.set("otherpart", zcgjOtherpart);
 | 
			
		||||
                        outContract.set("ismulticontract", true);
 | 
			
		||||
                            outContract.set("otherpart", zcgjOtherpart);
 | 
			
		||||
                            outContract.set("ismulticontract", true);
 | 
			
		||||
                        }
 | 
			
		||||
                        OperationResult saveOperationResult1 = SaveServiceHelper.saveOperate("ec_out_contract", new DynamicObject[]{outContractF7}, null);//支出合同实体
 | 
			
		||||
                        System.out.println(saveOperationResult1);
 | 
			
		||||
                    }
 | 
			
		||||
                    OperationResult saveOperationResult1 = SaveServiceHelper.saveOperate("ec_out_contract", new DynamicObject[]{outContractF7}, null);//支出合同实体
 | 
			
		||||
                    System.out.println(saveOperationResult1);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue