ソースを参照

Merge branch 'tree' into zhongqi-itemUpdate

# Conflicts:
#	biz-ghs/order/classes/OrderItemClass.php
#	biz-ghs/product/classes/ProductClass.php
shish 3 ヶ月 前
コミット
6396586b5f

+ 21 - 1
app-ghs/controllers/OrderController.php

@@ -1246,9 +1246,26 @@ class OrderController extends BaseController
                 }
             }
         }
-
         $post['xj'] = $newXj;
 
+        $treeData = $post['treeData'] ?? [];
+        $newTree = [];
+        if (!empty($treeData)) {
+            $treeArr = json_decode($treeData, true);
+            if (!empty($treeArr) && is_array($treeArr)) {
+                foreach ($treeArr as $treeInfo) {
+                    $ptItemId = $treeInfo['ptItemId'] ?? 0;
+                    $treeList = $treeInfo['list'] ?? [];
+                    if (!empty($treeList)) {
+                        foreach ($treeList as $treeItem) {
+                            $newTree[$ptItemId][] = $treeItem;
+                        }
+                    }
+                }
+            }
+        }
+        $post['treeData'] = $newTree;
+
         $productJson = $post['product'] ?? '';
         if (empty($productJson)) {
             util::fail('请选择花材');
@@ -2053,6 +2070,9 @@ class OrderController extends BaseController
         $staffFinance = $staff->finance ?? 0;
         $info['staffFinance'] = $staffFinance;
 
+        $shopBusiness = $shop->business ?? 0;
+        $info['shopBusiness'] = $shopBusiness;
+
         util::success($info);
     }
 

+ 41 - 0
app-ghs/controllers/OrderItemController.php

@@ -19,6 +19,47 @@ class OrderItemController extends BaseController
 
     public $guestAccess = [];
 
