params[ 'page' ]) ? $this->params[ 'page' ] : 1; $page_size = isset($this->params[ 'page_size' ]) ? $this->params[ 'page_size' ] : PAGE_LIST_ROWS; $allot_no = isset($this->params[ 'allot_no' ]) ? $this->params[ 'allot_no' ] : ''; $store_id = $this->store_id; $condition = array ( [ 'site_id', '=', $this->site_id ], ); $condition[] = [ 'output_store_id|input_store_id', '=', $store_id ]; if ($allot_no) { $condition[] = [ 'allot_no', '=', $allot_no ]; } $result = $allot_model->getStockAllotPageList($condition, $page, $page_size, 'create_time desc'); return $this->response($result); } /** * 详情 */ public function detail() { $allot_id = isset($this->params[ 'allot_id' ]) ? $this->params[ 'allot_id' ] : 0; $condition = array ( [ 'site_id', '=', $this->site_id ], [ 'allot_id', '=', $allot_id ], [ 'output_store_id|input_store_id', '=', $this->store_id ] ); $allot_model = new Allot(); $detail = $allot_model->getAllotInfo($condition); return $this->response($detail); } /** * 创建调拨单 */ public function addAllocate() { $type = $this->params[ 'allot_type' ] ?? '';//in out $store_id = $this->params[ 'temp_store_id' ] ?? 0; if ($type == 'in') { $output_store_id = $store_id; $input_store_id = $this->store_id; } else { $output_store_id = $this->store_id; $input_store_id = $store_id; } $allot_model = new Allot(); $data = [ 'output_store_id' => $output_store_id, 'input_store_id' => $input_store_id, 'remark' => $this->params[ 'remark' ] ?? '', 'goods_sku_list' => !empty($this->params[ 'goods_sku_list' ]) ? json_decode($this->params[ 'goods_sku_list' ], true) : [], 'allot_time' => !empty($this->params[ 'allot_time' ]) ? date_to_time($this->params[ 'allot_time' ]) : 0, 'operater' => $this->uid, 'site_id' => $this->site_id ]; $result = $allot_model->addAllot($data); return $this->response($result); } }