From cc363d3e8d5867f6ae664aa69dba3f2eec30e052 Mon Sep 17 00:00:00 2001 From: ljw Date: Fri, 20 Sep 2024 15:05:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E8=AF=A2=E4=BB=B7=E5=8D=95=E8=BF=87?= =?UTF-8?q?=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../im/inquirylist/form/InquirylistEdit.java | 101 +++++++++++++++--- 1 file changed, 85 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/yem/wm/im/inquirylist/form/InquirylistEdit.java b/src/main/java/com/yem/wm/im/inquirylist/form/InquirylistEdit.java index 05adba72..0fb6dffe 100644 --- a/src/main/java/com/yem/wm/im/inquirylist/form/InquirylistEdit.java +++ b/src/main/java/com/yem/wm/im/inquirylist/form/InquirylistEdit.java @@ -9,7 +9,9 @@ import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.entity.datamodel.IDataModel; import kd.bos.entity.datamodel.events.PropertyChangedArgs; import kd.bos.entity.operate.result.OperationResult; +import kd.bos.form.FormShowParameter; import kd.bos.form.IFormView; +import kd.bos.form.ShowType; import kd.bos.form.control.EntryGrid; import kd.bos.form.events.AfterDoOperationEventArgs; import kd.bos.form.field.BasedataEdit; @@ -21,10 +23,7 @@ import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Date; -import java.util.EventObject; -import java.util.List; +import java.util.*; /** * @author power @@ -45,13 +44,13 @@ public class InquirylistEdit extends AbstractBillPlugIn implements BeforeF7Selec OperationResult operationResult = e.getOperationResult(); switch (operateKey) { case "optionaloperation": - FunctionalCommon.optionalOperation(model, view, "yem_optional", "optionaloperation"); + optionalOperation(model, view, "yem_optional", "optionaloperation"); break; case "replaceoperation": - FunctionalCommon.optionalOperation(model, view, "yem_replace", "replaceoperation"); + optionalOperation(model, view, "yem_replace", "replaceoperation"); break; case "retrofittingoperation": - FunctionalCommon.optionalOperation(model, view, "yem_retrofitting", "retrofittingoperation"); + optionalOperation(model, view, "yem_retrofitting", "retrofittingoperation"); break; // case "submit": //// if (YEM.isNotEmpty(operationResult)) { @@ -66,6 +65,76 @@ public class InquirylistEdit extends AbstractBillPlugIn implements BeforeF7Selec } } + + /** + * @description 选装、替换、加装功能公共方法 + * @author xwudd + * @param[1] model + * @param[2] view + * @param[3] formId 动态表单标识 + * @param[4] operationNumber 服务标识 + * return + * @time 2023/7/27 9:38 + */ + + public static void optionalOperation(IDataModel model, IFormView view, String formId, String operationNumber) { + String name = model.getDataEntity().getDataEntityType().getName(); + int currentRowIndex = -1; + if("yem_es_salesorder".equals(name)||"yem_es_xsalesorder".equals(name)){ + currentRowIndex = model.getEntryCurrentRowIndex("yem_es_materialinfo"); + } + if("yem_im_clientdemand".equals(name) || "yem_im_inquirylist".equals(name)){ + currentRowIndex = model.getEntryCurrentRowIndex("yem_im_detailedinfor"); + } + DynamicObject billType = (DynamicObject) model.getValue("yem_billtype"); + + DynamicObjectCollection yem_im_detailedinfor = model.getEntryEntity("yem_im_detailedinfor"); + for (DynamicObject dynamicObject : yem_im_detailedinfor) { + DynamicObject productModel = (DynamicObject)model.getValue("yem_productmodel",currentRowIndex); + DynamicObject products = dynamicObject.getDynamicObject("yem_productmodel.yem_products"); + DynamicObjectCollection yem_multiconfig = dynamicObject.getDynamicObjectCollection("yem_multiconfig"); + if (yem_multiconfig != null) { + Map map = new HashMap<>(); + List ids = new ArrayList(); +// int multiConfigRows = model.getEntryRowCount("yem_multiconfig"); + for (DynamicObject object : yem_multiconfig) { +// String configurType = (String) model.getValue("yem_configurtype", i); + Long configEntryId = object.getLong("yem_configentryid"); + ids.add(configEntryId); + } + map.put("billTypeNumber", billType.getString("number")); + map.put("products", products.getPkValue()); + map.put("operationNumber", operationNumber); + map.put("type", "B"); + map.put("ids", ids); + map.put("productModel", productModel); + viewForm(formId, map, view); + } + } + } + + + /** + * @description 打开动态表单 + * @author xwudd + * @param[1] formId 表单标识 + * @param[2] map 传参 无参传null + * @param[3] view + * return + * @time 2023/8/29 11:19 + */ + + public static void viewForm(String formId, Map map, IFormView view) { + FormShowParameter formShowParameter = new FormShowParameter(); + formShowParameter.setFormId(formId); + formShowParameter.getOpenStyle().setShowType(ShowType.Modal); + if (YEM.isNotEmpty(map)) { + formShowParameter.setCustomParams(map); + } + view.showForm(formShowParameter); + } + + /** * @param isDisable * @Description 禁用操作 @@ -236,16 +305,16 @@ public class InquirylistEdit extends AbstractBillPlugIn implements BeforeF7Selec DynamicObject yemImDetailedinfor = this.getModel().getEntryEntity("yem_im_detailedinfor").get(rowIndex); DynamicObject yemProductmodel = yemImDetailedinfor.getDynamicObject("yem_productmodel"); BigDecimal yemQingdaounitprice = yemImDetailedinfor.getBigDecimal("yem_qingdaounitprice"); - if (yemQingdaounitprice.compareTo(BigDecimal.ZERO)==0){ + if (yemQingdaounitprice.compareTo(BigDecimal.ZERO) == 0) { return; } - if (yemProductmodel!=null){ + if (yemProductmodel != null) { DynamicObject yemProducts = yemProductmodel.getDynamicObject("yem_products"); - if (yemProducts!=null){ + if (yemProducts != null) { DynamicObject loadSingle = BusinessDataServiceHelper.loadSingle("yem_bd_productstree", "id,number,yem_costdifference" , new QFilter[]{new QFilter("id", QCP.equals, yemProducts.getLong("id"))}); BigDecimal yemCostdifference = loadSingle.getBigDecimal("yem_costdifference"); - this.getModel().setValue("yem_unitprice",yemQingdaounitprice.subtract(yemCostdifference), rowIndex); + this.getModel().setValue("yem_unitprice", yemQingdaounitprice.subtract(yemCostdifference), rowIndex); } } } @@ -254,18 +323,18 @@ public class InquirylistEdit extends AbstractBillPlugIn implements BeforeF7Selec public void afterBindData(EventObject e) { super.afterBindData(e); DynamicObjectCollection yemImDetailedinfor = (DynamicObjectCollection) this.getModel().getValue("yem_im_detailedinfor"); - if (yemImDetailedinfor.size()>0){ + if (yemImDetailedinfor.size() > 0) { List list = new ArrayList<>(); for (int i = 0; i < yemImDetailedinfor.size(); i++) { DynamicObject dynamicObject = yemImDetailedinfor.get(i); BigDecimal yemFobprice = dynamicObject.getBigDecimal("yem_fobprice"); - if (yemFobprice.compareTo(BigDecimal.ZERO)!=0){ + if (yemFobprice.compareTo(BigDecimal.ZERO) != 0) { list.add(i); } } - for (int i = list.size(); i!=0; i--) { - Integer integer = list.get(i-1); - this.getModel().deleteEntryRow("yem_im_detailedinfor",integer); + for (int i = list.size(); i != 0; i--) { + Integer integer = list.get(i - 1); + this.getModel().deleteEntryRow("yem_im_detailedinfor", integer); } } }