|
@@ -254,389 +254,6 @@ public class AcctageForm extends AbstractReportFormPlugin implements HyperLinkCl
|
|
this.getModel().setValue("standard", (Object)"duedate");
|
|
this.getModel().setValue("standard", (Object)"duedate");
|
|
}
|
|
}
|
|
|
|
|
|
- public void afterCreateNewData(final EventObject e) {
|
|
|
|
- super.afterCreateNewData(e);
|
|
|
|
- this.resetFilterGrid();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void resetFilterGrid() {
|
|
|
|
- final FilterGrid filterGrid = (FilterGrid)this.getView().getControl("commonfs");
|
|
|
|
- final List<Map<String, Object>> filterColumns = (List<Map<String, Object>>)filterGrid.getFilterColumns();
|
|
|
|
- final List<Map<String, Object>> cols = new ArrayList<Map<String, Object>>(filterColumns.size());
|
|
|
|
- String fieldName = null;
|
|
|
|
- for (final Map<String, Object> info : filterColumns) {
|
|
|
|
- fieldName = (String) info.get("fieldName");
|
|
|
|
- if (this.filterGrid(fieldName)) {
|
|
|
|
- cols.add(info);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- filterGrid.setFilterColumns((List)cols);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private boolean filterGrid(final String fieldName) {
|
|
|
|
- final String[] split = fieldName.split("\\.");
|
|
|
|
- final Set<String> removedPros = new HashSet<String>();
|
|
|
|
- removedPros.add("org");
|
|
|
|
- removedPros.add("asstacttype");
|
|
|
|
- removedPros.add("asstact");
|
|
|
|
- removedPros.add("currency");
|
|
|
|
- removedPros.add("basecurrency");
|
|
|
|
- removedPros.add("entitykey");
|
|
|
|
- removedPros.add("billtype");
|
|
|
|
- removedPros.add("bizdate");
|
|
|
|
- removedPros.add("comparedate");
|
|
|
|
- removedPros.add("id");
|
|
|
|
- removedPros.add("quotation");
|
|
|
|
- removedPros.add("exchangerate");
|
|
|
|
- removedPros.add("paymentbilltype");
|
|
|
|
- removedPros.add("entryid");
|
|
|
|
- removedPros.add("planseq");
|
|
|
|
- return !removedPros.contains(split[0]);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public void beforeFieldPostBack(final BeforeFieldPostBackEvent e) {
|
|
|
|
- super.beforeFieldPostBack(e);
|
|
|
|
- final Control source = (Control)e.getSource();
|
|
|
|
- final String key = source.getKey();
|
|
|
|
- final Object value = e.getValue();
|
|
|
|
- final boolean showLocalAmt = (boolean)this.getModel().getValue("showlocalamt");
|
|
|
|
- if ("showqtycols".equals(key)) {
|
|
|
|
- final List<String> qtyCols = (List)Stream.of(((String)value).split(",")).collect(Collectors.toList());
|
|
|
|
- if (!qtyCols.contains("balance")) {
|
|
|
|
- this.getView().showTipNotification(ResManager.loadKDString("\u201c\u6c47\u603b\u503c\u201d\u4e2d\u9009\u9879\u201c\u4f59\u989d\u201d\u5fc5\u9009\u3002", "AcctageForm_1", "fi-arapcommon", new Object[0]), Integer.valueOf(3000));
|
|
|
|
- e.setCancel(true);
|
|
|
|
- this.getView().updateView(key);
|
|
|
|
- }
|
|
|
|
- if (showLocalAmt && !qtyCols.contains("balanceloc")) {
|
|
|
|
- this.getView().showTipNotification(ResManager.loadKDString("\u663e\u793a\u6298\u672c\u5e01\u65f6\u201c\u6c47\u603b\u503c\u201d\u4e2d\u9009\u9879\u201c\u4f59\u989d\u6298\u672c\u5e01\u201d\u5fc5\u9009\u3002", "AcctageForm_2", "fi-arapcommon", new Object[0]), Integer.valueOf(3000));
|
|
|
|
- e.setCancel(true);
|
|
|
|
- this.getView().updateView(key);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- else if ("showkeycols".equals(key)) {
|
|
|
|
- final List<String> keyCols = (List)Stream.of(((String)value).split(",")).collect(Collectors.toList());
|
|
|
|
- if (!keyCols.contains("asstacttype")) {
|
|
|
|
- this.getView().showTipNotification(ResManager.loadKDString("\u201c\u7edf\u8ba1\u7ef4\u5ea6\u201d\u4e2d\u9009\u9879\u201c\u5f80\u6765\u7c7b\u578b\u201d\u5fc5\u9009\u3002", "AcctageForm_3", "fi-arapcommon", new Object[0]), Integer.valueOf(3000));
|
|
|
|
- e.setCancel(true);
|
|
|
|
- this.getView().updateView(key);
|
|
|
|
- }
|
|
|
|
- if (!keyCols.contains("currency")) {
|
|
|
|
- this.getView().showTipNotification(ResManager.loadKDString("\u201c\u7edf\u8ba1\u7ef4\u5ea6\u201d\u4e2d\u9009\u9879\u201c\u5e01\u79cd\u201d\u5fc5\u9009\u3002", "AcctageForm_4", "fi-arapcommon", new Object[0]), Integer.valueOf(3000));
|
|
|
|
- e.setCancel(true);
|
|
|
|
- this.getView().updateView(key);
|
|
|
|
- }
|
|
|
|
- if (showLocalAmt && !keyCols.contains("basecurrency")) {
|
|
|
|
- this.getView().showTipNotification(ResManager.loadKDString("\u663e\u793a\u6298\u672c\u5e01\u65f6\u201c\u7edf\u8ba1\u7ef4\u5ea6\u201d\u4e2d\u9009\u9879\u201c\u672c\u4f4d\u5e01\u201d\u5fc5\u9009\u3002", "AcctageForm_5", "fi-arapcommon", new Object[0]), Integer.valueOf(3000));
|
|
|
|
- e.setCancel(true);
|
|
|
|
- this.getView().updateView(key);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-// public void propertyChanged(final PropertyChangedArgs e) {
|
|
|
|
-// super.propertyChanged(e);
|
|
|
|
-// final String key = e.getProperty().getName();
|
|
|
|
-// final IDataModel m = this.getModel();
|
|
|
|
-// if ("sourceentity".equals(key)) {
|
|
|
|
-// this.setCompareDateComboItems();
|
|
|
|
-// final Object billScope = m.getValue("sourceentity");
|
|
|
|
-// m.setValue("billtypes", (Object)new Object[0]);
|
|
|
|
-// m.setValue("paymentbilltypes", (Object)new Object[0]);
|
|
|
|
-// if ("ar_finarbill".equals(billScope) || "ap_finapbill".equals(billScope) || "paidbill".equals(billScope) || "finpaidbill".equals(billScope)) {
|
|
|
|
-// this.getModel().setValue("onlycontainsamount", (Object)Boolean.FALSE);
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// else if (("showbybill".equals(key) || "showlocalamt".equals(key)) && "showlocalamt".equals(key)) {
|
|
|
|
-// final ChangeData[] changeDatas = e.getChangeSet();
|
|
|
|
-// final Object newValue = changeDatas[0].getNewValue();
|
|
|
|
-// final boolean isShowLocalAmt = (boolean)newValue;
|
|
|
|
-// final ReportConf conf = this.getReportConf();
|
|
|
|
-// final List<BigTableColConf> bigTableColConfs = (List<BigTableColConf>)conf.getBigTableColConf();
|
|
|
|
-// final List<String> cols = bigTableColConfs.stream().filter(colConf -> "B".equals(colConf.getCalType())).map((Function<? super Object, ?>)BigTableColConf::getCol).collect((Collector<? super Object, ?, List<String>>)Collectors.toList());
|
|
|
|
-// if (!isShowLocalAmt) {
|
|
|
|
-// cols.removeIf(col -> StringUtils.endsWith(col, "loc"));
|
|
|
|
-// }
|
|
|
|
-// m.setValue("showqtycols", (Object)String.join(",", cols));
|
|
|
|
-// final String showkeycols = (String)m.getValue("showkeycols");
|
|
|
|
-// final List<String> dims = Stream.of(showkeycols.split(",")).filter(s -> EmptyUtils.isNotEmpty(s)).collect((Collector<? super String, ?, List<String>>)Collectors.toList());
|
|
|
|
-// if (isShowLocalAmt) {
|
|
|
|
-// if (!dims.contains("basecurrency")) {
|
|
|
|
-// dims.add("basecurrency");
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// else if (dims.contains("basecurrency")) {
|
|
|
|
-// dims.remove("basecurrency");
|
|
|
|
-// }
|
|
|
|
-// m.setValue("showkeycols", (Object)String.join(",", dims));
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
- protected final ReportConf getReportConf() {
|
|
|
|
- if (this.confCache == null) {
|
|
|
|
- this.confCache = ReportDataHandle.loadReportConf(this.getModel().getDataEntityType().getName());
|
|
|
|
- }
|
|
|
|
- return this.confCache;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public boolean verifyQuery(final ReportQueryParam queryParam) {
|
|
|
|
- boolean verify = super.verifyQuery(queryParam);
|
|
|
|
- final FilterInfo filterInfo = queryParam.getFilter();
|
|
|
|
- final DynamicObjectCollection orgs = queryParam.getFilter().getDynamicObjectCollection("orgs");
|
|
|
|
- if (orgs == null || orgs.isEmpty()) {
|
|
|
|
- this.getView().showTipNotification(ResManager.loadKDString("\u7ed3\u7b97\u7ec4\u7ec7\u4e0d\u80fd\u4e3a\u7a7a\u3002", "AcctageForm_11", "fi-arapcommon", new Object[0]), Integer.valueOf(3000));
|
|
|
|
- verify = false;
|
|
|
|
- }
|
|
|
|
- else if ("planduedate".equals(filterInfo.getString("standard"))) {
|
|
|
|
- final List<Long> ids = (List)orgs.stream().map((orgx) -> {
|
|
|
|
- return orgx.getLong("id");
|
|
|
|
- }).collect(Collectors.toList());
|
|
|
|
- final Map<Long, Object> settleModelMap = SystemParameterHelper.batchGetAppParameter(this.isAr(), ids, this.isAr() ? "ar_003" : "ap_003");
|
|
|
|
- final List<Long> materialSettleOrgIds = new ArrayList<Long>(2);
|
|
|
|
- for (final Map.Entry<Long, Object> entry : settleModelMap.entrySet()) {
|
|
|
|
- if ("1".equals(entry.getValue())) {
|
|
|
|
- materialSettleOrgIds.add(entry.getKey());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (!ObjectUtils.isEmpty((Object)materialSettleOrgIds)) {
|
|
|
|
- final String message = ResManager.loadKDString("\u4ee5\u4e0b\u7ec4\u7ec7\u7684\u7ed3\u7b97\u6a21\u578b\u4e3a\u6309\u7269\u6599\u884c\u7ed3\u7b97\uff0c\u4e0d\u5141\u8bb8\u6309\u8ba1\u5212\u884c\u5230\u671f\u65e5\u7edf\u8ba1\u8d26\u9f84\uff0c\u8bf7\u4fee\u6539\u3002", "AcctageForm_20", "fi-arapcommon", new Object[0]);
|
|
|
|
- final StringBuilder sb = new StringBuilder();
|
|
|
|
- for (final DynamicObject org2 : orgs) {
|
|
|
|
- if (materialSettleOrgIds.contains(org2.getLong("id"))) {
|
|
|
|
- sb.append(org2.getString("name")).append('\uff1b');
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- this.getView().showMessage(message, sb.toString(), MessageTypes.Default);
|
|
|
|
- verify = false;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (filterInfo.getString("date") == null) {
|
|
|
|
- this.getView().showTipNotification(ResManager.loadKDString("\u8bf7\u6307\u5b9a\u67e5\u8be2\u65e5\u671f\u3002", "AcctageForm_12", "fi-arapcommon", new Object[0]));
|
|
|
|
- verify = false;
|
|
|
|
- }
|
|
|
|
- if (filterInfo.getString("standard") == null) {
|
|
|
|
- this.getView().showTipNotification(ResManager.loadKDString("\u8bf7\u9009\u62e9\u8d26\u9f84\u8ba1\u7b97\u6807\u51c6\u3002", "AcctageForm_13", "fi-arapcommon", new Object[0]));
|
|
|
|
- verify = false;
|
|
|
|
- }
|
|
|
|
- if (filterInfo.getString("sourceentity") == null) {
|
|
|
|
- this.getView().showTipNotification(ResManager.loadKDString("\u8bf7\u9009\u62e9\u6570\u636e\u8303\u56f4\u3002", "AcctageForm_14", "fi-arapcommon", new Object[0]));
|
|
|
|
- verify = false;
|
|
|
|
- }
|
|
|
|
- if (this.getGroupsValidator()) {
|
|
|
|
- verify = false;
|
|
|
|
- }
|
|
|
|
- if (this.existEntries(queryParam)) {
|
|
|
|
- this.getView().showTipNotification(ResManager.loadKDString("\u67e5\u8be2\u5931\u8d25\u3002\u5931\u8d25\u539f\u56e0\uff1a\u4f9b\u5e94\u94fe\u4e91-\u4e1a\u52a1\u8bbe\u7f6e-\u6781\u901f\u62a5\u8868-\u62a5\u8868\u5b57\u6bb5\u6620\u5c04\u914d\u7f6e-\u201c\u5b57\u6bb5\u6620\u5c04\u914d\u7f6e\u201d\uff0c\u201c\u6765\u6e90\u5b57\u6bb5\u6807\u8bc6\u201d\u4e0d\u5141\u8bb8\u6765\u6e90\u4e8e\u591a\u4e2a\u5206\u5f55\u3002\u8bf7\u4fee\u6539\u540e\u91cd\u65b0\u67e5\u8be2\u3002", "AcctageForm_21", "fi-arapcommon", new Object[0]));
|
|
|
|
- verify = false;
|
|
|
|
- }
|
|
|
|
- return verify;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private boolean getGroupsValidator() {
|
|
|
|
- final String groupStr = this.getPageCache().get("groups");
|
|
|
|
- List<AcctageGroup> groups;
|
|
|
|
- if (ObjectUtils.isEmpty((Object)groupStr)) {
|
|
|
|
- groups = AcctageHelper.getGroupsWithAgingGroup(this.isAr() ? "ar_acctagesetting" : "ap_acctagesetting");
|
|
|
|
- if (groups.isEmpty()) {
|
|
|
|
- groups = this.getDefaultAgingGroup();
|
|
|
|
- return groups.isEmpty();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- groups = (List<AcctageGroup>) SerializationUtils.fromJsonStringToList(groupStr, (Class)AcctageGroup.class);
|
|
|
|
- }
|
|
|
|
- return groups.isEmpty();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private boolean existEntries(final ReportQueryParam queryParam) {
|
|
|
|
- boolean existEntries = false;
|
|
|
|
- final FilterInfo filterInfo = queryParam.getFilter();
|
|
|
|
- final String srcEntity = filterInfo.getString("sourceentity");
|
|
|
|
- if ("ap_finapbill".equals(srcEntity) || "ar_finarbill".equals(srcEntity) || "finbusbill".equals(srcEntity) || "finpaidbill".equals(srcEntity) || "ALL".equals(srcEntity)) {
|
|
|
|
- final QFilter statusFilter = new QFilter("status", "=", (Object)Boolean.TRUE);
|
|
|
|
- final QFilter reportFilter = new QFilter("report", "=", (Object)this.getView().getEntityId());
|
|
|
|
- final Map<Object, DynamicObject> reportConf = (Map<Object, DynamicObject>)BusinessDataServiceHelper.loadFromCache("scmc_report_conf", new QFilter[] { statusFilter, reportFilter });
|
|
|
|
- if (ObjectUtils.isEmpty((Object)reportConf)) {
|
|
|
|
- return existEntries;
|
|
|
|
- }
|
|
|
|
- final DynamicObject[] cfs = reportConf.values().toArray(new DynamicObject[0]);
|
|
|
|
- final Set<Long> colMapIds = new HashSet<Long>(2);
|
|
|
|
- for (final DynamicObject row : cfs[0].getDynamicObjectCollection("srcentry")) {
|
|
|
|
- final String srcNumber = row.getDynamicObject("srcentity").getString("number");
|
|
|
|
- final boolean blockStatus = row.getBoolean("blockstatus");
|
|
|
|
- if (blockStatus && ("ar_finarbill".equals(srcNumber) || "ap_finapbill".equals(srcNumber))) {
|
|
|
|
- colMapIds.add(row.getDynamicObject("colmap").getLong("id"));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (ObjectUtils.isEmpty((Object)colMapIds)) {
|
|
|
|
- return existEntries;
|
|
|
|
- }
|
|
|
|
- final QFilter idFilter = new QFilter("id", "in", (Object)colMapIds);
|
|
|
|
- final Map<Object, DynamicObject> reportColMap = (Map<Object, DynamicObject>)BusinessDataServiceHelper.loadFromCache("scmc_report_colmap", new QFilter[] { idFilter });
|
|
|
|
- if (ObjectUtils.isEmpty((Object)reportColMap)) {
|
|
|
|
- return existEntries;
|
|
|
|
- }
|
|
|
|
- for (final DynamicObject reportCol : reportColMap.values().toArray(new DynamicObject[0])) {
|
|
|
|
- final String mapInfoJsonStr = reportCol.getString("mapinfo_tag");
|
|
|
|
- if (ObjectUtils.isEmpty((Object)mapInfoJsonStr)) {
|
|
|
|
- return existEntries;
|
|
|
|
- }
|
|
|
|
- final JSONObject colInfo = JSONObject.parseObject(mapInfoJsonStr);
|
|
|
|
- final JSONArray fullSrcCols = colInfo.getJSONArray("fullsrccol");
|
|
|
|
- final Set<Object> fullSrcColSet = new HashSet<Object>((Collection<?>)fullSrcCols);
|
|
|
|
- String entryKey = "";
|
|
|
|
- for (final Object value : fullSrcColSet) {
|
|
|
|
- final String[] split = ((String)value).split("\\.");
|
|
|
|
- if (split.length == 2) {
|
|
|
|
- if (ObjectUtils.isEmpty((Object)entryKey)) {
|
|
|
|
- entryKey = split[0];
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- if (!entryKey.equals(split[0])) {
|
|
|
|
- existEntries = true;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (!ObjectUtils.isEmpty((Object)entryKey)) {
|
|
|
|
- queryParam.getCustomParam().put("entryName", entryKey);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return existEntries;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public void beforeQuery(final ReportQueryParam queryParam) {
|
|
|
|
- super.beforeQuery(queryParam);
|
|
|
|
- final AcctageParam param = this.buildReportParam(queryParam);
|
|
|
|
- final Object hyperLinkClickLineName = this.getView().getFormShowParameter().getCustomParams().get("hyperLinkClickLineName");
|
|
|
|
- if (hyperLinkClickLineName != null) {
|
|
|
|
- this.getView().setVisible(Boolean.FALSE, new String[] { "reportfilterap" });
|
|
|
|
- param.setHyperLinkClick(true);
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- param.setHyperLinkClick(false);
|
|
|
|
- }
|
|
|
|
- queryParam.getCustomParam().put(AcctageParam.class.getName(), param);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private AcctageParam buildReportParam(final ReportQueryParam queryParam) {
|
|
|
|
- final AcctageParam param = new AcctageParam();
|
|
|
|
- final FilterInfo filterInfo = queryParam.getFilter();
|
|
|
|
- final String entity = (String)filterInfo.getFilterItem("sourceentity").getValue();
|
|
|
|
- param.setEntities(this.buildSourceEntityKeys(entity));
|
|
|
|
- final String compareDateFieldKey = filterInfo.getString("standard");
|
|
|
|
- final String compareDateAlias = kd.fi.arapcommon.util.StringUtils.removePrefix(compareDateFieldKey);
|
|
|
|
- param.setCompareDateField(compareDateFieldKey, compareDateAlias);
|
|
|
|
- param.setBillTypes((List<DynamicObject>)filterInfo.getDynamicObjectCollection("billtypes"));
|
|
|
|
- param.setPaymentType(this.isAr() ? "cas_receivingbilltype" : "cas_paymentbilltype");
|
|
|
|
- param.setPaymentTypePks(DynamicObjectHelper.getIdList((Collection<DynamicObject>)filterInfo.getDynamicObjectCollection("paymentbilltypes")));
|
|
|
|
- param.setOrgIds(DynamicObjectHelper.getIdList((Collection<DynamicObject>)filterInfo.getDynamicObjectCollection("orgs")));
|
|
|
|
- param.setCurrencyIds(DynamicObjectHelper.getIdList((Collection<DynamicObject>)filterInfo.getDynamicObjectCollection("q_currency")));
|
|
|
|
- final String asstactType = filterInfo.getString("q_asstacttype");
|
|
|
|
- if (!ObjectUtils.isEmpty((Object)asstactType)) {
|
|
|
|
- param.setAsstactType(asstactType);
|
|
|
|
- final DynamicObjectCollection acctacts = filterInfo.getDynamicObjectCollection(param.getAsstactType());
|
|
|
|
- param.setAsstactPks(ReportHelper.getBasedataIds((List<DynamicObject>)acctacts));
|
|
|
|
- }
|
|
|
|
- Date queryDate = filterInfo.getDate("date");
|
|
|
|
- if (queryDate != null) {
|
|
|
|
- queryDate = DateUtils.getDataFormat(queryDate, false);
|
|
|
|
- }
|
|
|
|
- param.setQueryDate(queryDate);
|
|
|
|
- param.setRecoverHistoryData(true);
|
|
|
|
- param.setGroups(this.getGroups());
|
|
|
|
- param.setHyperLinkClick(filterInfo.getBoolean("isHyperLinkClickByGroup"));
|
|
|
|
- param.setShowLocalAmt(filterInfo.getBoolean("showlocalamt"));
|
|
|
|
- param.setShowByBill(filterInfo.getBoolean("showbybill"));
|
|
|
|
- param.setContainsUnaudit(filterInfo.getBoolean("containsunaudit"));
|
|
|
|
- param.setOnlyContainsAmount(filterInfo.getBoolean("onlycontainsamount"));
|
|
|
|
- final Object entryName = queryParam.getCustomParam().get("entryName");
|
|
|
|
- if (!ObjectUtils.isEmpty(entryName)) {
|
|
|
|
- param.setEntryName(entryName.toString());
|
|
|
|
- }
|
|
|
|
- return param;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private List<AcctageGroup> getGroups() {
|
|
|
|
- final String groupStr = this.getPageCache().get("groups");
|
|
|
|
- List<AcctageGroup> groups;
|
|
|
|
- if (ObjectUtils.isEmpty((Object)groupStr)) {
|
|
|
|
- groups = AcctageHelper.getGroupsWithAgingGroup(this.isAr() ? "ar_acctagesetting" : "ap_acctagesetting");
|
|
|
|
- if (groups.isEmpty()) {
|
|
|
|
- groups = this.getDefaultAgingGroup();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- groups = (List<AcctageGroup>)SerializationUtils.fromJsonStringToList(groupStr, (Class)AcctageGroup.class);
|
|
|
|
- }
|
|
|
|
- groups.add(0, new AcctageGroup(ResManager.loadKDString("\u672a\u5230\u671f", "AcctageForm_15", "fi-arapcommon", new Object[0]), null, -1));
|
|
|
|
- final Object hyperLinkClickLineName = this.getView().getFormShowParameter().getCustomParam("hyperLinkClickLineName");
|
|
|
|
- final List<AcctageGroup> hyperLinkClickGroups = new LinkedList<AcctageGroup>();
|
|
|
|
- if (hyperLinkClickLineName != null) {
|
|
|
|
- for (int i = 0; i < groups.size(); ++i) {
|
|
|
|
- if (AcctageHelper.getAmountFieldName(groups.get(i), "balance").equals(String.valueOf(hyperLinkClickLineName))) {
|
|
|
|
- hyperLinkClickGroups.add(groups.get(i));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (hyperLinkClickGroups != null && hyperLinkClickGroups.size() > 0) {
|
|
|
|
- return hyperLinkClickGroups;
|
|
|
|
- }
|
|
|
|
- return groups;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private List<AcctageGroup> getDefaultAgingGroup() {
|
|
|
|
- final List<AcctageGroup> groups = new ArrayList<AcctageGroup>(8);
|
|
|
|
- final DynamicObjectCollection orgs = (DynamicObjectCollection)this.getModel().getValue("orgs");
|
|
|
|
- final List<Long> ids = new ArrayList<Long>(8);
|
|
|
|
- final List<Long> groupIds = new ArrayList<Long>(8);
|
|
|
|
- for (final DynamicObject org : orgs) {
|
|
|
|
- final long orgId = ((DynamicObject)org.get("fbasedataid")).getLong("id");
|
|
|
|
- ids.add(orgId);
|
|
|
|
- }
|
|
|
|
- if (ids.size() <= 0) {
|
|
|
|
- return groups;
|
|
|
|
- }
|
|
|
|
- final String entityName = this.isAr() ? "ar_accrualaging" : "ap_accrualaging";
|
|
|
|
- final QFilter filter = new QFilter("enable", "=", (Object)Boolean.TRUE);
|
|
|
|
- filter.and(new QFilter("isdefault", "=", (Object)Boolean.TRUE));
|
|
|
|
- if (this.isAr()) {
|
|
|
|
- filter.and(new QFilter("grouptype", "ftlike", (Object)"1"));
|
|
|
|
- }
|
|
|
|
- final DynamicObjectCollection standardGroups = BaseDataServiceHelper.queryBaseData(entityName, Long.valueOf(ids.get(0)), filter, "id");
|
|
|
|
- for (final DynamicObject standardGroup : standardGroups) {
|
|
|
|
- groupIds.add(standardGroup.getLong("id"));
|
|
|
|
- }
|
|
|
|
- if (ids.size() > 1) {
|
|
|
|
- for (int i = 1; i < ids.size(); ++i) {
|
|
|
|
- final DynamicObjectCollection validateGroups = BaseDataServiceHelper.queryBaseData(entityName, Long.valueOf(ids.get(i)), filter, "id");
|
|
|
|
- if (validateGroups.size() != groupIds.size()) {
|
|
|
|
- this.getView().showTipNotification(ResManager.loadKDString("\u6240\u9009\u7ec4\u7ec7\u7684\u8d26\u9f84\u5206\u7ec4\u4e0d\u4e00\u81f4\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002", "AcctageForm_17", "fi-arapcommon", new Object[0]));
|
|
|
|
- return groups;
|
|
|
|
- }
|
|
|
|
- for (final DynamicObject group : validateGroups) {
|
|
|
|
- if (!groupIds.contains(group.getLong("id"))) {
|
|
|
|
- this.getView().showTipNotification(ResManager.loadKDString("\u6240\u9009\u7ec4\u7ec7\u7684\u8d26\u9f84\u5206\u7ec4\u4e0d\u4e00\u81f4\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002", "AcctageForm_17", "fi-arapcommon", new Object[0]));
|
|
|
|
- return groups;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (groupIds.size() < 1) {
|
|
|
|
- this.getView().showTipNotification(ResManager.loadKDString("\u7ec4\u7ec7\u6ca1\u6709\u9ed8\u8ba4\u7684\u8d26\u9f84\u5206\u7ec4\uff0c\u8bf7\u5148\u7ef4\u62a4\u8d26\u9f84\u5206\u7ec4\u3002", "AcctageForm_18", "fi-arapcommon", new Object[0]));
|
|
|
|
- return groups;
|
|
|
|
- }
|
|
|
|
- final DynamicObject agingGroup = BusinessDataServiceHelper.loadSingle((Object)groupIds.get(0), this.isAr() ? "ar_accrualaging" : "ap_accrualaging");
|
|
|
|
- final DynamicObjectCollection entries = agingGroup.getDynamicObjectCollection("entry");
|
|
|
|
- for (final DynamicObject entry : entries) {
|
|
|
|
- final AcctageGroup group2 = new AcctageGroup(entry.getString("e_section"), entry.getInt("e_startday"), entry.getBoolean("e_isdaymore") ? null : Integer.valueOf(entry.getInt("e_endday")));
|
|
|
|
- groups.add(group2);
|
|
|
|
- }
|
|
|
|
- return groups;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
public void hyperLinkClick(final HyperLinkClickEvent evt) {
|
|
public void hyperLinkClick(final HyperLinkClickEvent evt) {
|
|
final String fieldName = evt.getFieldName();
|
|
final String fieldName = evt.getFieldName();
|
|
if ("billno".equals(fieldName)) {
|
|
if ("billno".equals(fieldName)) {
|
|
@@ -693,196 +310,5 @@ public class AcctageForm extends AbstractReportFormPlugin implements HyperLinkCl
|
|
return customParams;
|
|
return customParams;
|
|
}
|
|
}
|
|
|
|
|
|
- public void beforeBindData(final EventObject e) {
|
|
|
|
- super.beforeBindData(e);
|
|
|
|
- final FormShowParameter formShowParameter = this.getView().getFormShowParameter();
|
|
|
|
- if (formShowParameter == null) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- final Map<String, Object> customParams = (Map<String, Object>)formShowParameter.getCustomParams();
|
|
|
|
- if (customParams == null) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- final Boolean isOpenByHyperlink = (Boolean) customParams.get("isopenbyhyperlink");
|
|
|
|
- if (isOpenByHyperlink != null && isOpenByHyperlink) {
|
|
|
|
- this.setQueryConditionDeassign(customParams);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
|
|
- private void setQueryConditionDeassign(final Map<String, Object> customParams) {
|
|
|
|
- final IDataModel parentModel = this.getView().getParentView().getModel();
|
|
|
|
- final List<String> filterFieldKeys = this.getFilterFieldKeys();
|
|
|
|
- final IDataModel m = this.getModel();
|
|
|
|
- final DataEntityPropertyCollection properties = m.getDataEntityType().getProperties();
|
|
|
|
- final Map<String, Object> rowData = (Map<String, Object>) customParams.get("rowData");
|
|
|
|
- for (final String originalFieldKey : filterFieldKeys) {
|
|
|
|
- Object value = null;
|
|
|
|
- String propKey = originalFieldKey;
|
|
|
|
- if (originalFieldKey.startsWith("q_")) {
|
|
|
|
- propKey = originalFieldKey.substring(2);
|
|
|
|
- }
|
|
|
|
- else if ("bd_customer".equals(originalFieldKey) || "bd_supplier".equals(originalFieldKey) || "bos_user".equals(originalFieldKey)) {
|
|
|
|
- propKey = "asstact";
|
|
|
|
- }
|
|
|
|
- if (rowData.get(propKey) != null) {
|
|
|
|
- value = rowData.get(propKey);
|
|
|
|
- }
|
|
|
|
- if (ObjectUtils.isEmpty(value)) {
|
|
|
|
- value = parentModel.getValue(originalFieldKey);
|
|
|
|
- }
|
|
|
|
- final IDataEntityProperty prop = (IDataEntityProperty)properties.get((String) originalFieldKey);
|
|
|
|
- if (prop instanceof MulBasedataProp) {
|
|
|
|
- value = this.getMutlBasedataPks(value);
|
|
|
|
- }
|
|
|
|
- else if (prop instanceof ItemClassProp && value instanceof Map) {
|
|
|
|
- value = ((Map)value).get("id");
|
|
|
|
- }
|
|
|
|
- m.setValue(originalFieldKey, value);
|
|
|
|
- }
|
|
|
|
- final List<String> sysDimensions = new ArrayList<String>(Arrays.asList("org", "asstacttype", "asstact", "currency"));
|
|
|
|
- final List<SimpleFilterRow> rows = new LinkedList<SimpleFilterRow>();
|
|
|
|
- final String showKeyCols = (String)this.getModel().getValue("showkeycols");
|
|
|
|
- final List<String> showKeyColList = Stream.of(showKeyCols.split(",")).filter(EmptyUtils::isNotEmpty).collect(Collectors.toList());
|
|
|
|
- for (final String s : showKeyColList) {
|
|
|
|
- if (!sysDimensions.contains(s)) {
|
|
|
|
- final List<FilterValue> filterValues = new LinkedList<FilterValue>();
|
|
|
|
- final FilterValue filterValue = new FilterValue();
|
|
|
|
- String key = s;
|
|
|
|
- Object value2 = rowData.get(key);
|
|
|
|
- if (value2 == null) {
|
|
|
|
- key = s + ".number";
|
|
|
|
- value2 = rowData.get(key);
|
|
|
|
- }
|
|
|
|
- if (value2 == null) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- filterValue.setValue(value2);
|
|
|
|
- filterValues.add(filterValue);
|
|
|
|
- final SimpleFilterRow row = new SimpleFilterRow("", "17", key, "", "0", (List)filterValues);
|
|
|
|
- row.setValue((List)filterValues);
|
|
|
|
- rows.add(row);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (!ObjectUtils.isEmpty((Object)rows)) {
|
|
|
|
- final FilterCondition filterCondition = new FilterCondition();
|
|
|
|
- filterCondition.setFilterRow((List)rows);
|
|
|
|
- final FilterGrid filterGrid = (FilterGrid)this.getView().getControl("commonfs");
|
|
|
|
- filterGrid.SetValue(filterCondition);
|
|
|
|
- }
|
|
|
|
- m.setValue("showbybill", (Object)Boolean.TRUE);
|
|
|
|
- this.getView().setVisible(Boolean.FALSE, new String[] { "groupset_btn" });
|
|
|
|
- final ReportFilter control = (ReportFilter)this.getControl("reportfilterap");
|
|
|
|
- control.search();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private Object getMutlBasedataPks(Object value) {
|
|
|
|
- if (value instanceof DynamicObjectCollection) {
|
|
|
|
- final DynamicObjectCollection temCollectionValue = (DynamicObjectCollection)value;
|
|
|
|
- final List<Object> pks = new ArrayList<Object>(((DynamicObjectCollection)value).size());
|
|
|
|
- for (final DynamicObject eachValue : temCollectionValue) {
|
|
|
|
- pks.add(eachValue.getDynamicObject("fbasedataid").getPkValue());
|
|
|
|
- }
|
|
|
|
- value = pks.toArray(new Object[0]);
|
|
|
|
- }
|
|
|
|
- else if (value instanceof DynamicObject) {
|
|
|
|
- value = new Object[] { ((DynamicObject)value).getPkValue() };
|
|
|
|
- }
|
|
|
|
- else if (value instanceof Map) {
|
|
|
|
- final Object id = ((Map)value).get("id");
|
|
|
|
- value = new Object[] { Long.valueOf(id.toString()) };
|
|
|
|
- }
|
|
|
|
- return value;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private List<String> getFilterFieldKeys() {
|
|
|
|
- final Container fixFilterContainer = (Container)this.getView().getControl("fsap");
|
|
|
|
- final Container commFilterContainer = (Container)this.getView().getControl("commonfs");
|
|
|
|
- final Container showFilterContainer = (Container)this.getView().getControl("flexpanelap1");
|
|
|
|
- final Container moreFilterContainer = (Container)this.getView().getControl("reportmorefilterpanelap");
|
|
|
|
- final List<Control> filterItems = new ArrayList<Control>(8);
|
|
|
|
- filterItems.addAll(fixFilterContainer.getItems());
|
|
|
|
- filterItems.addAll(commFilterContainer.getItems());
|
|
|
|
- filterItems.addAll(showFilterContainer.getItems());
|
|
|
|
- filterItems.addAll(moreFilterContainer.getItems());
|
|
|
|
- final List<String> filterFieldKeys = (List)filterItems.stream().map(Control::getKey).collect(Collectors.toList());
|
|
|
|
- return filterFieldKeys;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public void afterDoOperation(final AfterDoOperationEventArgs args) {
|
|
|
|
- super.afterDoOperation(args);
|
|
|
|
- final String key = args.getOperateKey();
|
|
|
|
- if ("groupset".equals(key)) {
|
|
|
|
- final ListShowParameter lsp = ShowFormHelper.createShowListForm(this.isAr() ? "ar_accrualaging" : "ap_accrualaging", false, 2);
|
|
|
|
- final ListFilterParameter lfp = new ListFilterParameter();
|
|
|
|
- final DynamicObjectCollection orgs = (DynamicObjectCollection)this.getModel().getValue("orgs");
|
|
|
|
- final List<Long> ids = new ArrayList<Long>(8);
|
|
|
|
- final List<Long> groupIds = new ArrayList<Long>(8);
|
|
|
|
- for (final DynamicObject org : orgs) {
|
|
|
|
- final long orgId = ((DynamicObject)org.get("fbasedataid")).getLong("id");
|
|
|
|
- ids.add(orgId);
|
|
|
|
- }
|
|
|
|
- if (ids.size() <= 0) {
|
|
|
|
- this.getView().showTipNotification(ResManager.loadKDString("\u7ed3\u7b97\u7ec4\u7ec7\u4e3a\u7a7a\uff0c\u8bf7\u5148\u9009\u62e9\u7ed3\u7b97\u7ec4\u7ec7\u3002", "AcctageForm_19", "fi-arapcommon", new Object[0]));
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- final String entityName = this.isAr() ? "ar_accrualaging" : "ap_accrualaging";
|
|
|
|
- final QFilter filter = new QFilter("enable", "=", (Object)Boolean.TRUE);
|
|
|
|
- if (this.isAr()) {
|
|
|
|
- filter.and(new QFilter("grouptype", "ftlike", (Object)"1"));
|
|
|
|
- }
|
|
|
|
- final DynamicObjectCollection standardGroups = BaseDataServiceHelper.queryBaseData(entityName, Long.valueOf(ids.get(0)), filter, "id");
|
|
|
|
- for (final DynamicObject standardGroup : standardGroups) {
|
|
|
|
- groupIds.add(standardGroup.getLong("id"));
|
|
|
|
- }
|
|
|
|
- if (ids.size() > 1) {
|
|
|
|
- for (int i = 1; i < ids.size(); ++i) {
|
|
|
|
- final DynamicObjectCollection groups = BaseDataServiceHelper.queryBaseData(entityName, Long.valueOf(ids.get(i)), filter, "id");
|
|
|
|
- if (groups.size() != groupIds.size()) {
|
|
|
|
- this.getView().showTipNotification(ResManager.loadKDString("\u6240\u9009\u7ec4\u7ec7\u7684\u8d26\u9f84\u5206\u7ec4\u4e0d\u4e00\u81f4\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002", "AcctageForm_17", "fi-arapcommon", new Object[0]));
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- for (final DynamicObject group : groups) {
|
|
|
|
- if (!groupIds.contains(group.getLong("id"))) {
|
|
|
|
- this.getView().showTipNotification(ResManager.loadKDString("\u6240\u9009\u7ec4\u7ec7\u7684\u8d26\u9f84\u5206\u7ec4\u4e0d\u4e00\u81f4\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002", "AcctageForm_17", "fi-arapcommon", new Object[0]));
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (groupIds.size() < 1) {
|
|
|
|
- this.getView().showTipNotification(ResManager.loadKDString("\u7ec4\u7ec7\u65e0\u53ef\u7528\u8d26\u9f84\u5206\u7ec4\uff0c\u8bf7\u5148\u7ef4\u62a4\u8d26\u9f84\u5206\u7ec4\u3002", "AcctageForm_16", "fi-arapcommon", new Object[0]));
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- final QFilter filter2 = new QFilter("id", "in", (Object)groupIds);
|
|
|
|
- lfp.setFilter(filter2);
|
|
|
|
- lsp.setListFilterParameter(lfp);
|
|
|
|
- final CloseCallBack closeCallBack = new CloseCallBack(this.getPluginName(), "aginggroup");
|
|
|
|
- lsp.setCloseCallBack(closeCallBack);
|
|
|
|
- this.getView().showForm((FormShowParameter)lsp);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public void closedCallBack(final ClosedCallBackEvent closedCallBackEvent) {
|
|
|
|
- super.closedCallBack(closedCallBackEvent);
|
|
|
|
- final String actionId = closedCallBackEvent.getActionId();
|
|
|
|
- if ("aginggroup".equals(actionId)) {
|
|
|
|
- final ListSelectedRowCollection rows = (ListSelectedRowCollection)closedCallBackEvent.getReturnData();
|
|
|
|
- final boolean isAr = this.isAr();
|
|
|
|
- if (rows != null && rows.size() > 0) {
|
|
|
|
- final Long groupId = (Long)rows.get(0).getPrimaryKeyValue();
|
|
|
|
- final DynamicObject agingGroup = BusinessDataServiceHelper.loadSingle((Object)groupId, isAr ? "ar_accrualaging" : "ap_accrualaging");
|
|
|
|
- final List<AcctageGroup> groups = new ArrayList<AcctageGroup>(64);
|
|
|
|
- final DynamicObjectCollection entries = agingGroup.getDynamicObjectCollection("entry");
|
|
|
|
- for (final DynamicObject entry : entries) {
|
|
|
|
- final AcctageGroup group = new AcctageGroup(entry.getString("e_section"), entry.getInt("e_startday"), entry.getBoolean("e_isdaymore") ? null : Integer.valueOf(entry.getInt("e_endday")));
|
|
|
|
- groups.add(group);
|
|
|
|
- }
|
|
|
|
- if (groups.size() > 0) {
|
|
|
|
- AcctageHelper.saveGroupSetting(groups, isAr, isAr ? "ar_acctagesetting" : "ap_acctagesetting");
|
|
|
|
- this.getPageCache().put("groups", SerializationUtils.toJsonString((Object)groups));
|
|
|
|
- this.getView().invokeOperation("refresh");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
}
|
|
}
|