+    public function actionPrintItemWlLabel()
+    {
+        $get = Yii::$app->request->get();
+        $orderSn = $get['orderSn'] ?? '';
+        $order = OrderClass::getByCondition(['orderSn' => $orderSn], true);
+        if (empty($order)) {
+            util::fail('没有找到订单');
+        }
+        if ($order->mainId != $this->mainId) {
+            util::fail('不是你的订单');
+        }
+        $id = $get['id'] ?? 0;
+        $orderItem = OrderItemClass::getById($id, true);
+        if (empty($orderItem)) {
+            util::fail('没有花材信息');
+        }
+        if (empty($orderItem->productId)) {
+            util::fail('花材信息缺失');
+        }
+        $productId = $orderItem->productId;
+        if ($orderItem->orderSn != $orderSn) {
+            util::fail('你不能操作');
+        }
+        $product = ProductClass::getById($productId, true);
+        if (empty($product)) {
+            util::fail('花材信息没有找到');
+        }
+        $shop = $this->shop;
+        $ext = $this->shopExt;
+        $num = $get['num'] ?? 0;
+        if ($num <= 0) {
+            util::fail('请填写数量');
+        }
+        $boxNum = $get['boxNum'] ?? 0;
+        if ($boxNum <= 0) {
+            util::fail('请填写装箱数');
+        }
+        OrderClass::printItemLabel($order, $shop, $ext, $product, $num, $boxNum,$orderItem);
+        util::complete('打印成功');
+    }
+
     //过滤名称 ssh 20240430
     public function actionFilterName()
     {

+ 38 - 0
app-ghs/controllers/OrderTreeController.php

@@ -0,0 +1,38 @@
+<?php
+
+namespace ghs\controllers;
+
+use bizGhs\order\classes\OrderClass;
+use bizGhs\order\classes\OrderTreeClass;
+use bizGhs\product\classes\ProductClass;
+use common\components\imgUtil;
+use common\components\util;
+use Yii;
+
+class OrderTreeController extends BaseController
+{
+
+    public function actionGetTree()
+    {
+        $get = Yii::$app->request->get();
+        $orderSn = $get['orderSn'] ?? '';
+        $productId = $get['productId'] ?? '';
+        $order = OrderClass::getByCondition(['orderSn' => $orderSn], true);
+        if (empty($order)) {
+            util::fail('没有找到订单');
+        }
+        if ($order->mainId != $this->mainId) {
+            util::fail('不是你的订单');
+        }
+        $product = ProductClass::getByCondition(['id' => $productId], true);
+        if (empty($product)) {
+            util::fail('没有找到花材');
+        }
+        if ($product->mainId != $this->mainId) {
+            util::fail('不是你的花材');
+        }
+        $list = OrderTreeClass::getAllByCondition(['orderSn' => $orderSn, 'productId' => $productId], 'id asc', '*');
+        util::success(['list' => $list]);
+    }
+
+}

+ 3 - 1
app-ghs/controllers/TestController.php

@@ -490,7 +490,9 @@ class TestController extends BaseController
             //['name' => '厦门都市鲜花批发', 'merchantNo' => '8223930599200HZ', 'wx' => [854245016, 854244735], 'zfb' => '2088280333454097'],
             //['name' => '深圳鼎盛皇室花卉', 'merchantNo' => '8225840599201MF', 'wx' => [807078304, 807076486], 'zfb' => '2088970117746334'],
             //['name' => '昆明花满仓', 'merchantNo' => '82273105992011D', 'wx' => [886442011, 886441824], 'zfb' => '2088480829650284'],
-            ['name' => '梅州紫荆鲜花批发', 'merchantNo' => '82259605992002Q', 'wx' => [888071609, 888012368], 'zfb' => '2088580120134569'],
+            //['name' => '梅州紫荆鲜花批发', 'merchantNo' => '82259605992002Q', 'wx' => [888071609, 888012368], 'zfb' => '2088580120134569'],
+            ['name' => '阜阳润泽鲜花店', 'merchantNo' => '82237205992005M', 'wx' => [889493754, 889491770], 'zfb' => '2088580468011555'],
+            ['name' => '惠达', 'merchantNo' => '8225810599201RH', 'wx' => [889521902, 889520798], 'zfb' => '2088580471883271'],
             //['name' => '东莞惠雅鲜花(莞城店)', 'merchantNo' => '8226020599200GJ', 'wx' => [796953190, 796976959], 'zfb' => '2088770940104912'],
             //['name' => '东莞惠雅鲜花(南城店)', 'merchantNo' => '8226020599200JK', 'wx' => [802315656, 802315755], 'zfb' => '2088870583889365'],
             //['name' => '沈阳市云花鲜花批发-专业化扫码', 'merchantNo' => '8222210599200BT', 'wx' => [796180053], 'zfb' => '2088770820458908'],

+ 2 - 2
biz-ghs/order/classes/CheckOrderClass.php

@@ -429,9 +429,9 @@ class CheckOrderClass extends BaseClass
                         $subAmount = bcadd($subAmount, $amount, 2);
                     }
 
-                    //如果花材是自动补充库存类型的花材,则库存低于900时,自动补充到6850,多处要同步修改,关键词 auto_add_stock
+                    //如果花材是自动补充库存类型的花材,则库存低于900时,自动补充到66820,多处要同步修改,关键词 auto_add_stock
                     if ($productData->virtualStock == 1 && $v['itemNum'] < 900) {
-                        ProductClass::updateStockById($productId, 6850, $adminId);
+                        ProductClass::updateStockById($productId, 66820, $adminId);
                     }
 
                 }

+ 70 - 5
biz-ghs/order/classes/OrderClass.php

@@ -1944,7 +1944,7 @@ class OrderClass extends BaseClass
         /**************************如果是好多花的云仓还要再打一下标签纸,多处要同步修改,关键词 hdh_yc *****************************/
         $orderMainId = $orderInfo['mainId'] ?? 0;
         if (getenv('YII_ENV') == 'production') {
-            $map = [65726, 58, 25119, 28500, 1294,12925];
+            $map = [65726, 58, 25119, 28500, 1294, 12925];
         } else {
             $map = [828];
         }
