/* * 获取对象列表 */ public Object[] getElements(Context context, STableStatus tablestatus) { GetGoodsSplitBillListKey key = new GetGoodsSplitBillListKey(tablestatus.getBeginIndex(), tablestatus.getPageSize(), false); if (CheckIsNull.isNotEmpty(tablestatus.getSortColumn())) { key.setSortField(getSortField(tablestatus.getSortColumn())); key.setSortType(getSortType(tablestatus.getSortDirection())); } key.setStatus(new GoodsSplitStatus[] {GoodsSplitStatus.Approvaling}); key.setSearchText(searchText.getText()); key.setBeginTime(context.find(QueryTerm.class, queryTermList.getText()).getStartTime()); key.setEndTime(context.find(QueryTerm.class, queryTermList.getText()).getEndTime()); ListEntity<GoodsSplitItem> entity = context.find(ListEntity.class, key); List<GoodsSplitItem> itemList = entity.getItemList(); // if (CheckIsNull.isEmpty(itemList)) { // countLabel.setText("0"); // return null; // } GoodsSplitItem[] items = new GoodsSplitItem[itemList.size()]; for (int i = 0; i < itemList.size(); i++) { items[i] = itemList.get(i); itemMap.put(items[i].getRECID().toString(), items[i]); } int size = items.length; if (tablestatus.getPageNo() != STableStatus.FIRSTPAGE) { String preSize = countLabel.getText(); if (StringHelper.isNotEmpty(preSize)) { size += Integer.parseInt(preSize); } } countLabel.setText(String.valueOf(size)); // countLabel.setText("" + items.length); countLabel.getParent().getParent().layout(); return items; }
@Override protected Object[] getOrderItem(STableStatus tablestatus) { // OrderListEntity, GetPurchaseOrderListKey GetPurchaseOrderListKey key = new GetPurchaseOrderListKey(tablestatus.getBeginIndex(), tablestatus.getPageSize(), false); key.setOrderStatus(OrderStatus.finish, OrderStatus.Stop); if (null != queryScopeSource) { key.setQueryScope(queryScopeSource.getQueryScope(queryScopeList.getText())); } key.setQueryTerm(getContext().find(QueryTerm.class, colstDate.getText())); key.setSearchText(searchText.getText()); if (null != tablestatus.getSortColumn()) { key.setSortField(Columns.valueOf(tablestatus.getSortColumn()).getSortField()); } // 排序 setLimitKeySort(key, tablestatus); listEntity = context.find(OrderListEntity.class, key); long size = listEntity.getTotalCount(); double orderAmount = listEntity.getOrderAmount(); double returnAmount = listEntity.getReturnAmount(); if (tablestatus.getPageNo() != STableStatus.FIRSTPAGE) { String preSize = lblOrderCount.getText(); if (StringHelper.isNotEmpty(preSize)) { size += Integer.parseInt(preSize); } String preOrderAmount = lblPurchaseAmount.getText(); if (StringHelper.isNotEmpty(preOrderAmount)) { orderAmount = DoubleUtil.sub(orderAmount, DoubleUtil.strToDouble(preOrderAmount)); } String preReturnAmount = lblReturnAmount.getText(); if (StringHelper.isNotEmpty(preReturnAmount)) { returnAmount = DoubleUtil.sub(returnAmount, DoubleUtil.strToDouble(preReturnAmount)); } } lblOrderCount.setText(String.valueOf(size)); lblPurchaseAmount.setText(DoubleUtil.getRoundStr(orderAmount)); lblReturnAmount.setText(DoubleUtil.getRoundStr(returnAmount)); return listEntity.getItemList().toArray(); }
/** 组装公告对像 */ private SaveOrUpdateNoticeTask buildSaveOrUpdateNoticeTask() { SaveOrUpdateNoticeTask saveOrUpdateNoticeTask = new SaveOrUpdateNoticeTask(); if (null == getArgument()) { // 公告GUID saveOrUpdateNoticeTask.setRECID(getContext().newRECID()); // 创建日期 saveOrUpdateNoticeTask.setCreateDate(new Date().getTime()); } else { // 公告GUID saveOrUpdateNoticeTask.setRECID(((NoticeInfo) this.getArgument()).getRECID()); // 创建日期 saveOrUpdateNoticeTask.setCreateDate(((NoticeInfo) this.getArgument()).getCreateTime()); } // 公告标题 saveOrUpdateNoticeTask.setNoticeTitle( noticeTitleText.getText() != null ? noticeTitleText.getText().trim() : ""); // 是否置顶 saveOrUpdateNoticeTask.setIsTop(isTopCheckBox.getSelection()); // 发布范围 saveOrUpdateNoticeTask.setDeptNameStr( deptNameStrText.getText() != null ? deptNameStrText.getText().trim() : ""); // 发布日期 saveOrUpdateNoticeTask.setPublishTime( publishingDate.getDate() != null ? publishingDate.getDate().getTime() : 0); // 撤消日期 saveOrUpdateNoticeTask.setCancelTime( cancelDate.getDate() != null ? DateUtil.getDayEndTime(cancelDate.getDate().getTime()) : 0); // 公告内容 saveOrUpdateNoticeTask.setNoticeContent( noticeContentText.getContent() != null ? noticeContentText.getContent().trim() : ""); // 发布范围 if (StringHelper.isNotEmpty(deptGuidStr)) { String[] deptGuids = deptGuidStr.split(","); List<GUID> deptGuidList = new ArrayList<GUID>(); if (null != deptGuids && deptGuids.length > 0) { for (Object item : deptGuids) { deptGuidList.add(GUID.valueOf(item.toString())); } } saveOrUpdateNoticeTask.setDeptGuidList(deptGuidList); } return saveOrUpdateNoticeTask; }
/** 查询未布布公告 */ private List<NoticeItem> findNoticeItemList(Context context, STableStatus tablestatus) { FindNoticeItemListKey key = new FindNoticeItemListKey(); // 查询未发布公告 key.setType(FindNoticeItemListKey.NOT_RELEASE); // 搜索字符串 if (StringHelper.isNotEmpty(searchNoticeText.getText()) && !searchNoticeText.getText().trim().equals("输入搜索内容")) { key.setSearchText(searchNoticeText.getText().trim()); } LoginInfo loginInfo = context.get(LoginInfo.class); // 非Boss只查询自已的公告,设置创建人GUID if (!loginInfo.hasAuth(Auth.Boss)) { key.setCreateGuid(loginInfo.getEmployeeInfo().getId()); } // 排序 key.setSortCloumName(tablestatus.getSortColumn()); key.setSortType( SSortDirection.ASC == tablestatus.getSortDirection() ? SortType.Asc : SortType.Desc); List<NoticeItem> noticeItemList = context.getList(NoticeItem.class, key); return noticeItemList; }