master
ljl 10 months ago
parent dade6896f7
commit 30de78aa63

@ -43,10 +43,10 @@ class WaybillBillController extends AbstractApiController {
/**
* @api GET 获取对账日志
* @param int taskId 任务ID
* @param string type 类型
* @param string type 类型 1-导入且匹配的运单号/2-导入但未匹配的运单号/3-未导入,但本店铺有打印的运单号/4-导入但已回收的运单号/5-上传文件中重复的单号
*/
public function searchWaybillBillLogList() {
$data = $this->waybillBillService->searchDuplicationWaybillBillLogList($this->mallId, $_GET['taskId']);
public function searchTaskWaybillBillLogList() {
$data = $this->waybillBillService->searchTaskWaybillBillLogList($this->mallId, $_GET);
return $this->renderSuccess($data);
}

@ -5,7 +5,20 @@ namespace Dao\OrderPrint;
use Dao\AbstractDao;
class OpWaybillBillLogDao extends AbstractDao {
public function searchPage($mallId, $taskId, $page, $pageSize) {
return $this->queryPage('select * from %b owbl where owbl.mall_id = %i and owbl.op_waybill_bill_task_id = %i', $this->getTable(), $mallId, $taskId, $page, $pageSize);
public function searchPage($mallId, $filter, $page, $pageSize) {
$whereArray = $this->getSearchCondition($filter);
$where = $whereArray ? implode( ' ', $whereArray) : ' ';
return $this->queryPage('select * from %b owbl where owbl.mall_id = %i %l order by gmt_create desc', $this->getTable(), $mallId, $where, $page, $pageSize);
}
private function getSearchCondition($filter) {
$wheres = [];
if (!empty($filter['taskId'])) {
$wheres[] = $this->prepare('and owbl.op_waybill_bill_task_id = %i', $filter['taskId']);
}
if (!empty($filter['type'])) {
$wheres[] = $this->prepare('and owbl.type = %i', $filter['type']);
}
return $wheres;
}
}

@ -287,6 +287,29 @@ class WaybillBillService extends AbstractService {
}
}
public function searchTaskWaybillBillLogList($mallId, $params) {
if ($params['type'] == OrderPrintConst::waybillBillTypeImportAndDuplication) {
list($waybillBillLogList, $total) = $this->searchDuplicationWaybillBillLogList($mallId, $params['taskId']);
} else {
$page = intval($params['page'] ?: 1);
$pageSize = intval($params['pageSize'] ?: 20);
list($waybillBillLogList, $total) = $this->searchWaybillBillLogList($mallId, $params, $page, $pageSize);
}
return [
'waybillBillLogList' => $waybillBillLogList,
'total' => $total,
];
}
public function searchWaybillBillLogList($mallId, $filter, $page, $pageSize) {
list($waybillBillLogList, $total) = $this->opWaybillBillLogDao->searchPage($mallId, $filter, $page, $pageSize);
if (empty($waybillBillLogList)) {
return [$waybillBillLogList, $total];
}
$waybillBillLogList = $this->rebuildWaybillBillLogList($mallId, $waybillBillLogList, $filter['type']);
return [$waybillBillLogList, $total];
}
public function searchDuplicationWaybillBillLogList($mallId, $taskId) {
$taskInfo = $this->opWaybillBillTaskDao->getTask($mallId, $taskId);
if (empty($taskInfo)) {
@ -419,7 +442,7 @@ class WaybillBillService extends AbstractService {
$logisticsNameMap[$logisticsInfo['logisticsId']] = $logisticsInfo['logisticsName'];
while (true) {
list($opWaybillBillLogList, $total) = $this->opWaybillBillLogDao->searchPage($mallId, $taskId, $page, $pageSize);
list($opWaybillBillLogList, $total) = $this->opWaybillBillLogDao->searchPage($mallId, ['taskId' => $taskId], $page, $pageSize);
if (empty($opWaybillBillLogList)) {
break;
}

Loading…
Cancel
Save