@@ -3003,7 +3003,7 @@ XL;
         /**************************如果是好多花的云仓还要再打一下标签纸,多处要同步修改,关键词 hdh_yc *****************************/
         $orderMainId = $order->mainId;
         if (getenv('YII_ENV') == 'production') {
-            $map = [65726, 58, 25119, 28500, 1294,12925];
+            $map = [65726, 58, 25119, 28500, 1294, 12925];
         } else {
             $map = [828];
         }
@@ -3096,7 +3096,7 @@ XL;
             $itemNum = floatval($itemNum);
             $payTime = $order->payTime ?? '';
             $payDate = date('m-d H:i', strtotime($payTime));
-            $content = '<TEXT x="400" y="30" font="12" w="3" h="3" r="90">' . $customName . '</TEXT>';
+            $content = '<TEXT x="400" y="30" font="12" w="2" h="2" r="90">' . $customName . '</TEXT>';
             $content .= '<TEXT x="280" y="30" font="12" w="2" h="2" r="90">' . $fullAddress . '</TEXT>';
             $content .= '<TEXT x="180" y="30" font="12" w="2" h="2" r="90">' . $customMobile . '  ' . $itemNum . '扎</TEXT>';
             $content .= '<TEXT x="86" y="30" font="12" w="2" h="2" r="90">' . $distName . ' ' . $payDate . '</TEXT>';
@@ -3106,6 +3106,71 @@ XL;
         return true;
     }
 
+
+    //打印花材的物流标 ssh 20260507
+    public static function printItemLabel($order, $shop, $ext, $product, $num, $boxNum, $orderItem)
+    {
+        $customId = $order->customId ?? 0;
+        $custom = CustomClass::getById($customId, true);
+
+        $customMobile = $order->customMobile ?? '';
+
+        $customName = $order->customName ?? '';
+        $remark = $order->remark ?? '';
+        $shortRemark = stringUtil::subStringUtf8($remark, 8);
+        $wlName = $custom->wlName ?? '';
+        if (empty($wlName)) {
+            $wlName = $shortRemark;
+        }
+        $distId = $custom->distId ?? '';
+        $dist = DistClass::getById($distId, true);
+        $distName = $dist->name ?? '未分区';
+
+        $address = $order->address ?? '';
+        $floor = $order->floor ?? '';
+        $fullAddress = $address . $floor;
+
+        $wlLabelSn = $ext->wlLabelSn ?? '';
+        if (empty($wlLabelSn)) {
+            util::fail('请绑定物流标签机');
+        }
+        $p = new printUtil($wlLabelSn);
+        $p->times = $num;
+        $sameTimeIds = $order->sameTimeIds;
+        $num = 1;
+        if (!empty($sameTimeIds)) {
+            $ids = explode(',', $sameTimeIds);
+            if (!empty($ids)) {
+                $num = count($ids);
+            }
+        }
+        if ($num > 1) {
+            $customName = $customName . ' ' . $num . '单';
+        }
+        $remark = '';
+        if (!empty($orderItem->remark)) {
+            $remark .= $orderItem->remark;
+        }
+        if (!empty($order->remark)) {
+            if(!empty($remark)){
+                $remark .= ' '.$order->remark;
+            }else{
+                $remark .= $order->remark;
+            }
+        }
+
+        $productName = $product->name ?? '';
+        $content = '<TEXT x="400" y="30" font="12" w="2" h="2" r="90">客户:' . $customName . '</TEXT>';
+        $content .= '<TEXT x="325" y="30" font="12" w="2" h="2" r="90">地址:' . $fullAddress . '</TEXT>';
+        $content .= '<TEXT x="250" y="30" font="12" w="2" h="2" r="90">电话:' . $customMobile . '</TEXT>';
+        $content .= '<TEXT x="180" y="30" font="12" w="2" h="2" r="90">备注:' . $remark . '</TEXT>';
+        $content .= '<TEXT x="120" y="30" font="12" w="2" h="2" r="90">————————————————————</TEXT>';
+        $content .= '<TEXT x="60" y="30" font="12" w="2" h="2" r="90">' . $productName . ' 装箱数:' . $boxNum . '</TEXT>';
+        $p->printLabelMsg($content);
+        return true;
+    }
+
+
     // 更新同天内的所有订单的 sameTimeIds
     public static function updateSameTimeIds($order, $date)
     {
@@ -3134,12 +3199,12 @@ XL;
         // 排序并去重
         sort($ids);
         $ids = array_unique($ids);
-        
+
         // 限制最多 90 单,避免 someTimeIds 过长(兼容原先业务逻辑限制)
         if (count($ids) > 90) {
             $ids = array_slice($ids, 0, 90);
         }
-        
+
         $sameTimeIdsStr = implode(',', $ids);
         // 更新所有相关订单
         if (!empty($ids) && in_array($id, $ids)) {

+ 18 - 0
biz-ghs/order/classes/OrderItemClass.php

@@ -381,6 +381,24 @@ class OrderItemClass extends BaseClass
                 }
             }
 
