|
|
@@ -52,10 +52,12 @@ class ShopExtController extends BaseController
|
|
|
$shopId = $this->shopId;
|
|
|
$ext = ShopExtClass::getByCondition(['shopId' => $shopId], true);
|
|
|
$get = Yii::$app->request->get();
|
|
|
+
|
|
|
$printSn = $get['printSn'] ?? '';
|
|
|
$printKey = $get['printKey'] ?? '';
|
|
|
$printLabelSn = $get['printLabelSn'] ?? '';
|
|
|
$printLabelKey = $get['printLabelKey'] ?? '';
|
|
|
+
|
|
|
$shop = $this->shop;
|
|
|
$default = $shop->default ?? 0;
|
|
|
$shopName = $shop->shopName ?? '';
|
|
|
@@ -96,6 +98,68 @@ class ShopExtController extends BaseController
|
|
|
util::complete();
|
|
|
}
|
|
|
|
|
|
+ //添加打印机 ssh 20210712
|
|
|
+ public function actionAddMakePrint()
|
|
|
+ {
|
|
|
+
|
|
|
+ $shopAdmin = $this->shopAdmin;
|
|
|
+ $roleId = $shopAdmin['roleId'] ?? 0;
|
|
|
+ $role = AdminRoleClass::getById($roleId);
|
|
|
+ $roleName = $role['roleName'] ?? '';
|
|
|
+ if ($roleName == '员工') {
|
|
|
+ util::fail('没有权限操作哦');
|
|
|
+ }
|
|
|
+
|
|
|
+ $shopId = $this->shopId;
|
|
|
+ $ext = ShopExtClass::getByCondition(['shopId' => $shopId], true);
|
|
|
+ $get = Yii::$app->request->get();
|
|
|
+
|
|
|
+ $printSn = $get['printSn'] ?? '';
|
|
|
+ $printKey = $get['printKey'] ?? '';
|
|
|
+ $printLabelSn = $get['printLabelSn'] ?? '';
|
|
|
+ $printLabelKey = $get['printLabelKey'] ?? '';
|
|
|
+
|
|
|
+ $shop = $this->shop;
|
|
|
+ $default = $shop->default ?? 0;
|
|
|
+ $shopName = $shop->shopName ?? '';
|
|
|
+ $sj = $this->sj;
|
|
|
+ $sjName = $sj->name ?? '';
|
|
|
+ $name = $default == 1 ? $sjName : $sjName . ' ' . $shopName;
|
|
|
+ if (!empty($printSn) && !empty($printKey)) {
|
|
|
+ $print = new printUtil($printSn);
|
|
|
+ $return = $print->addPrint($printKey, $name);
|
|
|
+ if ($return) {
|
|
|
+ $ext->makePrintSn = $printSn;
|
|
|
+ $ext->makePrintKey = $printKey;
|
|
|
+ $ext->save();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $ext->makePrintSn = '';
|
|
|
+ $ext->makePrintKey = '';
|
|
|
+ $ext->save();
|
|
|
+ }
|
|
|
+ if (!empty($printLabelSn) && !empty($printLabelKey)) {
|
|
|
+ $labelPrint = new printUtil($printLabelSn);
|
|
|
+ $return = $labelPrint->addPrint($printLabelKey, $name);
|
|
|
+ if ($return) {
|
|
|
+ $ext->makePrintLabelSn = $printLabelSn;
|
|
|
+ $ext->makePrintLabelKey = $printLabelKey;
|
|
|
+ $ext->save();
|
|
|
+
|
|
|
+ //将打印纸张设置为50X70
|
|
|
+ $labelPrint->times = 1;
|
|
|
+ $content = '<SIZE>50,70</SIZE>';
|
|
|
+ $labelPrint->printLabelMsg($content);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $ext->makePrintLabelSn = '';
|
|
|
+ $ext->makePrintLabelKey = '';
|
|
|
+ $ext->save();
|
|
|
+ }
|
|
|
+ util::complete();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//获取打印机信息
|
|
|
public function actionGetPrint()
|
|
|
{
|