| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?php
- namespace hd\controllers;
- use biz\shop\classes\ShopExtClass;
- use bizHd\goods\classes\PlantCgClass;
- use bizHd\goods\classes\PlantCgItemClass;
- use common\components\printUtil;
- use common\components\util;
- use Yii;
- class PlantCgController extends BaseController
- {
- //打印全部 ssh 20220602
- public function actionPrintAll()
- {
- $get = Yii::$app->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 = '<TEXT x="30" y="45" font="12" w="2" h="2" r="0">' . $name . '</TEXT>';
- $content .= '<BC128 x="30" y="115" h="75" s="1" r="0" n="3" w="10">' . $goodsSn . '</BC128>';
- if ($key % 2 == 1) {
- $content .= '<TEXT x="6" y="0" font="12" w="2" h="2" r="0">.</TEXT>';
- }
- //$content .= '<TEXT x="30" y="250" font="11" w="2" h="2" r="0">' . $price . '</TEXT>';
- $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]);
- }
- }
|