diff --git a/main/java/shkd/repc/recos/formplugin/RecosMeasurecosFormPlugin.java b/main/java/shkd/repc/recos/formplugin/RecosMeasurecosFormPlugin.java index 4c1d606..b11983e 100644 --- a/main/java/shkd/repc/recos/formplugin/RecosMeasurecosFormPlugin.java +++ b/main/java/shkd/repc/recos/formplugin/RecosMeasurecosFormPlugin.java @@ -2,6 +2,11 @@ package shkd.repc.recos.formplugin; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.dataentity.serialization.SerializationUtils; +import kd.bos.dataentity.utils.StringUtils; +import kd.bos.entity.datamodel.IDataModel; +import kd.bos.entity.plugin.Plugin; +import kd.bos.form.FormShowParameter; import kd.bos.form.IFormView; import kd.bos.form.control.AttachmentPanel; import kd.bos.form.control.events.UploadListener; @@ -9,6 +14,7 @@ import kd.bos.form.events.AfterDoOperationEventArgs; import kd.bos.form.events.BeforeDoOperationEventArgs; import kd.bos.form.operate.FormOperate; import kd.bos.form.plugin.AbstractFormPlugin; +import kd.bos.mvc.SessionManager; import kd.bos.mvc.bill.BillView; import kd.bos.orm.query.QCP; import kd.bos.orm.query.QFilter; @@ -17,11 +23,16 @@ import kd.bos.servicehelper.AttachmentServiceHelper; import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.QueryServiceHelper; import kd.bos.servicehelper.operation.SaveServiceHelper; +import kd.repc.rebas.common.util.ReDigitalUtil; +import kd.repc.recos.business.measure.ReMeasureIdxUtil; +import kd.repc.recos.formplugin.measure.base.ReMeasureEditTplPlugin; +import kd.repc.recos.formplugin.measure.measureci.ReMeasureCIEditPlugin; import org.apache.poi.ss.usermodel.*; import shkd.repc.recos.domain.Calculation; import java.io.FileInputStream; import java.io.IOException; +import java.math.BigDecimal; import java.util.*; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -43,9 +54,7 @@ public class RecosMeasurecosFormPlugin extends AbstractFormPlugin implements Upl FormOperate source = (FormOperate) args.getSource(); String operateKey = source.getOperateKey(); switch (operateKey){ - case "qeug_test": - Long id = (Long) this.getModel().getValue("id");//获取单据id - + case "qeug_in": Map result = new HashMap<>(); //获取不同楼对应标签得pageid Map all = this.getPageCache().getAll(); @@ -67,8 +76,10 @@ public class RecosMeasurecosFormPlugin extends AbstractFormPlugin implements Upl } Object attPkId = att.getAttachmentData().get(0).get("attPkId"); if (null == attPkId) { - attPk = false; - this.getView().invokeOperation("save");//调用保存 +// attPk = false; +// this.getView().invokeOperation("save");//调用保存 + this.getView().showSuccessNotification("请先保存"); + return; } AttachmentPanel attachmentpanelap = this.getView().getControl("attachmentpanelap"); @@ -123,17 +134,6 @@ public class RecosMeasurecosFormPlugin extends AbstractFormPlugin implements Upl } } - @Override - public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) { - super.afterDoOperation(afterDoOperationEventArgs); - String operateKey = afterDoOperationEventArgs.getOperateKey(); - if ("save".equals(operateKey)&&afterDoOperationEventArgs.getOperationResult().isSuccess()){ - if (!attPk){//附件功能调用的保存取消提示 - afterDoOperationEventArgs.getOperationResult().setShowMessage(false); - attPk = true; - } - } - } /* * 根据入参信息修改成本测算方法 @@ -149,6 +149,23 @@ public class RecosMeasurecosFormPlugin extends AbstractFormPlugin implements Upl DynamicObject dataEntity = sheetNameView.getModel().getDataEntity(true); DynamicObjectCollection cientry = dataEntity.getDynamicObjectCollection("cientry"); + + ///bug测试 + Long measureTargetId = sheetNameView.getModel().getDataEntity().getLong("measuretargetid"); + DynamicObject measureTarget = getMeasureTarget(measureTargetId,sheetNameView); + DynamicObject measureIndex = getMeasureIndex(sheetNameView.getFormShowParameter(),sheetNameView); + if (null == measureIndex) { + } else { + DynamicObject product = measureTarget.getDynamicObject("entry_producttype"); + if (product == null) { + } else { + Map indexValueMap = ReMeasureIdxUtil.getMeasureTargetIndexValue(measureTarget, measureIndex); + sheetNameView.getPageCache().put("entry_planidxvalue", SerializationUtils.toJsonString(indexValueMap)); + } + } + /// + + Map hashMap = new HashMap<>();//存储修改的数据和下标 for (DynamicObject dynamicObject : cientry) { if (numberStrings.contains(dynamicObject.getString("entry_longnumber"))){ @@ -183,4 +200,39 @@ public class RecosMeasurecosFormPlugin extends AbstractFormPlugin implements Upl //throw new RuntimeException(e); } } + + + public DynamicObject getMeasureTarget(Long measureTargetId,BillView sheetNameView) { + String subFormId = sheetNameView.getParentView().getPageCache().get("tab_measuretarget"); + if (StringUtils.isEmpty(subFormId)) { + return null; + } else { + DynamicObjectCollection targetEntryColl = sheetNameView.getParentView().getView(subFormId).getModel().getDataEntity(true).getDynamicObjectCollection("targetentry"); + return (DynamicObject)targetEntryColl.stream().filter((obj) -> { + return obj.getPkValue().equals(measureTargetId); + }).findFirst().get(); + } + } + + public DynamicObject getMeasureIndex(FormShowParameter parameter,BillView sheetNameView) { + IFormView view = getSubView(parameter, "tab_measureidx",sheetNameView); + if (null == view) { + return null; + } else { + IDataModel iDataModel = view.getModel(); + return !iDataModel.isDataLoaded() ? null : iDataModel.getDataEntity(true); + } + } + + public IFormView getSubView(FormShowParameter parameter, String tabKey,BillView sheetNameView) { + IFormView view = sheetNameView; + if (null == view) { + view = SessionManager.getCurrent().getView(parameter.getParentPageId()); + } else { + view = view.getParentView(); + } + + String targetFormId = view.getPageCache().get(tabKey); + return StringUtils.isEmpty(targetFormId) ? null : view.getView(targetFormId); + } }