$startTimestamp = strtotime($startDate); $endTimestamp = strtotime($endDate);
$start = date('Y-m-d 00:00:00', $startTimestamp);
$end = date('Y-m-d 23:59:59', $endTimestamp);
if(empty($startDate)) {
throw new \Exception('起始时间不为空', BaseException::ERROR_CODE_ILLEGAL_PARAMETER);
}
if (empty($endDate)) {
$endDate = $startDate;
}
$startTimestamp = strtotime($startDate);
$endTimestamp = strtotime($endDate);
if ($startTimestamp > $endTimestamp) {
throw new \Exception('时间参数错误', BaseException::ERROR_CODE_ILLEGAL_PARAMETER);
}
if ($status == InventoryOrder::STATUS_SUBMITTED) {
$index = 'i.submitTime';
} else if ($status == InventoryOrder::STATUS_UNSUBMITTED) {
$index = 'i.createTime';
} else if (empty($status)) {
$index = 'i.createTime';
} else {
throw new \Exception('时间格式不正确', BaseException::ERROR_CODE_ILLEGAL_PARAMETER);
}
$sql = 'SELECT i FROM AppBundle:InventoryOrder i WHERE ';
$sql .= $index;
$sql .= ' BETWEEN :startDate AND :endDate ';
$start = date('Y-m-d 00:00:00', $startTimestamp);
$end = date('Y-m-d 23:59:59', $endTimestamp);
$params['endDate'] = $end;
$params['startDate'] = $start;
if (!empty($status)) {
$sql .= ' AND i.status = :status';
$params['status'] = $status;
}
$sql .=' ORDER By i.createTime DESC';
$query = $this->entityManager->createQuery($sql);
$orderList = $query->setParameters($params)->getResult();
@ ->field('submit_time')->gt(new \DateTime($start))
->field('submit_time')->lt(new \DateTime($end))
$query->field('status')->equals($status);
$data = array();
if (!isset($startDate)) {
throw new \Exception("参数不正确", BaseException::ERROR_CODE_ILLEGAL_PARAMETER);
}
if (empty($endDate)) {
$endDate = $startDate;
}
$startTimestamp = strtotime($startDate);
$endTimestamp = strtotime($endDate);
if ($startTimestamp > $endTimestamp) {
throw new \Exception("参数不正确", BaseException::ERROR_CODE_ILLEGAL_PARAMETER);
}
$start = date('Y-m-d 00:00:00', $startTimestamp);
$end = date('Y-m-d 23:59:59', $endTimestamp);
$scanner = Order::FROM_TYPE_SCANNER;
$query = $this->documentManager
->createQueryBuilder('AppBundle:Order')
->field('submit_time')->gt(new \DateTime($start))
->field('submit_time')->lt(new \DateTime($end))
->field('from_type')->equals("$scanner");
if (!empty($status) && in_array($status, array(Order::STATUS_CANCELLED, Order::STATUS_SUBMITTED))) {
$status = $status + 0;
$query->field('status')->equals($status);
} else if (empty($status)) {
$status = Order::STATUS_SUBMITTED + 0;
$query->field('status')->equals($status);
} else {
throw new \Exception("参数不正确", BaseException::ERROR_CODE_ILLEGAL_PARAMETER);
}
$orderList = $query->sort('create_time', 'DESC')
->getQuery()
->execute();
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有