params[ 'page' ]) ? $this->params[ 'page' ] : 1; $page_size = isset($this->params[ 'page_size' ]) ? $this->params[ 'page_size' ] : PAGE_LIST_ROWS; $search_text = isset($this->params[ 'search_text' ]) ? $this->params[ 'search_text' ] : ''; $store_id = $this->store_id; $condition = array ( [ 'site_id', '=', $this->site_id ], [ 'type', '=', 'input' ] ); if ($store_id > 0) { $condition[] = [ 'store_id', 'in', $store_id ]; } if (!empty($search_text)) { $condition[] = [ 'document_no', 'like', '%' . $search_text . '%' ]; } $result = $document_model->getDocumentPageList($condition, $page, $page_size, 'create_time desc'); return $this->response($result); } /** * 创建入库单 */ public function stockin() { $stock_json = isset($this->params[ 'stock_json' ]) ? $this->params[ 'stock_json' ] : ''; $stock_array = json_decode($stock_json, true); $store_id = $this->store_id; $document_model = new Document(); $result = $document_model->addPurchase([ 'site_id' => $this->site_id, 'store_id' => $store_id, 'user_info' => $this->user_info, 'goods_sku_list' => $stock_array, ]); return $this->response($result); } /** * 入库单详情 */ public function detail() { $document_id = isset($this->params[ 'document_id' ]) ? (int) $this->params[ 'document_id' ] : 0; $document_model = new Document(); $condition = array ( [ 'site_id', '=', $this->site_id ], [ 'document_id', '=', $document_id ], [ 'type', '=', 'input' ], [ 'store_id', '=', $this->store_id ], ); $document_detail = $document_model->getDocumentInfo($condition); return $this->response($document_detail); } }