Compare commits
	
		
			No commits in common. "0fbeb48387eef17748d9ac56d99e6e7ffe5f49ff" and "188a1e091be370e979740a03ad02d050fd7b380c" have entirely different histories.
		
	
	
		
			0fbeb48387
			...
			188a1e091b
		
	
		| 
						 | 
				
			
			@ -1,77 +0,0 @@
 | 
			
		|||
package shkd.repc.recos.formplugin;
 | 
			
		||||
 | 
			
		||||
import kd.bos.dataentity.entity.DynamicObject;
 | 
			
		||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
 | 
			
		||||
import kd.bos.form.control.EntryGrid;
 | 
			
		||||
import kd.bos.form.events.BeforeDoOperationEventArgs;
 | 
			
		||||
import kd.bos.form.operate.FormOperate;
 | 
			
		||||
import kd.bos.form.plugin.AbstractFormPlugin;
 | 
			
		||||
import kd.bos.orm.query.QCP;
 | 
			
		||||
import kd.bos.orm.query.QFilter;
 | 
			
		||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
 | 
			
		||||
import kd.bos.servicehelper.QueryServiceHelper;
 | 
			
		||||
 | 
			
		||||
import java.math.BigDecimal;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
public class MeasureciFormPlugin extends AbstractFormPlugin {
 | 
			
		||||
    @Override
 | 
			
