|
|
@@ -24,6 +24,33 @@ class ProductController extends BaseController
|
|
|
|
|
|
public $guestAccess = ['index'];
|
|
|
|
|
|
+ //打印花材的条码 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;
|
|
|
+
|
|
|
+ $ext = $this->shopExt;
|
|
|
+ $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();
|
|
|
+ }
|
|
|
+
|
|
|
//按分类列出所有花材
|
|
|
public function actionIndex()
|
|
|
{
|