+            if (!empty($post['treeData'][$currentPtItemId])) {
+                $treeData = $post['treeData'][$currentPtItemId];
+                if (is_array($treeData)) {
+                    foreach ($treeData as $treeItem) {
+                        $treeNum = $treeItem['num'] ?? 0;
+                        $treeParam = [
+                            'orderSn' => $orderSn,
+                            'productId' => $productId,
+                            'num' => $treeNum,
+                        ];
+                        OrderTreeClass::add($treeParam);
+                    }
+                    $dishNum = count($treeData);
+                    $item->dishNum = $dishNum;
+                    $item->save();
+                }
+            }
+
             $ratio = $p['ratio'] ?? 0;
             $bigNum = $p['bigNum'] ?? 0;
             $smallNum = $p['smallNum'] ?? 0;

+ 13 - 0
biz-ghs/order/classes/OrderTreeClass.php

@@ -0,0 +1,13 @@
+<?php
+namespace bizGhs\order\classes;
+
+use common\components\util;
+use Yii;
+use bizGhs\base\classes\BaseClass;
+
+class OrderTreeClass extends BaseClass
+{
+
+    public static $baseFile = '\bizGhs\order\models\OrderTree';
+
+}

+ 15 - 0
biz-ghs/order/models/OrderTree.php

@@ -0,0 +1,15 @@
+<?php
+
+namespace bizGhs\order\models;
+
+use bizGhs\base\models\Base;
+
+class OrderTree extends Base
+{
+
+    public static function tableName()
+    {
+        return 'xhGhsOrderTree';
+    }
+
+}

+ 6 - 4
biz-ghs/order/services/OrderService.php

@@ -209,16 +209,17 @@ class OrderService extends BaseService
         //零售采购单时没有传price字段,供货商可以改价会传price字段,这里转成userPrice以便采购单识别使用改的价还是花材原价!
         $currentProduct = $data['product'];
         foreach ($currentProduct as $currentKey => $currentItem) {
-            if (isset($currentProduct[$currentKey]['price'])) {
-                $currentProduct[$currentKey]['userPrice'] = $currentProduct[$currentKey]['price'];
+            if (isset($currentItem['price'])) {
+                $currentProduct[$currentKey]['userPrice'] = $currentItem['price'];
                 unset($currentProduct[$currentKey]['price']);
             }
         }
 
-        $sendTimeWant = isset($data['sendTimeWant']) && !empty($data['sendTimeWant']) ? $data['sendTimeWant'] : date("Y-m-d");
+        $sendTimeWant = !empty($data['sendTimeWant']) ? $data['sendTimeWant'] : date("Y-m-d");
 
         $remark = $data['remark'] ?? '';
         $xj = $data['xj'] ?? '';
+        $treeData = $data['treeData'] ?? [];
         $book = $data['book'] ?? 0;
 		//后端开单,涉及花材满减,关键词 back_order_reach_discount_price
         $reachDiscountPrice = $data['reachDiscountPrice'] ?? 0;
@@ -249,6 +250,7 @@ class OrderService extends BaseService
             'sendType' => $sendType,
             'remark' => $remark,
             'xj' => $xj,
+            'treeData' => $treeData,
             'discount' => 1,
             'mainId' => $cgMainId,
             'wlName' => $wlName,
@@ -256,7 +258,7 @@ class OrderService extends BaseService
             'transType' => $transType,
             'reachDiscountPrice' => $reachDiscountPrice,
         ];
