request->get(); $orderSn = $get['orderSn'] ?? 0; $itemList = PlantCgItemClass::getAllByCondition(['orderSn' => $orderSn], null, '*', null, true); if (empty($itemList)) { util::fail('没有商品'); } $shopId = $this->shopId; $ext = ShopExtClass::getByCondition(['shopId' => $shopId], true); $printLabelSn = $ext->printLabelSn ?? ''; if (empty($printLabelSn)) { util::fail('请设置标签打印机'); } $p = new printUtil($printLabelSn); foreach ($itemList as $key => $item) { $name = $item->name ?? ''; $num = !empty($item->num) ? floatval($item->num) : 0; if (empty($num)) { util::fail('商品数量错误'); } $goodsSn = $item->goodsSn ?? ''; //$price = floatval($item->price); $content = '' . $name . ''; $content .= '' . $goodsSn . ''; if ($key % 2 == 1) { $content .= '.'; } //$content .= '' . $price . ''; $p->times = $num; $p->printLabelMsg($content); } util::complete(); } //打印全部 ssh 20220 public function actionPrintItem() { $get = Yii::$app->request->get(); $id = $get['id'] ?? 0; $item = PlantCgItemClass::getById($id, true); if (empty($item)) { util::fail('没有找到花材'); } $name = $item->name ?? ''; $num = !empty($item->num) ? floatval($item->num) : 0; if (empty($num)) { util::fail('没有花材数量'); } $shopId = $this->shopId; $ext = ShopExtClass::getByCondition(['shopId' => $shopId], true); $printLabelSn = $ext->printLabelSn ?? ''; if (empty($printLabelSn)) { util::fail('请设置标签打印机'); } $p = new printUtil($printLabelSn); $goodsSn = $item->goodsSn ?? ''; //$price = floatval($item->price) ?? 0; $content = '' . $name . ''; $content .= '' . $goodsSn . ''; //$content .= '' . $price . ''; $p->times = $num; $p->printLabelMsg($content); util::complete(); } //采购详情 ssh 2020521 public function actionDetail() { $get = Yii::$app->request->get(); $id = $get['id'] ?? 0; $cg = PlantCgClass::getById($id, true); if ($cg->mainId != $this->mainId) { util::fail('没有权限'); } $itemList = PlantCgItemClass::getItemList($cg); $data = []; $data['hasDebtPay'] = 0; $data['balance'] = 0; $data['info'] = $cg; $data['itemList'] = $itemList; util::success($data); } //采购记录 ssh 20220521 public function actionList() { $get = Yii::$app->request->get(); $where = ['shopId' => $this->shopId]; $status = $get['status'] ?? 0; if (!empty($status)) { $where['status'] = $status; } $respond = PlantCgClass::getCgList($where); $respond['shop'] = $this->shop; util::success($respond); } //获取采购详情 ssh 20220508 public function actionGetFullInfo() { $id = Yii::$app->request->get('id'); $cg = PlantCgClass::getById($id, true); PlantCgClass::valid($cg, $this->mainId); $orderSn = $cg->orderSn ?? ''; $itemList = PlantCgItemClass::getAllByCondition(['orderSn' => $orderSn], null, '*'); util::success(['info' => $cg, 'itemList' => $itemList]); } }