		||||
    public void beforeDoOperation(BeforeDoOperationEventArgs args) {
 | 
			
		||||
        super.beforeDoOperation(args);
 | 
			
		||||
        FormOperate source = (FormOperate) args.getSource();
 | 
			
		||||
        String operateKey = source.getOperateKey();
 | 
			
		||||
        if ("qeug_tbgcl".equals(operateKey)){
 | 
			
		||||
            Object producttypeid = this.getModel().getValue("producttypeid");//产品类型ID
 | 
			
		||||
            Object measurecostid = this.getModel().getValue("measurecostid");//成本测算ID
 | 
			
		||||
            DynamicObject measurecost = BusinessDataServiceHelper.loadSingle(measurecostid,"recos_measurecost");
 | 
			
		||||
            DynamicObject project = measurecost.getDynamicObject("project");
 | 
			
		||||
            String number = project.getString("number");//项目编码
 | 
			
		||||
            QFilter filter = new QFilter("qeug_cpmc.id", QCP.equals, producttypeid).
 | 
			
		||||
                    and(new QFilter("qeug_xmnumber", QCP.equals, number));
 | 
			
		||||
            DynamicObject queryone = QueryServiceHelper.queryOne("qeug_gcl", "id", filter.toArray());
 | 
			
		||||
            if (queryone==null){
 | 
			
		||||
                this.getView().showSuccessNotification("请维护项目面积数据");
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            Map<String, BigDecimal> result = new HashMap<>();
 | 
			
		||||
            DynamicObject gcl = BusinessDataServiceHelper.loadSingle(queryone.get("id"),"qeug_gcl");
 | 
			
		||||
            DynamicObjectCollection qeug_entryentity = gcl.getDynamicObjectCollection("qeug_entryentity");//面积
 | 
			
		||||
            for (int i = 0; i <qeug_entryentity.size() ; i++) {
 | 
			
		||||
                DynamicObject dynamicObject = qeug_entryentity.get(i);
 | 
			
		||||
                BigDecimal sum = dynamicObject.getBigDecimal("qeug_b2f").
 | 
			
		||||
                        add(dynamicObject.getBigDecimal("qeug_b1f")).
 | 
			
		||||
                        add(dynamicObject.getBigDecimal("qeug_1f")).
 | 
			
		||||
                        add(dynamicObject.getBigDecimal("qeug_2f")).
 | 
			
		||||
                        add(dynamicObject.getBigDecimal("qeug_3f")).
 | 
			
		||||
                        add(dynamicObject.getBigDecimal("qeug_4f")).
 | 
			
		||||
                        add(dynamicObject.getBigDecimal("qeug_5f")).
 | 
			
		||||
                        add(dynamicObject.getBigDecimal("qeug_6f")).
 | 
			
		||||
                        add(dynamicObject.getBigDecimal("qeug_7f")).
 | 
			
		||||
                        add(dynamicObject.getBigDecimal("qeug_8f"));
 | 
			
		||||
                result.put(dynamicObject.getString("qeug_kmname"),sum);
 | 
			
		||||
            }
 | 
			
		||||
            EntryGrid cientry = this.getControl("cientry");
 | 
			
		||||
            int[] selectRows = cientry.getSelectRows();
 | 
			
		||||
            if (selectRows.length==0){
 | 
			
		||||
                this.getView().showSuccessNotification("请选择要同步的行");
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            List<DynamicObject> myList = new ArrayList<>();
 | 
			
		||||
            for (int i = 0; i < selectRows.length; i++) {
 | 
			
		||||
                DynamicObject cientrydata = this.getModel().getEntryRowEntity("cientry", selectRows[i]);
 | 
			
		||||
                myList.add(cientrydata);
 | 
			
		||||
            }
 | 
			
		||||
            result.forEach((key, value) -> {
 | 
			
		||||
                for (DynamicObject dynamicObject : myList) {
 | 
			
		||||
                    if (dynamicObject.getString("entry_accountname").equals(key)){
 | 
			
		||||
                        this.getModel().setValue("entry_workload",value,(int)dynamicObject.get("seq")-1);//工程量
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
            this.getView().showSuccessNotification("功能失败:");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -80,12 +80,7 @@ public class RecosMeasurecosFormPlugin extends AbstractFormPlugin implements Upl
 | 
			
		|||
        for (DynamicObject queryOne : query) {
 | 
			
		||||
            List list=new ArrayList();
 | 
			
		||||
            List listcaption=new ArrayList();
 | 
			
		||||
//            listcaption.add("科目长名称");
 | 
			
		||||
            listcaption.add("一级分类");
 | 
			
		||||
            listcaption.add("二级分类");
 | 
			
		||||
            listcaption.add("三级分类");
 | 
			
		||||
            listcaption.add("四级分类");
 | 
			
		||||
            listcaption.add("五级分类");
 | 
			
		||||
            listcaption.add("科目长名称");
 | 
			
		||||
            listcaption.add("科目编码");
 | 
			
		||||
            listcaption.add("科目名称");
 | 
			
		||||
            listcaption.add("工程量单位");
 | 
			
		||||
| 
						 | 
				
			
			@ -102,20 +97,7 @@ public class RecosMeasurecosFormPlugin extends AbstractFormPlugin implements Upl
 | 
			
		|||
                DynamicObject entry_costaccount = dynamicObject.getDynamicObject("entry_costaccount");//科目
 | 
			
		||||
                if (entry_costaccount.getBoolean("isleaf")){
 | 
			
		||||
                    List listvalue=new ArrayList();
 | 
			
		||||
//                    listvalue.add(entry_costaccount.getString("fullname"));//科目长名称
 | 
			
		||||
                    String fullname = entry_costaccount.getString("fullname");
 | 
			
		||||
                    String[] parts = fullname.split("_");
 | 
			
		||||
                    String[] partsWithoutLast = Arrays.copyOf(parts, parts.length - 1);
 | 
			
		||||
 | 
			
		||||
                    for (int i = 0; i < 5; i++) {
 | 
			
		||||
                        try {
 | 
			
		||||
                            String s = partsWithoutLast[i];
 | 
			
		||||
                            listvalue.add(s);
 | 
			
		||||
                        } catch (Exception e) {
 | 
			
		||||
                            listvalue.add("");
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    listvalue.add(entry_costaccount.getString("fullname"));//科目长名称
 | 
			
		||||
                    listvalue.add(dynamicObject.getString("entry_longnumber"));//科目编码
 | 
			
		||||
                    listvalue.add(dynamicObject.getString("entry_accountname"));//科目名称
 | 
			
		||||
                    DynamicObject entry_workloadunit = dynamicObject.getDynamicObject("entry_workloadunit");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -51,8 +51,7 @@ public class ProjectBillPlugin extends AbstractFormPlugin implements BeforeQuick
 | 
			
		|||
            showParameter.setCustomParam("billno",billno);
 | 
			
		||||
            showParameter.setCustomParam("billname",zh_cn);
 | 
			
		||||
            showParameter.setCustomParam("productentry_producttype",productentry_producttype.getPkValue().toString());
 | 
			
		||||
            showParameter.setCustomParam("operateKey",operateKey);
 | 
			
		||||
 | 
			
		||||
            showParameter.setCustomParam("versionnum",this.getModel().getValue("versionnum"));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,7 +2,6 @@ package shkd.repc.repmd.formplugin;
 | 
			
		|||
 | 
			
		||||
import kd.bos.dataentity.entity.DynamicObject;
 | 
			
		||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
 | 
			
		||||
import kd.bos.entity.datamodel.events.BizDataEventArgs;
 | 
			
		||||
import kd.bos.entity.operate.Save;
 | 
			
		||||
import kd.bos.form.events.AfterDoOperationEventArgs;
 | 
			
		||||
import kd.bos.form.events.BeforeDoOperationEventArgs;
 | 
			
		||||
| 
						 | 
				
			
			@ -15,38 +14,28 @@ import kd.bos.servicehelper.QueryServiceHelper;
 | 
			
		|||
import java.util.EventObject;
 | 
			
		||||
 | 
			
		||||
public class WorkQuantityPlugin extends AbstractFormPlugin {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void createNewData(BizDataEventArgs e) {
 | 
			
		||||
        super.createNewData(e);
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void afterBindData(EventObject e) {
 | 
			
		||||
        super.afterBindData(e);
 | 
			
		||||
        String operateKey = this.getView().getFormShowParameter().getCustomParam("operateKey");
 | 
			
		||||
        if ("工程量".equals(operateKey)){
 | 
			
		||||
            String billno = this.getView().getFormShowParameter().getCustomParam("billno");
 | 
			
		||||
            String billname = this.getView().getFormShowParameter().getCustomParam("billname");
 | 
			
		||||
            String productentry_producttype = this.getView().getFormShowParameter().getCustomParam("productentry_producttype");
 | 
			
		||||
            this.getModel().setValue("qeug_xmnumber",billno);
 | 
			
		||||
            this.getModel().setValue("name",billname);
 | 
			
		||||
            this.getModel().setValue("qeug_cpmc",productentry_producttype);
 | 
			
		||||
        }
 | 
			
		||||
        String billno = this.getView().getFormShowParameter().getCustomParam("billno");
 | 
			
		||||
        String billname = this.getView().getFormShowParameter().getCustomParam("billname");
 | 
			
		||||
        String versionnum = this.getView().getFormShowParameter().getCustomParam("versionnum");
 | 
			
		||||
        String productentry_producttype = this.getView().getFormShowParameter().getCustomParam("productentry_producttype");
 | 
			
		||||
        this.getModel().setValue("qeug_xmnumber",billno);
 | 
			
		||||
        this.getModel().setValue("name",billname);
 | 
			
		||||
        this.getModel().setValue("qeug_cpmc",productentry_producttype);
 | 
			
		||||
        this.getModel().setValue("qeug_bbh",versionnum);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void beforeDoOperation(BeforeDoOperationEventArgs args) {
 | 
			
		||||
        if (args.getSource() instanceof Save){
 | 
			
		||||
            String qeug_xmnumber = (String) this.getModel().getValue("qeug_xmnumber");
 | 
			
		||||
            DynamicObject qeug_cpmc = (DynamicObject) this.getModel().getValue("qeug_cpmc");
 | 
			
		||||
            Object pkValue = qeug_cpmc.getPkValue();
 | 
			
		||||
            QFilter filter = new QFilter("qeug_xmnumber", QCP.equals, qeug_xmnumber)
 | 
			
		||||
                    .and(new QFilter("qeug_cpmc.id", QCP.equals, pkValue));
 | 
			
		||||
            String qeug_bbh = (String) this.getModel().getValue("qeug_bbh");
 | 
			
		||||
            QFilter filter = new QFilter("qeug_xmnumber", QCP.equals, qeug_xmnumber).and(new QFilter("qeug_bbh", QCP.equals, qeug_bbh));
 | 
			
		||||
            DynamicObjectCollection query = QueryServiceHelper.query("qeug_gcl", "id", filter.toArray());
 | 
			
		||||
            if (query.size()!=0){
 | 
			
		||||
                this.getView().showSuccessNotification("已存在此项目,不允许保存");
 | 
			
		||||
                this.getView().showSuccessNotification("已存在当前版本号的项目数据,不允许保存");
 | 
			
		||||
                args.setCancel(true);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue