/* 查询初始方法 * @see cn.com.sony.npc.reception.service.NpcQuotationSaleQueryService#init(cn.com.sony.npc.reception.vo.NpcSalesDetailForm) */ @Override public void init(NpcSalesDetailForm npcSalesDetailForm) throws Exception { List<LabelValueBean> partStatusList = this.getBaseTableCacheQueryService() .getLabellingSystemCodeList(SysConstants.SALES_DETAIL_STATUS_PREKEY); npcSalesDetailForm.setPartStatusList(partStatusList); // Get reason list from cache List<LabelValueBean> reasonList = this.getBaseTableCacheQueryService() .getLabellingSystemCodeList(SysConstants.HOLD_REASON_KEY); npcSalesDetailForm.setReasonList(reasonList); }
// 预销售单查询 public void getSaleDetailList(NpcSalesDetailForm npcSalesDetailForm) throws Exception { // Get part status list from cache List<LabelValueBean> partStatusList = this.getBaseTableCacheQueryService() .getLabellingSystemCodeList(SysConstants.SALES_DETAIL_STATUS_PREKEY); npcSalesDetailForm.setPartStatusList(partStatusList); // Get reason list from cache List<LabelValueBean> reasonList = this.getBaseTableCacheQueryService() .getLabellingSystemCodeList(SysConstants.HOLD_REASON_KEY); npcSalesDetailForm.setReasonList(reasonList); HQLQueryBean page = (HQLQueryBean) PageUtils.getPageBean(npcSalesDetailForm, PageConstants.QUERY_TYPE_HQL); page.addAlias("NpcSalesDetailInfo", "nsd"); page.addAlias("NpcSalesInfo", "nsi"); if (null != npcSalesDetailForm.getSaleNo() && !"".equals(npcSalesDetailForm.getSaleNo())) { page.addEqualSearch("nsd.saleNo", npcSalesDetailForm.getSaleNo()); } if (null != npcSalesDetailForm.getPartStatus() && !"".equals(npcSalesDetailForm.getPartStatus())) { page.addEqualSearch("nsd.partStatus", npcSalesDetailForm.getPartStatus()); } if (null != npcSalesDetailForm.getPartCode() && !"".equals(npcSalesDetailForm.getPartCode())) { page.addEqualSearch("nsd.partCode", npcSalesDetailForm.getPartCode()); } if (null != npcSalesDetailForm.getCustomerName() && !"".equals(npcSalesDetailForm.getCustomerName())) { page.addEqualSearch("nsi.customerName", npcSalesDetailForm.getCustomerName()); } // if(null!=npcSalesDetailForm.getPhone()&&!"".equals(npcSalesDetailForm.getPhone())){ // page.addEqualSearch("nsi.phone", npcSalesDetailForm.getPhone()); // } // 两个框合成一个框 if (null != npcSalesDetailForm.getMobile() && !"".equals(npcSalesDetailForm.getMobile())) { page.setWhere( " and (nsi.mobile='" + npcSalesDetailForm.getMobile() + "' or nsi.phone='" + npcSalesDetailForm.getMobile() + "')"); } if (null != npcSalesDetailForm.getCreateDateStart() && !"".equals(npcSalesDetailForm.getCreateDateStart())) { page.addGreatEqualSearch( "nsd.createDate", Operate.toDate(npcSalesDetailForm.getCreateDateStart())); } if (null != npcSalesDetailForm.getCreateDateEnd() && !"".equals(npcSalesDetailForm.getCreateDateEnd())) { page.addLessSearch( "nsd.createDate", Operate.getNextDate(npcSalesDetailForm.getCreateDateEnd())); } if (null != npcSalesDetailForm.getReasonCode() && !"".equals(npcSalesDetailForm.getReasonCode())) { page.addEqualSearch("nsd.reasonCode", npcSalesDetailForm.getReasonCode()); } if (null != npcSalesDetailForm.getOrganizationCode() && !"".equals(npcSalesDetailForm.getOrganizationCode())) { page.addEqualSearch("nsd.organizationCode", npcSalesDetailForm.getOrganizationCode()); } page.addEqualPropertySearch("nsd.saleNo", "nsi.saleNo"); page.addEqualSearch("nsd.isPre", String.valueOf(SysConstants.SALES_ISPRE)); page.setSelectHql( "select " + "nsd.saleNo," + "nsi.customerName," + "nsd.ascPoNo," + "nsd.partCode," + "nsd.partDescCn," + "nsd.partNum," + "nsd.unitPrice," + "nsd.totalPrice," + "nsd.partStatus," + "nsd.reasonCode," + "nsd.createDate," + "nsd.soId," + "nsd.createBy"); List<Object[]> saleDetailList = npcQuotationSaleQueryDao.list(page); List<NpcSalesDetailForm> npcSalesDetailFormList = new ArrayList<NpcSalesDetailForm>(); for (Object[] obj : saleDetailList) { NpcSalesDetailForm saleDetailForm = new NpcSalesDetailForm(); saleDetailForm.setSaleNo(String.valueOf(obj[0])); saleDetailForm.setCustomerName( String.valueOf(obj[1]) == "null" ? "" : String.valueOf(obj[1])); if (null != String.valueOf(obj[2]) && !"".equals(String.valueOf(obj[2])) && !"null".equals(String.valueOf(obj[2]))) { saleDetailForm.setSource(SysConstants.NPC_SALE_SOURCE_AUTO); } else { saleDetailForm.setSource(SysConstants.NPC_SALE_SOURCE_MANUAL); } saleDetailForm.setAscPoNo(String.valueOf(obj[2]) == "null" ? "" : String.valueOf(obj[2])); saleDetailForm.setPartCode(String.valueOf(obj[3])); saleDetailForm.setPartDescCn(String.valueOf(obj[4])); saleDetailForm.setPartNum((Integer) obj[5]); saleDetailForm.setUnitPrice((Double) obj[6]); saleDetailForm.setTotalPrice((Double) obj[7]); saleDetailForm.setPartStatus(String.valueOf(obj[8])); saleDetailForm.setPartStatusDesc( this.getBaseTableCacheQueryService() .getSystemNameByCode( String.valueOf(obj[8]), SysConstants.SALES_DETAIL_STATUS_PREKEY)); saleDetailForm.setReasonCode(String.valueOf(obj[9])); saleDetailForm.setCreateDate((Date) obj[10]); saleDetailForm.setSoId(Long.valueOf(obj[11].toString())); if (Long.parseLong(obj[12] + "") != -1) saleDetailForm.setCreateByDesc( this.getBaseTableCacheQueryService().getUserNameByUserId(Long.parseLong(obj[12] + ""))); else saleDetailForm.setCreateByDesc(SysConstants.SYSTEM_ADMIN_NAME); npcSalesDetailFormList.add(saleDetailForm); } npcSalesDetailForm.setNpcSalesDetailFormList(npcSalesDetailFormList); }