|
|
@@ -5,10 +5,12 @@ namespace hd\controllers;
|
|
|
use biz\ghs\classes\GhsClass;
|
|
|
use biz\item\classes\PtItemClass;
|
|
|
use biz\shop\classes\ShopClass;
|
|
|
+use biz\shop\classes\ShopExtClass;
|
|
|
use bizGhs\item\classes\ItemClassClass;
|
|
|
use bizGhs\product\classes\ProductClass;
|
|
|
use bizGhs\product\services\ProductService;
|
|
|
use bizHd\item\classes\ItemClass;
|
|
|
+use common\components\printUtil;
|
|
|
use common\components\stringUtil;
|
|
|
use common\components\util;
|
|
|
use Yii;
|
|
|
@@ -18,6 +20,34 @@ class ProductController extends BaseController
|
|
|
|
|
|
public $guestAccess = ['ghs-item'];
|
|
|
|
|
|
+ //打印花材的条码 ssh 20220602
|
|
|
+ public function actionPrint()
|
|
|
+ {
|
|
|
+ $get = Yii::$app->request->get();
|
|
|
+ $id = $get['id'] ?? 0;
|
|
|
+ $num = $get['num'] ?? 1;
|
|
|
+ $info = ProductClass::getById($id, true);
|
|
|
+ if (empty($info)) {
|
|
|
+ util::fail('没有找到花材');
|
|
|
+ }
|
|
|
+ $name = $info->name ?? '';
|
|
|
+ $ptItemId = $info->itemId ?? 0;
|
|
|
+
|
|
|
+ $shopId = $this->shopId;
|
|
|
+ $ext = ShopExtClass::getByCondition(['shopId' => $shopId], true);
|
|
|
+ $printLabelSn = $ext->printLabelSn ?? '';
|
|
|
+ if (empty($printLabelSn)) {
|
|
|
+ util::fail('请设置条码打印机');
|
|
|
+ }
|
|
|
+ $p = new printUtil($printLabelSn);
|
|
|
+
|
|
|
+ $p->times = $num;
|
|
|
+ $content = '<TEXT x="50" y="20" font="12" w="2" h="2" r="0">' . $name . '</TEXT>';
|
|
|
+ $content .= '<BC128 x="50" y="90" h="80" s="1" r="0" n="2" w="2">' . $ptItemId . '</BC128>';
|
|
|
+ $p->printLabelMsg($content);
|
|
|
+ util::complete();
|
|
|
+ }
|
|
|
+
|
|
|
//新增花材 2021.6.21
|
|
|
public function actionAdd()
|
|
|
{
|