-        if (isset($data['deadline']) && !empty($data['deadline'])) {
+        if (!empty($data['deadline'])) {
             $purchaseData['deadline'] = $data['deadline'];
         }
         if (isset($data['modifyPrice']) && is_numeric($data['modifyPrice'])) {

+ 1 - 1
biz-ghs/order/traits/OrderTrait.php

@@ -127,4 +127,4 @@ trait OrderTrait
     {
 
     }
-}
+}

+ 2 - 0
biz-ghs/product/classes/ProductClass.php

@@ -1550,6 +1550,7 @@ class ProductClass extends BaseClass
             $tmp['limitBuy'] = $currentGhsProduct['limitBuy'];
             $tmp['smallUnitPrice'] = $itemPrice;
             $tmp['classId'] = $classId;
+			$tmp['kind'] = $currentGhsProduct['kind'] ?? 0;
             $tmp['belongCost'] = $currentGhsProduct['belongCost'] ?? 0;
             $tmp['hjDiscountPrice'] = $currentGhsProduct['hjDiscountPrice'];
             $tmp['discountPrice'] = $currentGhsProduct['discountPrice'];
@@ -3168,3 +3169,4 @@ class ProductClass extends BaseClass
     }
 
 }
+

+ 13 - 0
biz-hd/cg/classes/CgTreeClass.php

@@ -0,0 +1,13 @@
+<?php
+
+namespace bizHd\cg\classes;
+
+use Yii;
+use bizGhs\base\classes\BaseClass;
+
+class CgTreeClass extends BaseClass
+{
+
+    public static $baseFile = '\bizHd\cg\models\CgTree';
+
+}

+ 15 - 0
biz-hd/cg/models/CgTree.php

@@ -0,0 +1,15 @@
+<?php
+
+namespace bizHd\cg\models;
+
+use bizHd\base\models\Base;
+
+class CgTree extends Base
+{
+
+    public static function tableName()
+    {
+        return 'xhCgTree';
+    }
+
+}

+ 21 - 4
biz-hd/purchase/classes/PurchaseClass.php

@@ -20,6 +20,7 @@ use bizGhs\product\classes\ProductClass;
 use bizGhs\stock\classes\OnStockRecordClass;
 use bizGhs\stock\classes\StockRecordClass;
 use bizHd\cg\classes\CgRefundClass;
+use bizHd\cg\classes\CgTreeClass;
 use bizHd\cg\classes\CgXjClass;
 use bizHd\shop\classes\MainClass;
 use bizHd\stat\classes\StatIncomeClass;
@@ -815,6 +816,7 @@ class PurchaseClass extends BaseClass
             $itemId = $hdProductData[$hdProductId]['itemId'] ?? 0;
             $rank = $hdProductData[$hdProductId]['rank'] ?? 'B';
             $stock = $hdProductData[$hdProductId]['stock'] ?? 0;
+            $kind = $hdProductData[$hdProductId]['kind'] ?? 0;
             $stockFormat = ProductClass::formatStock($stock, $ratio);
 
             $limitKey = ProductClass::LIMIT_BUY_KEY . $hdProductId;
@@ -908,6 +910,7 @@ class PurchaseClass extends BaseClass
             $productList[$key]['ghsId'] = $ghsId;
             $productList[$key]['name'] = $itemName;
             $productList[$key]['cover'] = $cover;
+            $productList[$key]['kind'] = $kind;
 
             $currentBigUnit = $hdProductData[$hdProductId]['bigUnit'] ?? '';
             $currentSmallUnit = $hdProductData[$hdProductId]['smallUnit'] ?? '';
@@ -1071,14 +1074,14 @@ class PurchaseClass extends BaseClass
         //保存订单
         $respond = self::add($data, true);
 
