// === EIP4 P4 脚本迁移产出 === // template_id : d193b838-f8a3-4d72-9fef-300c7a97d23c // template_name: 劳务分包合同评审(五建定制) // seq : 4 // label : HARD // 硬 S3 原因 : 动态创建 Vaadin Button(无法自动改写形态) // 处置 : 原文保留,进人工排期(amis dialog/service 重写) import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.Notification; import com.vaadin.ui.Notification.Type; import com.dsasp.client.viewframework.util.TableImportExport; def contents = group.getField("CONTENTS"); final Object table = contents?.table; table?.setImmediate(true);//设置验证 def opertor = group.getField("BUTTON"); def vl = opertor?.parent; Button button = new Button("根据分包明细计算合同价款"); vl.addComponent(button,0); button.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { def balancedetails = getFieldValue("CONTENTS"); def sumamount = new BigDecimal("0");; def summoney = new BigDecimal("0");; if(balancedetails != null && balancedetails.size()>0){ balancedetails?.each{ if(it.get('VALENCE') !=null && it.get('VALENCE') !=""){ summoney = summoney.add(new BigDecimal(it.get('VALENCE'))) } } } bindField("CONTRACTMONEY",summoney); } }); def tie = new TableImportExport(contents,"com.dsasp.pm.labourcontract.client.ContentsImport"); tie.addImportButton(2); tie.addExportButton(3); def value = getFieldValue("PM_PROJECTID"); def sql1 = "select coalesce(sum(p.CONTRACTMONEY),0) as TOTALCONTROLCOST from( "; sql1 += "select case when c.pm_plannedcostchange_id is null then coalesce(pp.ARTIFICIALLYPLANNEDCOST,0)"; sql1 += "else coalesce(c.ARTIFICIALLYPLANNEDCOSTNOW,0) end as CONTRACTMONEY "; sql1 += "from PM_PLANNEDCOSTDECLARATION pp "; sql1 += "join SYS_DATASTATUS s on s.businesskey=pp.PM_PLANNEDCOSTDECLARATION_id and s.tablename = 'PM_PLANNEDCOSTDECLARATION'and s.DATASTATUS = 3 "; sql1 += "left join lateral(select PM_PLANNEDCOSTCHANGE_id,ARTIFICIALLYPLANNEDCOSTNOW,PM_PROJECTID "; sql1 += "from PM_PLANNEDCOSTCHANGE p join SYS_DATASTATUS s on s.businesskey=p.PM_PLANNEDCOSTCHANGE_id "; sql1 += "and s.tablename = 'PM_PLANNEDCOSTCHANGE'and s.DATASTATUS = 3 where p.PM_PROJECTID = pp.PM_PROJECTID order by p.CHANGEDATE desc,p.createtime desc limit 1)c on true "; sql1 += "where pp.PM_PROJECTID = '"+value+"')p "; def map1 = GetServicesFunction.executeQueryForMap(sql1); if(map1 != null){ bindField("TOTALCONTROLCOST",map1.get("TOTALCONTROLCOST")); }; def sql2 = "select coalesce(sum(v.CONTRACTMONEY),0) as TOTALCONTRACTMONEY from VIEW_PM_CONTRACT v "; sql2 += "where v.CONTRACTTYPE = 1 and v.PM_PROJECT_ID = '"+value+"' "; def map2 = GetServicesFunction.executeQueryForMap(sql2); if(map2 != null){ bindField("TOTALCONTRACTMONEY",map2.get("TOTALCONTRACTMONEY")); };