parent
							
								
									486001ab85
								
							
						
					
					
						commit
						a6982398e4
					
				| 
						 | 
				
			
			@ -0,0 +1,65 @@
 | 
			
		|||
package shkd.repc.recon.formplugin;
 | 
			
		||||
 | 
			
		||||
import kd.bos.bill.AbstractBillPlugIn;
 | 
			
		||||
import kd.bos.dataentity.entity.DynamicObject;
 | 
			
		||||
import kd.bos.orm.query.QCP;
 | 
			
		||||
import kd.bos.orm.query.QFilter;
 | 
			
		||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
 | 
			
		||||
 | 
			
		||||
import java.util.EventObject;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 产值确认根据组织携带项目信息
 | 
			
		||||
 */
 | 
			
		||||
public class WorkloadProjectFormPlugin extends AbstractBillPlugIn {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void afterBindData(EventObject e) {
 | 
			
		||||
        super.afterBindData(e);
 | 
			
		||||
        //根据组织携带项目
 | 
			
		||||
        updateRenovationProject();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void updateRenovationProject() {
 | 
			
		||||
        DynamicObject org = (DynamicObject) this.getModel().getValue("org");
 | 
			
		||||
 | 
			
		||||
        // 只有在需求组织不为空的情况下才进行查询
 | 
			
		||||
        if (org != null) {
 | 
			
		||||
            setRenovationProjectByOrg(org);
 | 
			
		||||
        } else {
 | 
			
		||||
            // 组织为空,清空项目
 | 
			
		||||
            this.getModel().setValue("project", null);
 | 
			
		||||
            this.getView().updateView("project");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void setRenovationProjectByOrg(DynamicObject org) {
 | 
			
		||||
        // 采购项目
 | 
			
		||||
        DynamicObject[] projectbills = BusinessDataServiceHelper.load("rebm_purproject", "id",
 | 
			
		||||
                new QFilter[]{new QFilter("org.id", QCP.equals, org.getPkValue())});
 | 
			
		||||
 | 
			
		||||
        DynamicObject projectbill = null;
 | 
			
		||||
 | 
			
		||||
        if (projectbills.length > 0) {
 | 
			
		||||
            DynamicObject projectbill1 = projectbills[0];
 | 
			
		||||
            if (projectbill1 != null) {
 | 
			
		||||
                //项目建立F7
 | 
			
		||||
                DynamicObject add = BusinessDataServiceHelper.loadSingle("repmd_project_f7",
 | 
			
		||||
                        new QFilter[]{new QFilter("number", QCP.equals, projectbill1.getString("number"))});
 | 
			
		||||
                if (add != null) {
 | 
			
		||||
                    projectbill = add;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            DynamicObject add = BusinessDataServiceHelper.loadSingle("repmd_project_f7",
 | 
			
		||||
                    new QFilter[]{new QFilter("number", QCP.equals, "XM-202412-008")});
 | 
			
		||||
            if (add != null) {
 | 
			
		||||
                projectbill = add;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // 设置项目并更新视图
 | 
			
		||||
        this.getModel().setValue("project", projectbill);
 | 
			
		||||
        this.getView().updateView("project");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue