request->get(); $id = $get['id'] ?? 0; $num = $get['num'] ?? 0; if(empty($num)){ util::fail('请填写下架数量'); } $shop = $this->shop; $bookSn = $shop->bookSn ?? 0; if (empty($bookSn)) { util::fail('预订没有开户'); } $book = BookItemCustomClass::getById($id, true); if (empty($book) || $book->bookSn != $bookSn) { util::fail('当前无法操作'); } $staff = $this->shopAdmin; $staffId = $staff->id ?? 0; $staffName = $staff->name ?? ''; $params = ['staffId' => $staffId, 'staffName' => $staffName, 'staff' => $staff]; BookItemCustomClass::goOff($book, $shop, $params, $num); util::complete('操作成功'); } //标记装箱 ssh 20240721 public function actionToBox() { $get = Yii::$app->request->get(); $id = $get['id'] ?? 0; $shop = $this->shop; $bookSn = $shop->bookSn ?? 0; if (empty($bookSn)) { util::fail('预订没有开户'); } $book = BookItemCustomClass::getById($id, true); if (empty($book) || $book->bookSn != $bookSn) { util::fail('当前无法操作'); } BookItemCustomClass::toBox($book); util::complete('操作成功'); } //取消装箱 ssh 20240721 public function actionCancelBox() { $get = Yii::$app->request->get(); $id = $get['id'] ?? 0; $shop = $this->shop; $bookSn = $shop->bookSn ?? 0; if (empty($bookSn)) { util::fail('预订没有开户'); } $book = BookItemCustomClass::getById($id, true); if (empty($book) || $book->bookSn != $bookSn) { util::fail('当前无法操作'); } BookItemCustomClass::cancelBox($book); util::complete('操作成功'); } //仓库有货上架和上齐 ssh 20240721 public function actionGoOn() { $get = Yii::$app->request->get(); $id = $get['id'] ?? 0; $num = $get['num'] ?? 0; $shop = $this->shop; $bookSn = $shop->bookSn ?? 0; if (empty($bookSn)) { util::fail('预订没有开户'); } $book = BookItemCustomClass::getById($id, true); if (empty($book) || $book->bookSn != $bookSn) { util::fail('当前无法操作'); } $staff = $this->shopAdmin; $staffId = $staff->id ?? 0; $staffName = $staff->name ?? ''; $params = ['staffId' => $staffId, 'staffName' => $staffName, 'staff' => $staff]; BookItemCustomClass::goOn($book, $shop, $params, $num); util::complete('操作成功'); } //预订客户列表 ssh 20240616 public function actionList() { $get = Yii::$app->request->get(); $where = []; $where['mainId'] = $this->mainId; $bookSn = $get['bookSn'] ?? ''; if (empty($bookSn)) { $shop = $this->shop; $bookSn = $shop->bookSn ?? 0; if (empty($bookSn)) { util::success(['list' => [], 'hint' => 'no bookSn']); } } $where['bookSn'] = $bookSn; $customId = $get['customId'] ?? 0; if (!empty($customId)) { $where['customId'] = $customId; } $itemId = $get['itemId'] ?? 0; $remainNum = 0; $remainName = ''; if (!empty($itemId)) { $where['itemId'] = $itemId; //显示剩余数量 $product = ProductClass::getById($itemId, true); $booItem = BookItemClass::getByCondition(['bookSn' => $bookSn, 'itemId' => $itemId], true); if (!empty($booItem)) { $stock = $product->stock ?? 0; $onNum = $booItem->onNum ?? 0; $remainNum = bcsub($stock, $onNum); $remainName = $product->name ?? ''; } } $list = BookItemCustomClass::getAllByCondition($where, '(bookNum-onNum) DESC', '*'); util::success(['list' => $list, 'remainNum' => $remainNum, 'remainName' => $remainName]); } }