|
|
@@ -2,14 +2,84 @@
|
|
|
|
|
|
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 ?? '';
|
|
|
+ $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">' . $goodsSn . '</BC128>';
|
|
|
+ if ($key % 2 == 1) {
|
|
|
+ $content .= '<TEXT x="265" y="110" font="12" w="3" h="3" r="0">.</TEXT>';
|
|
|
+ }
|
|
|
+ $p->printLabelMsg($content);
|
|
|
+ }
|
|
|
+ util::complete();
|
|
|
+ }
|
|
|
+
|
|
|
+ //打印全部 ssh 20220
|
|
|
+ public function actionPrintItem()
|
|
|
+ {
|
|
|
+ $get = Yii::$app->request->get();
|
|
|
+ $id = $get['id'] ?? 0;
|
|
|
+ $item = PurchaseOrderItemClass::getById($id, true);
|
|
|
+ if (empty($item)) {
|
|
|
+ util::fail('没有找到花材');
|
|
|
+ }
|
|
|
+ $name = $item->name ?? '';
|
|
|
+ $num = !empty($item->itemNum) ? floatval($item->itemNum) : 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 ?? '';
|
|
|
+ $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">' . $goodsSn . '</BC128>';
|
|
|
+ $p->printLabelMsg($content);
|
|
|
+ util::complete();
|
|
|
+ }
|
|
|
+
|
|
|
//采购详情 ssh 2020521
|
|
|
public function actionDetail()
|
|
|
{
|