diff --git a/lc123/cloud/app/plugin/form/pm/PurSuggestRptFromPlugin.java b/lc123/cloud/app/plugin/form/pm/PurSuggestRptFromPlugin.java index 1f5321c..0e43d9a 100644 --- a/lc123/cloud/app/plugin/form/pm/PurSuggestRptFromPlugin.java +++ b/lc123/cloud/app/plugin/form/pm/PurSuggestRptFromPlugin.java @@ -343,9 +343,9 @@ public class PurSuggestRptFromPlugin extends AbstractFormPlugin implements Plugi entry.set("tqq9_bjsaledates", next.get("tqq9_bjsaledates"));//预计销售时间(北京) entry.set("tqq9_gzsaledates", next.get("tqq9_gzsaledates"));//预计销售时间(广州) entry.set("tqq9_cdsaledates", next.get("tqq9_cdsaledates"));//预计销售时间(成都) - if(next.getBigDecimal("tqq9_saledates").compareTo(BigDecimal.ZERO)==0){ + if (next.getBigDecimal("tqq9_saledates").compareTo(BigDecimal.ZERO) == 0) { entry.set("tqq9_saledates", -1);//预计销售时间 - }else{ + } else { entry.set("tqq9_saledates", next.get("tqq9_saledates"));//预计销售时间 } entry.set("tqq9_remark", next.get("tqq9_remark"));//备货状态 @@ -370,36 +370,59 @@ public class PurSuggestRptFromPlugin extends AbstractFormPlugin implements Plugi } getModel().setValue("tqq9_pursuggestrptentry", entryentity); getModel().setValue("tqq9_queryqty", sizeStr); - SaveServiceHelper.save( new DynamicObject[]{dataEntity}); + SaveServiceHelper.save(new DynamicObject[]{dataEntity}); this.getView().updateView(); } else if (StringUtils.equals("tqq9_purapply", itemKey)) { DynamicObjectCollection tqq9_pursuggestrptentry = dataEntity.getDynamicObjectCollection("tqq9_pursuggestrptentry"); - DynamicObject dynamicObject = tqq9_pursuggestrptentry.get(0); - DynamicObject tqq9_org = dynamicObject.getDynamicObject("tqq9_org"); - if (tqq9_org == null) { - this.getView().showMessage("请先进行查询操作"); - return; + if (tqq9_pursuggestrptentry.size() != 0 && tqq9_pursuggestrptentry != null) { + DynamicObject dynamicObject = tqq9_pursuggestrptentry.get(0); + DynamicObject tqq9_org = dynamicObject.getDynamicObject("tqq9_org"); + if (tqq9_org == null) { + this.getView().showMessage("请先进行查询操作"); + return; + } + BillShowParameter param = new BillShowParameter(); + param.setFormId("pm_purapplybill"); + param.setCustomParam("pm_purapplybill", dataEntity);//采购建议报表单号 + param.setCloseCallBack(new CloseCallBack(this, "pm_purapplybill")); + param.getOpenStyle().setShowType(ShowType.Modal); + this.getView().showForm(param); } - BillShowParameter param = new BillShowParameter(); - param.setFormId("pm_purapplybill"); - param.setCustomParam("pm_purapplybill", dataEntity);//采购建议报表单号 - param.setCloseCallBack(new CloseCallBack(this, "pm_purapplybill")); - param.getOpenStyle().setShowType(ShowType.Modal); - this.getView().showForm(param); } else if (StringUtils.equals("tqq9_pushcgdd", itemKey)) { DynamicObjectCollection tqq9_pursuggestrptentry = dataEntity.getDynamicObjectCollection("tqq9_pursuggestrptentry"); - DynamicObject dynamicObject = tqq9_pursuggestrptentry.get(0); - DynamicObject tqq9_org = dynamicObject.getDynamicObject("tqq9_org"); - if (tqq9_org == null) { - this.getView().showMessage("请先进行查询操作"); - return; + if (tqq9_pursuggestrptentry.size() != 0 && tqq9_pursuggestrptentry != null) { + DynamicObject dynamicObject = tqq9_pursuggestrptentry.get(0); + DynamicObject tqq9_org = dynamicObject.getDynamicObject("tqq9_org"); + if (tqq9_org == null) { + this.getView().showMessage("请先进行查询操作"); + return; + } + ArrayList ids = new ArrayList<>(); + for (int i = 0; i < tqq9_pursuggestrptentry.size(); i++) { + Boolean isChange = tqq9_pursuggestrptentry.get(i).getBoolean("tqq9_ischange"); + if (isChange) { + DynamicObject org = tqq9_pursuggestrptentry.get(i).getDynamicObject("tqq9_org"); + ids.add(org.getLong("id")); + } + } + if (ids.size() != 0) { + //判断组织id是否全部一致 + Long id = ids.get(0); + for (int i = 1; i < ids.size(); i++) { + if (!id.equals(ids.get(i))) { + this.getView().showErrorNotification("请选择业务归属一致的明细行"); + return; + } + } + } + BillShowParameter param = new BillShowParameter(); + param.setFormId("pm_purorderbill"); + param.setCustomParam("pm_purorderbill", dataEntity);//采购订单号 + param.setCloseCallBack(new CloseCallBack(this, "pm_purorderbill")); + param.getOpenStyle().setShowType(ShowType.Modal); + this.getView().showForm(param); } - BillShowParameter param = new BillShowParameter(); - param.setFormId("pm_purorderbill"); - param.setCustomParam("pm_purorderbill", dataEntity);//采购订单号 - param.setCloseCallBack(new CloseCallBack(this, "pm_purorderbill")); - param.getOpenStyle().setShowType(ShowType.Modal); - this.getView().showForm(param); + }