فهرست منبع

兼容处理,实现控制是否发发货通知

shizhongqi 4 ماه پیش
والد
کامیت
87ea3895df

+ 69 - 0
app-hd/controllers/PartController.php

@@ -2,11 +2,13 @@
 
 namespace hd\controllers;
 
+use biz\shop\classes\ShopExtClass;
 use bizGhs\product\classes\ProductClass;
 use bizHd\part\classes\PartClass;
 use bizHd\part\classes\PartItemClass;
 use common\components\dict;
 use common\components\imgUtil;
+use common\components\printUtil;
 use common\components\util;
 use Yii;
 
@@ -114,4 +116,71 @@ class PartController extends BaseController
         }
     }
 
+    //打印拆散订单
+    public function actionPrintOrder()
+    {
+        $get = Yii::$app->request->get();
+        $orderSn = $get['orderSn'] ?? '';
+        if (empty($orderSn)) {
+            util::fail('参数错误');
+        }
+
+        $info = PartClass::getByCondition(['orderSn' => $orderSn], true);
+        if (empty($info)) {
+            util::fail('没有找到拆散单');
+        }
+        if ($info->mainId != $this->mainId) {
+            util::fail('没有权限');
+        }
+
+        $itemList = PartItemClass::getAllByCondition(['orderSn' => $orderSn], null, '*');
+        if (empty($itemList)) {
+            util::fail('没有花材需要打印');
+        }
+
+        $currentShopId = $this->admin->currentGhsShopId;
+        $ext = ShopExtClass::getByCondition(['shopId' => $currentShopId], true);
+        $printSn = is_array($ext) ? ($ext['printSn'] ?? '') : ($ext->printSn ?? '');
+        $printKey = is_array($ext) ? ($ext['printKey'] ?? '') : ($ext->printKey ?? '');
+        if (!empty($printSn) || empty($printKey)) {
+            util::success(['hasNoPrint' => 1]);
+        }
+
+        $shop = $this->shop;
+        $sj = $this->sj;
+        $sjName = $sj->name ?? '';
+        $shopName = $shop->shopName ?? '';
+        $currentName = $shopName == '首店' ? $sjName : $sjName . ' ' . $shopName;
+
+        $kindNum = 0;
+        $totalNum = 0;
+        $content = "<CB>{$currentName}</CB><BR>";
+        $content .= "<CB>拆散单</CB><BR>";
+        $content .= '商品             数量 <BR>';
+        $content .= '--------------------------------<BR>';
+        foreach ($itemList as $current) {
+            $name = $current['name'] ?? '';
+            $num = $current['itemNum'] ?? 0;
+            $content .= '<B>' . $name . '    ' . floatval($num) . '扎' . "</B><BR>";
+            $content .= '--------------------------------<BR>';
+            $kindNum = bcadd($kindNum, 1);
+            $totalNum = bcadd($totalNum, $current['itemNum']);
+        }
+        if (!empty($info->remark)) {
+            $content .= '备注:' . $info->remark . '<BR>';
+        }
+        $content .= '<BR>';
+        $content .= '********************************<BR>';
+        $content .= "<CB>共{$kindNum}种,{$totalNum}扎";
+        $content .= "</CB>";
+        $content .= '********************************<BR>';
+        $content .= '<BR>';
+        $content .= "订单编号:{$orderSn}<BR>";
+        $content .= '拆散人员:' . ($info->shopAdminName ?? '') . '<BR>';
+
+        $p = new printUtil($printSn);
+        $p->printMsg($content, $shop, $orderSn);
+
+        util::complete('打印成功');
+    }
 }

+ 4 - 2
biz-ghs/order/classes/OrderClass.php

@@ -461,7 +461,8 @@ class OrderClass extends BaseClass
         if ($order->status == 2) {
             $staffId = $params['staffId'] ?? 0;
             $staffName = $params['staffName'] ?? '';
-            $element = ['staffId' => $staffId, 'staffName' => $staffName];
+            $notice = $params['notice'] ?? true;
+            $element = ['staffId' => $staffId, 'staffName' => $staffName, 'notice' => $notice];
             self::orderSend($order, $element, true);
             $cg = PurchaseClass::getById($cgId, true);
         }
@@ -492,7 +493,8 @@ class OrderClass extends BaseClass
         if (empty($cgInfo)) {
             util::fail('没有找到采购信息');
         }
-        PurchaseClass::orderFh($cgInfo, $params, $allowRepeat, true);
+        $notice = isset($params['notice']) ? $params['notice'] : true; // 兼容处理,实现控制是否发发货通知
+        PurchaseClass::orderFh($cgInfo, $params, $allowRepeat, $notice);
     }
 
     //取消发货 ssh 20250917

+ 0 - 1
biz-ghs/part/classes/PartClass.php

@@ -10,7 +10,6 @@ use bizGhs\stock\classes\StockRecordClass;
 use common\components\dict;
 use common\components\orderSn;
 use common\components\util;
-use Yii;
 
 class PartClass extends BaseClass
 {

+ 1 - 1
console/controllers/GhsOrderController.php

@@ -70,7 +70,7 @@ class GhsOrderController extends Controller
         if (empty($mainIds)) {
             return;
         }
-        $params = ['staffId' => 0, 'staffName' => ''];
+        $params = ['staffId' => 0, 'staffName' => '', 'notice' => false];
         foreach ($mainIds as $mainId) {
             $condition = array_merge(['mainId' => $mainId], $extraCondition);
             $orders = OrderClass::getAllByCondition($condition, 'id asc', '*', null, true);