diff --git a/main/java/shkd/repc/recon/formplugin/ContractFormPlugin.java b/main/java/shkd/repc/recon/formplugin/ContractFormPlugin.java index 519de82..f44e87a 100644 --- a/main/java/shkd/repc/recon/formplugin/ContractFormPlugin.java +++ b/main/java/shkd/repc/recon/formplugin/ContractFormPlugin.java @@ -165,9 +165,9 @@ public class ContractFormPlugin extends AbstractFormPlugin implements UploadLis if ("qeug_attachmentpanelap".equals(key)) { boolean b = deleteList(); - if (b) { - this.getView().showSuccessNotification("已同步删除明细数据"); - } +// if (b) { +//// this.getView().showSuccessNotification("已同步删除明细数据"); +// } } } /** @@ -199,10 +199,13 @@ public class ContractFormPlugin extends AbstractFormPlugin implements UploadLis } } } - + int size = qeug_invoiceentryinfos.size(); //删除单据体数据 - qeug_invoiceentryinfos.clear(); - SaveServiceHelper.save(new DynamicObject[]{this.getModel().getDataEntity()}); + for (int i = 0; i < size; i++) { + this.getView().getModel().deleteEntryRow("qeug_invoiceentryinfo",0); + } +// SaveServiceHelper.save(new DynamicObject[]{this.getModel().getDataEntity(true)}); + this.getView().invokeOperation("save"); // 删除完成之后刷新界面 this.getView().invokeOperation("refresh"); return result; @@ -269,7 +272,7 @@ public class ContractFormPlugin extends AbstractFormPlugin implements UploadLis // return; this.getView().invokeOperation("save");//调用保存 } - List> attachmentes = AttachmentServiceHelper.getAttachments("recon_contractbill", this.getModel().getValue("id"), "qeug_attachmentpanelap"); + List> attachmentes = AttachmentServiceHelper.getAttachments(billtype, this.getModel().getValue("id"), "qeug_attachmentpanelap"); for (Map attachment : attachmentes) { String url = attachment.get("url").toString(); try { @@ -365,15 +368,25 @@ public class ContractFormPlugin extends AbstractFormPlugin implements UploadLis break; case 10: if (StringUtils.isNotEmpty(cell.toString())) { - contractsummarylist.set("qeug_artificial",BigDecimal.valueOf(Double.parseDouble(cell.toString())));//人工费 + contractsummarylist.set("qeug_artificial",BigDecimal.valueOf(Double.parseDouble(cell.toString())));//人工单价 } break; case 12: if (StringUtils.isNotEmpty(cell.toString())) { - contractsummarylist.set("qeug_provisional",BigDecimal.valueOf(Double.parseDouble(cell.toString())));//材料及工程设备暂估价 + contractsummarylist.set("qeug_provisional",BigDecimal.valueOf(Double.parseDouble(cell.toString())));//辅材单价 } break; case 13: + if (StringUtils.isNotEmpty(cell.toString())) { + contractsummarylist.set("qeug_unitpriceofmainmater",BigDecimal.valueOf(Double.parseDouble(cell.toString())));//主材单价 + } + break; + case 14: + if (StringUtils.isNotEmpty(cell.toString())) { + contractsummarylist.set("qeug_mechanicalunitprice",BigDecimal.valueOf(Double.parseDouble(cell.toString())));//机械,设备单价 + } + break; + case 15: if (StringUtils.isNotEmpty(cell.toString())) { contractsummarylist.set("qeug_remarks",cell);//备注 } diff --git a/main/java/shkd/repc/recon/formplugin/ReconPayreqFormPlugin.java b/main/java/shkd/repc/recon/formplugin/ReconPayreqFormPlugin.java index 3a4ab2d..6012dae 100644 --- a/main/java/shkd/repc/recon/formplugin/ReconPayreqFormPlugin.java +++ b/main/java/shkd/repc/recon/formplugin/ReconPayreqFormPlugin.java @@ -369,7 +369,7 @@ public class ReconPayreqFormPlugin extends AbstractFormPlugin implements BeforeF recon_invoicebill.set("bizdate",qeug_bizdate);//开票日期 // todo----编码规则待维护 //发票编码 - recon_invoicebill.set("billno","测试数据勿删!!");//----编码规则待维护 + recon_invoicebill.set("billno",qeug_invoiceno);//----编码规则待维护,目前与发票号码一致 //付款申请单 payreqentrys DynamicObjectCollection payreqentrys = recon_invoicebill.getDynamicObjectCollection("payreqentrys"); diff --git a/main/java/shkd/repc/recon/formplugin/WorkloadcfmbillFormPlugin.java b/main/java/shkd/repc/recon/formplugin/WorkloadcfmbillFormPlugin.java index 07077b0..484ecc8 100644 --- a/main/java/shkd/repc/recon/formplugin/WorkloadcfmbillFormPlugin.java +++ b/main/java/shkd/repc/recon/formplugin/WorkloadcfmbillFormPlugin.java @@ -61,36 +61,54 @@ public class WorkloadcfmbillFormPlugin extends AbstractFormPlugin implements Tab getListShowParamer(this.getView(), this.getModel(),String.valueOf(id)); break; case "audit": - //产值确认--清单明细 - DynamicObjectCollection invoiceentryinfos = this.getModel().getDataEntity(true).getDynamicObjectCollection("qeug_invoiceentryinfo"); - //产值确认审核时,将所有明细的完成百分比覆盖掉合同看的清单 - for (DynamicObject invoiceentryinfo : invoiceentryinfos) { - QFilter q3 = new QFilter("qeug_sheetname", QCP.equals, invoiceentryinfo.getString("qeug_summarycontent")); - QFilter q4 = new QFilter("qeug_contractid",QCP.equals, String.valueOf(id)); - QFilter q5 = new QFilter("qeug_workloadcfmid",QCP.equals, String.valueOf(this.getModel().getDataEntity().getPkValue())); - DynamicObject[] recon_contractbills = BusinessDataServiceHelper.load("qeug_contractsummarylist", - "id,qeug_seq,qeug_seqs,qeug_projectnumber,qeug_projectname,qeug_featuredescript,qeug_engincontent," + - "qeug_unit,qeug_decimalqty,qeug_unitprice,qeug_amounttotal,qeug_artificial,qeug_provisional," + - "qeug_remarks,qeug_contractid,qeug_sheetname,qeug_cumulativepreofpro", new QFilter[]{q3,q4,q5}); - if (recon_contractbills.length > 0) { - for (int i = 0; i < recon_contractbills.length; i++) { - DynamicObject contractsummarylist = recon_contractbills[i]; - QFilter q6 = new QFilter("qeug_workloadcfmid",QCP.equals, "");//未作产值确认时的清单 - QFilter q7 = new QFilter("qeug_seqs",QCP.equals, contractsummarylist.getBigDecimal("qeug_seqs"));//项目编码 - DynamicObject add = BusinessDataServiceHelper.loadSingle("qeug_contractsummarylist", new QFilter[]{q3, q4, q6, q7}); - if (null != add) { - add.set("qeug_cumulativepreofpro",contractsummarylist.getBigDecimal("qeug_cumulativepreofpro"));//累计进度百分比(%) - SaveServiceHelper.save(new DynamicObject[]{add}); - } - } - } - } + updateCumulativeProgress("audit",id); + break; + case "unaudit": + updateCumulativeProgress("unaudit",id); break; default: break; } } + private void updateCumulativeProgress(String operation,long id) { + // 产值确认--清单明细 + DynamicObjectCollection invoiceEntryInfos = this.getModel().getDataEntity(true).getDynamicObjectCollection("qeug_invoiceentryinfo"); + + for (DynamicObject invoiceEntryInfo : invoiceEntryInfos) { + QFilter qSheetName = new QFilter("qeug_sheetname", QCP.equals, invoiceEntryInfo.getString("qeug_summarycontent")); + QFilter qContractId = new QFilter("qeug_contractid", QCP.equals, String.valueOf(id)); + QFilter qWorkloadCfmId = new QFilter("qeug_workloadcfmid", QCP.equals, String.valueOf(this.getModel().getDataEntity().getPkValue())); + + DynamicObject[] contractBills = BusinessDataServiceHelper.load("qeug_contractsummarylist", + "id,qeug_seq,qeug_seqs,qeug_projectnumber,qeug_projectname,qeug_featuredescript,qeug_engincontent," + + "qeug_unit,qeug_decimalqty,qeug_unitprice,qeug_amounttotal,qeug_artificial,qeug_provisional," + + "qeug_remarks,qeug_contractid,qeug_sheetname,qeug_cumulativepreofpro,qeug_thisprogress", + new QFilter[]{qSheetName, qContractId, qWorkloadCfmId}); + + for (DynamicObject contractSummary : contractBills) { + QFilter qNoConfirm = new QFilter("qeug_workloadcfmid", QCP.equals, ""); // 未作产值确认时的清单 + QFilter qSeqs = new QFilter("qeug_seqs", QCP.equals, contractSummary.getBigDecimal("qeug_seqs")); // 项目编码 + + DynamicObject add = BusinessDataServiceHelper.loadSingle("qeug_contractsummarylist", new QFilter[]{qSheetName, qContractId, qNoConfirm, qSeqs}); + + if (add != null) { + BigDecimal cumulativeProgress = add.getBigDecimal("qeug_cumulativepreofpro"); // 累计进度百分比 + BigDecimal thisProgress = contractSummary.getBigDecimal("qeug_thisprogress"); // 本次进度百分比(%) + + if ("audit".equals(operation)) { + cumulativeProgress = cumulativeProgress.add(thisProgress); // 累加 + } else if ("unaudit".equals(operation)) { + cumulativeProgress = cumulativeProgress.subtract(thisProgress); // 减去 + } + + add.set("qeug_cumulativepreofpro", cumulativeProgress); // 更新累计进度百分比(%) + SaveServiceHelper.save(new DynamicObject[]{add}); + } + } + } + } + /** * 打开列表展示清单详情页 * @param formView 页面 @@ -165,7 +183,8 @@ public class WorkloadcfmbillFormPlugin extends AbstractFormPlugin implements Tab DynamicObject[] recon_contractbills = BusinessDataServiceHelper.load("qeug_contractsummarylist", "id,qeug_seqs,qeug_projectnumber,qeug_projectname,qeug_featuredescript,qeug_engincontent," + "qeug_unit,qeug_decimalqty,qeug_unitprice,qeug_amounttotal,qeug_artificial,qeug_provisional," + - "qeug_remarks,qeug_contractid,qeug_sheetname,qeug_cumulativepreofpro", new QFilter[]{q3,q4,q5}); + "qeug_remarks,qeug_contractid,qeug_sheetname,qeug_cumulativepreofpro,qeug_mechanicalunitprice," + + "qeug_unitpriceofmainmater", new QFilter[]{q3,q4,q5}); if (recon_contractbills.length > 0) { for (int i = 0; i < recon_contractbills.length; i++) { DynamicObject contractsummarylist = recon_contractbills[i]; @@ -181,6 +200,8 @@ public class WorkloadcfmbillFormPlugin extends AbstractFormPlugin implements Tab add.set("qeug_amounttotal", contractsummarylist.getBigDecimal("qeug_amounttotal")); add.set("qeug_artificial", contractsummarylist.getBigDecimal("qeug_artificial")); add.set("qeug_provisional", contractsummarylist.getBigDecimal("qeug_provisional")); + add.set("qeug_unitpriceofmainmater", contractsummarylist.getBigDecimal("qeug_unitpriceofmainmater")); + add.set("qeug_mechanicalunitprice", contractsummarylist.getBigDecimal("qeug_mechanicalunitprice")); add.set("qeug_remarks", contractsummarylist.getString("qeug_remarks")); add.set("qeug_contractid", contractsummarylist.getString("qeug_contractid")); add.set("qeug_sheetname", contractsummarylist.getString("qeug_sheetname")); diff --git a/main/java/shkd/repc/recon/opplugin/IntroduceContractPlugin.java b/main/java/shkd/repc/recon/opplugin/IntroduceContractPlugin.java index 5f43837..053daa8 100644 --- a/main/java/shkd/repc/recon/opplugin/IntroduceContractPlugin.java +++ b/main/java/shkd/repc/recon/opplugin/IntroduceContractPlugin.java @@ -45,8 +45,9 @@ public class IntroduceContractPlugin extends BatchImportPlugin { bd3 = new BigDecimal(qeug_cumulativepreofpro); } BigDecimal bd4 = bd2.subtract(bd3); + data.put("qeug_thisprogress",bd4);//本次进度百分比(%) BigDecimal result = bd1.multiply(bd4).multiply(BigDecimal.valueOf(0.01)); - data.put("qeug_bcdecimalqtys",result); + data.put("qeug_bcdecimalqtys",result);//本次完工量 if (StringUtils.isNotEmpty(qeug_preofpro)) { preofpro = new BigDecimal(qeug_preofpro); } diff --git a/main/java/shkd/repc/resm/formplugin/ContractListDateFilterPlugin.java b/main/java/shkd/repc/resm/formplugin/ContractListDateFilterPlugin.java index a24289d..dcc1a5b 100644 --- a/main/java/shkd/repc/resm/formplugin/ContractListDateFilterPlugin.java +++ b/main/java/shkd/repc/resm/formplugin/ContractListDateFilterPlugin.java @@ -8,6 +8,8 @@ import kd.bos.dataentity.resource.ResManager; import kd.bos.dataentity.utils.StringUtils; import kd.bos.entity.EntityMetadataCache; import kd.bos.entity.datamodel.IDataModel; +import kd.bos.entity.datamodel.events.ChangeData; +import kd.bos.entity.datamodel.events.PropertyChangedArgs; import kd.bos.form.container.Tab; import kd.bos.form.control.Control; import kd.bos.orm.query.QCP; @@ -102,48 +104,80 @@ public class ContractListDateFilterPlugin extends AbstractBillPlugIn implements if (contractEntries.isEmpty()) { this.getView().showTipNotification(ResManager.loadKDString("没有符合条件的合同,请检查。", "EvalPlanEdit_13", "repc-resm-formplugin", new Object[0])); - Tab tabap = (Tab)this.getView().getControl("tabap"); + Tab tabap = (Tab) this.getView().getControl("tabap"); tabap.activeTab("tab_info"); - return; } + } + } - for (int i = 0; i < contractEntries.size(); i++) { - DynamicObject contractEntry = contractEntries.get(i); - DynamicObject eyContract = contractEntry.getDynamicObject("ey_contract"); - if (eyContract != null) { - DynamicObject contract = BusinessDataServiceHelper.loadSingle(eyContract.getPkValue(), "resm_contract_book", "id,sign_date,contract,ismaincontract,maincontract"); - Date signDate = contract.getDate("sign_date");// 签约日期 - Calendar calendar = Calendar.getInstance(); - calendar.setTime(signDate); - calendar.set(Calendar.HOUR_OF_DAY, 0); - calendar.set(Calendar.MINUTE, 0); - calendar.set(Calendar.SECOND, 0); - calendar.set(Calendar.MILLISECOND, 0); - signDate = calendar.getTime(); - model.setValue("qeug_sign_date", signDate, i); + @Override + public void propertyChanged(PropertyChangedArgs e) { + String name = e.getProperty().getName(); + if ("ey_contract".equals(name)) { + IDataModel model = this.getModel(); + ChangeData changeData = e.getChangeSet()[0]; + int rowIndex = changeData.getRowIndex(); + DynamicObject eyContract = (DynamicObject) model.getValue("ey_contract", rowIndex); - String evalTypeNum = contractEntry.getString("ey_eval_type.number");// 评估类型 - if (!"007".equals(evalTypeNum)) continue; + if (eyContract == null) { + model.setValue("qeug_sign_date", null, rowIndex); + model.setValue("qeug_bizdate", null, rowIndex); + } else { + DynamicObject contract = BusinessDataServiceHelper.loadSingle(eyContract.getPkValue(), "resm_contract_book", "id,sign_date,contract,ismaincontract,maincontract,bizstatus"); + Date signDate = contract.getDate("sign_date");// 签约日期 + Calendar calendar = Calendar.getInstance(); + calendar.setTime(signDate); + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 0); + signDate = calendar.getTime(); + model.setValue("qeug_sign_date", signDate, rowIndex); - DynamicObject contractSettle; - boolean isMainContract = contract.getBoolean("ismaincontract"); - DynamicObject mainContract = contract.getDynamicObject("maincontract");// 关联主合同 - if (!isMainContract && mainContract != null) { - mainContract = BusinessDataServiceHelper.loadSingle(mainContract.getPkValue(), "resm_contract_book", "id,sign_date,contract"); - Long contractId = mainContract.getLong("contract"); - QFilter idQF = new QFilter("contractbill", QCP.equals, contractId); - contractSettle = BusinessDataServiceHelper.loadSingle("recon_consettlebill", "id,bizdate", idQF.toArray());// 合同结算 - } else { - Long contractId = contract.getLong("contract"); - QFilter idQF = new QFilter("contractbill", QCP.equals, contractId); - contractSettle = BusinessDataServiceHelper.loadSingle("recon_consettlebill", "id,bizdate", idQF.toArray());// 合同结算 - } - if (contractSettle != null) { - Date bizDate = contractSettle.getDate("bizdate");// 结算日期 - model.setValue("qeug_bizdate", bizDate, i); - } + String evalType = ""; + List evalTypeList = this.getEvalTypeByContract(contract); + if (!evalTypeList.isEmpty()) { + DynamicObject dynamicObject = evalTypeList.get(0); + if (dynamicObject != null) evalType = dynamicObject.getString("number"); + } + + if (!"007".equals(evalType)) return; + + DynamicObject contractSettle; + boolean isMainContract = contract.getBoolean("ismaincontract"); + DynamicObject mainContract = contract.getDynamicObject("maincontract");// 关联主合同 + if (!isMainContract && mainContract != null) { + mainContract = BusinessDataServiceHelper.loadSingle(mainContract.getPkValue(), "resm_contract_book", "id,sign_date,contract"); + Long contractId = mainContract.getLong("contract"); + QFilter idQF = new QFilter("contractbill", QCP.equals, contractId); + contractSettle = BusinessDataServiceHelper.loadSingle("recon_consettlebill", "id,bizdate", idQF.toArray());// 合同结算 + } else { + Long contractId = contract.getLong("contract"); + QFilter idQF = new QFilter("contractbill", QCP.equals, contractId); + contractSettle = BusinessDataServiceHelper.loadSingle("recon_consettlebill", "id,bizdate", idQF.toArray());// 合同结算 + } + if (contractSettle != null) { + Date bizDate = contractSettle.getDate("bizdate");// 结算日期 + model.setValue("qeug_bizdate", bizDate, rowIndex); } } } } + + protected List getEvalTypeByContract(DynamicObject contract) { + String bizStatus = contract.getString("bizstatus"); + QFilter qFilter = new QFilter("enable", "=", true); + qFilter.and("stage", "=", "2"); + DynamicObject[] evalTypeArr = BusinessDataServiceHelper.load("resm_evaltype", "stage,bizstatus", qFilter.toArray(), "number"); + List evalTypeList = (List)Arrays.stream(evalTypeArr).filter((item) -> { + return item.getString("bizstatus").contains(bizStatus); + }).collect(Collectors.toList()); + if (evalTypeList.isEmpty()) { + evalTypeList = (List)Arrays.stream(evalTypeArr).filter((item) -> { + return StringUtils.isEmpty(item.getString("bizstatus")); + }).collect(Collectors.toList()); + } + + return evalTypeList; + } } \ No newline at end of file diff --git a/main/java/shkd/repc/task/DobeDWprojectTask.java b/main/java/shkd/repc/task/DobeDWprojectTask.java index eb69a60..4e60509 100644 --- a/main/java/shkd/repc/task/DobeDWprojectTask.java +++ b/main/java/shkd/repc/task/DobeDWprojectTask.java @@ -104,7 +104,7 @@ public class DobeDWprojectTask extends AbstractTask implements Plugin { project_getdate = json_body.getDate("project_getdate"); project_stage = json_body.getString("project_stage"); fdwid = json_body.getString("project_id"); - if(DobeDWUtils.isEmpty(fbillno) || DobeDWUtils.isEmpty(fbillname) || DobeDWUtils.isEmpty(forgid) || DobeDWUtils.isEmpty(fdwid)){ + if(DobeDWUtils.isEmpty(fbillno) || DobeDWUtils.isEmpty(fbillname) || DobeDWUtils.isEmpty(fdwid)){ log.info(String.format("项目接口入参为空异常:%s", json_body.toJSONString())); continue; } @@ -118,6 +118,8 @@ public class DobeDWprojectTask extends AbstractTask implements Plugin { continue; } //已存在,做更新 名称 阶段 版本号等信息;组织、编号、是否叶子节点不能更新;需要前台操作 + projectinfo.set("billno", fbillno); + projectinfo.set("longnumber", fbillno);//长编码 projectinfo.set("billname", fbillname); projectinfo.set("fullname", fbillname);//项目全称 // if(projectstageinfo != null){ @@ -126,9 +128,9 @@ public class DobeDWprojectTask extends AbstractTask implements Plugin { projectinfo.set("address", faddress); projectinfo.set("acquiredate", project_getdate); // projectinfo.set("billstatus", "A");//单据状态 A保存 B已提交 C已审核 - projectinfo.set("showflag", true);//是否列表显示 - projectinfo.set("enable", 1);//是否启用 - projectinfo.set("islatestversion", true);//是否最新版 +// projectinfo.set("showflag", true);//是否列表显示 +// projectinfo.set("enable", 1);//是否启用 +// projectinfo.set("islatestversion", true);//是否最新版 projectinfo.set("mainprojectid", projectinfo.getLong("id"));//主项目ID if("新拓园区".equals(project_stage)){ projectinfo.set("qeug_combofield", "xintuo"); @@ -168,7 +170,9 @@ public class DobeDWprojectTask extends AbstractTask implements Plugin { } projectinfo.set("isleaf", true); projectinfo.set("enable", 1);//是否启用 +// projectinfo.set("islatestversion", true);//是否最新版-审核之后系统控制的,不需要在此处设置 projectinfo.set("billstatus", "A");//单据状态 A保存 B已提交 C已审核 + projectinfo.set("versionnum", "V1.0");//版本号 默认值 projectinfo.set("creator", 43007523L);//创建人默认指定为金小蝶 if("新拓园区".equals(project_stage)){ projectinfo.set("qeug_combofield", "xintuo");