-        foreach ($productList as $productKey => $productVal) {
+        foreach ($productList as $productVal) {
             //增加采购单的花材
             $returnItem = PurchaseItemClass::add($productVal, true);
-
+            $productId = $productVal['productId'];
             $unitPrice = $returnItem->price ?? 0;
             $currentId = $returnItem->id ?? 0;
             $currentPtItemId = $returnItem->itemId ?? 0;
-            if (isset($data['xj'][$currentPtItemId]) && !empty($data['xj'][$currentPtItemId])) {
+            if (!empty($data['xj'][$currentPtItemId])) {
                 $xjArr = $data['xj'][$currentPtItemId];
                 if (is_array($xjArr)) {
                     $ids = array_column($xjArr, 'id');
@@ -1097,7 +1100,21 @@ class PurchaseClass extends BaseClass
                     $returnItem->save();
                 }
             }
-
+            if (!empty($data['treeData'][$currentPtItemId])) {
+                $myTreeData = $data['treeData'][$currentPtItemId];
+                foreach($myTreeData as $treeItem) {
+                    $treeNum = $treeItem['num'] ?? 0;
+                    $treeParams = [
+                        'orderSn' => $orderSn,
+                        'num' => $treeNum,
+                        'productId' => $productId,
+                    ];
+                    CgTreeClass::add($treeParams);
+                    $dishNum = count($myTreeData);
+                    $returnItem->dishNum = $dishNum;
+                    $returnItem->save();
+                }
+            }
         }
 
         $shop = ShopClass::getLockById($shopId);

+ 0 - 1
biz-hd/stat/classes/StatStudentClass.php

@@ -20,7 +20,6 @@ class StatStudentClass extends BaseClass
             $stat = self::add(['shopId' => $shopId, 'sjId' => $sjId, 'time' => $date], true);
         }
         $stat->riseNum += 1;
-        $stat->totalNum = $shop->totalStudent + 1;
         $stat->save();
         StatStudentMonthClass::addStudent($shop);
     }

+ 0 - 1
biz-hd/stat/classes/StatStudentMonthClass.php

@@ -21,7 +21,6 @@ class StatStudentMonthClass extends BaseClass
             $stat = self::add(['sjId' => $sjId, 'shopId' => $shopId, 'time' => $month], true);
         }
         $stat->riseNum += 1;
-        $stat->totalNum = $shop['totalStudent'] + 1;
         $stat->save();
     }
 

+ 2 - 2
common/components/book.php

@@ -97,12 +97,12 @@ class book
         ],
         'chargeStandard' => [
             ['style' => 'info', 'value' => '软件年费1580元,年费需每年付一次,客户通过小程序下单,会扣0.33手续费,即100元扣3毛3。',],
-            ['style' => 'info', 'value' => '根据你自身门店情况,选择以下套餐。下面列出的套餐,已经过全国200多家鲜花批发店和12万家花店磨合使用,非常成熟好用,请放心购买使用,以下套餐已含第一年年费。',],
+            ['style' => 'info', 'value' => '根据你自身门店情况,选择以下套餐。下面列出的套餐,已经过全国200多家鲜花批发店和13万家花店磨合使用,非常成熟好用,请放心购买使用,以下套餐已含第一年年费。',],
             ['style' => 'miniTitle', 'value' => '软件的研发成本巨大,不管是年费、费率和套餐,都已经底价,已无商谈的空间,请理解。付费后不支持退货。',],
             ['style' => 'miniTitle', 'value' => '以下硬件请通过我们来购买,公司统一跟厂家采购,售后各方面比较有保障。',],
             ['style' => 'info', 'value' => '小票机和标签机,使用的是飞鹅4G带切刀版本,比较好维护,里面带流量卡的,第二年开始,每年要充60块话费。请不要贪便宜使用wifi版,维护成本很高,很容易出问题。',],
             ['style' => 'info', 'value' => '提供上门培训服务,培训时间3天,需报销差旅住宿费用,公司地址在福建厦门。',],
-            ['style' => 'info', 'value' => '有多家店的,第一家店年费1580元,第二家店半价790元,第三家到第六家暂不收费,第七家起另议。要自己控股的店,才能算自己的。',],
+            ['style' => 'info', 'value' => '首家年费1580元,第二家起年费800元',],
             ['style' => 'smallTitle', 'value' => '仓库版',],
             ['style' => 'info', 'value' => '整套软件功能(一年)',],
             ['style' => 'info', 'value' => '小票机1台',],