Kaynağa Gözat

工单列表

shish 4 yıl önce
ebeveyn
işleme
e34fdf990b

+ 2 - 2
app-hd/controllers/CategoryController.php

@@ -14,8 +14,8 @@ class CategoryController extends BaseController
     public function actionList()
     {
         $get = Yii::$app->request->get();
-        $property = $get['property'] ?? '';
-        $list = CategoryService::getCategoryList($this->sjId, $property);
+        $flower = $get['flower'] ?? '';
+        $list = CategoryService::getCategoryList($this->mainId, $flower);
         util::success($list);
     }
 

+ 9 - 1
app-hd/controllers/WorkController.php

@@ -3,6 +3,7 @@
 namespace hd\controllers;
 
 use bizHd\work\classes\WorkClass;
+use common\components\orderSn;
 use common\components\util;
 use Yii;
 
@@ -28,7 +29,14 @@ class WorkController extends BaseController
     //新建工单 shish 20220319
     public function actionCreate()
     {
-
+        $post = Yii::$app->request->post();
+        $post['mainId'] = $this->mainId ?? 0;
+        $post['sjId'] = $this->sjId ?? 0;
+        $post['shopId'] = $this->shopId ?? 0;
+        $orderSn = orderSn::getWorkSn();
+        $post['orderSn'] = $orderSn;
+        $work = WorkClass::add($post, true);
+        util::success(['info' => $work]);
     }
 
 }

+ 16 - 18
biz-hd/goods/services/CategoryService.php

@@ -17,11 +17,11 @@ class CategoryService extends BaseService
     public static $baseFile = '\bizHd\goods\classes\CategoryClass';
 
     //取所有的分类 ssh 2019.12.7
-    public static function getCategoryList($sjId, $property = '')
+    public static function getCategoryList($mainId, $flower = '')
     {
-        $where = ['sjId' => $sjId, 'delStatus' => 0];
-        if (is_numeric($property)) {
-            $where['property'] = $property;
+        $where = ['mainId' => $mainId, 'delStatus' => 0];
+        if (is_numeric($flower)) {
+            $where['flower'] = $flower;
         }
         $cat = CategoryClass::getAllByCondition($where, 'inTurn DESC', '*');
         if (empty($cat)) {
@@ -37,9 +37,9 @@ class CategoryService extends BaseService
     }
 
     //取出可用的分类 ssh 2019.12.2
-    public static function getEnableList($sjId)
+    public static function getEnableList($mainId)
     {
-        $cat = CategoryClass::getAllByCondition(['sjId' => $sjId, 'delStatus' => 0, 'status' => 1], 'inTurn DESC', '*');
+        $cat = CategoryClass::getAllByCondition(['mainId' => $mainId, 'delStatus' => 0, 'status' => 1], 'inTurn DESC', '*');
         if (empty($cat)) {
             return [];
         }
@@ -52,24 +52,24 @@ class CategoryService extends BaseService
     }
 
     //获取商家所有的分类名称
-    public static function getNameList($sjId)
+    public static function getNameList($mainId)
     {
-        $cat = CategoryClass::getAllByCondition(['sjId' => $sjId, 'delStatus' => 0], 'inTurn DESC', '*');
+        $cat = CategoryClass::getAllByCondition(['mainId' => $mainId, 'delStatus' => 0], 'inTurn DESC', '*');
         return empty($cat) ? [] : array_column($cat, 'categoryName');
     }
 
     //获取商家最靠前的分类id ssh 2019.12.2
-    public static function getTopCategoryId($sjId)
+    public static function getTopCategoryId($mainId)
     {
-        $cat = CategoryClass::getByCondition(['sjId' => $sjId, 'delStatus' => 0, 'status' => 1], false, 'inTurn DESC');
+        $cat = CategoryClass::getByCondition(['mainId' => $mainId, 'delStatus' => 0, 'status' => 1], false, 'inTurn DESC');
         $id = isset($cat['id']) ? $cat['id'] : 0;
         return $id;
     }
 
     //获取前三个分类信息 ssh 2019.12.2
-    public static function getTopThreeCategory($sjId)
+    public static function getTopThreeCategory($mainId)
     {
-        $cat = CategoryClass::getLimitList('id,categoryName', ['sjId' => $sjId, 'delStatus' => 0, 'status' => 1], 3, 'inTurn DESC');
+        $cat = CategoryClass::getLimitList('id,categoryName', ['mainId' => $mainId, 'delStatus' => 0, 'status' => 1], 3, 'inTurn DESC');
         if (empty($cat)) {
             return [];
         }
@@ -77,9 +77,9 @@ class CategoryService extends BaseService
     }
 
     //验证操作权限 ssh 2019.12.8
-    public static function valid($category, $sjId)
+    public static function valid($category, $mainId)
     {
-        if (isset($category['sjId']) == false || $category['sjId'] != $sjId) {
+        if (isset($category['mainId']) == false || $category['mainId'] != $mainId) {
             util::fail('您没有权限操作');
         }
     }
@@ -124,11 +124,9 @@ class CategoryService extends BaseService
     }
 
     //获取开单页所有的分类:包括、常用
-    public static function getCategoryClassAll($sjId)
+    public static function getCategoryClassAll($mainId)
     {
-        $where = [
-            'sjId' => $sjId
-        ];
+        $where = ['mainId' => $mainId];
         $data = self::getAllList('id,categoryName as name', $where, 'inTurn desc');
         $use = [
             'id' => -2,

+ 20 - 1
biz-hd/work/classes/WorkClass.php

@@ -2,6 +2,7 @@
 
 namespace bizHd\work\classes;
 
+use common\components\imgUtil;
 use Yii;
 use bizHd\base\classes\BaseClass;
 
@@ -17,7 +18,7 @@ class WorkClass extends BaseClass
         if (empty($list)) {
             return $data;
         }
-        $data['list'] = selft::groupBaseInfo($list);
+        $data['list'] = self::groupBaseInfo($list);
         return $data;
     }
 
@@ -26,6 +27,24 @@ class WorkClass extends BaseClass
         if (empty($list)) {
             return $list;
         }
+        foreach ($list as $key => $val) {
+            $shortCover = $val['cover'] ?? '';
+            $cover = imgUtil::getPrefix() . 'hhb_small.png';
+            $bigCover = imgUtil::getPrefix() . 'hhb_small.png';
+            if (!empty($shortCover)) {
+                $parse = parse_url(self::groupImg($shortCover));
+                if (empty($parse['query'])) {
+                    $cover = self::groupImg($shortCover) . "?x-oss-process=image/resize,m_fill,h_110,w_110";
+                } else {
+                    $cover = self::groupImg($shortCover);
+                }
+                $bigCover = imgUtil::groupImg($shortCover) . "?x-oss-process=image/resize,m_fill,h_700,w_700";
+            }
+
+            $list[$key]['cover'] = $cover;
+            $list[$key]['bigCover'] = $bigCover;
+            $list[$key]['shortCover'] = $shortCover;
+        }
         return $list;
     }
 

+ 13 - 0
biz-hd/work/classes/WorkSnClass.php

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

+ 13 - 0
biz-hd/work/models/WorkSn.php

@@ -0,0 +1,13 @@
+<?php
+namespace bizHd\work\models;
+use bizHd\base\models\Base;
+
+class WorkSn extends Base
+{
+
+    public static function tableName()
+    {
+        return 'xhWorkSn';
+    }
+
+}

+ 13 - 0
biz-hd/work/services/WorkSnService.php

@@ -0,0 +1,13 @@
+<?php
+
+namespace bizHd\work\services;
+
+use bizHd\base\services\BaseService;
+use Yii;
+
+class WorkSnService extends BaseService
+{
+
+    public static $baseFile = '\bizHd\work\classes\WorkSnClass';
+
+}

+ 17 - 0
common/components/orderSn.php

@@ -12,6 +12,7 @@ use bizGhs\check\classes\CheckSnClass;
 use bizGhs\order\classes\OrderSnClass;
 use bizGhs\order\classes\PurchaseSnClass;
 use bizHd\px\classes\PxApplySnClass;
+use bizHd\work\classes\WorkSnClass;
 use bizMall\renew\classes\RenewSnClass;
 use Yii;
 use yii\imagine\Image;
@@ -262,4 +263,20 @@ class orderSn
         return $prefix . $id;
     }
 
+    //工单 shish 20220319
+    public static function getWorkSn()
+    {
+        $prefix = 'WK_CS';
+        if (getenv('YII_ENV', 'local') == 'production') {
+            $prefix = 'WK';
+        }
+
+        $respond = WorkSnClass::add(['id' => null]);
+        $id = $respond['id'] ?? 0;
+        if (empty($id)) {
+            util::fail('单号没有生成');
+        }
+        return $prefix . $id;
+    }
+
 }

+ 2 - 3
console/controllers/InitController.php

@@ -25,6 +25,7 @@ use bizGhs\order\classes\StockWastageOrderClass;
 use bizGhs\order\classes\StockWastageOrderItemClass;
 use bizGhs\stat\classes\StatYjClass;
 use bizGhs\stat\classes\StatYjMonthClass;
+use bizHd\goods\classes\CategoryClass;
 use bizHd\goods\classes\GoodsCategoryClass;
 use bizHd\goods\classes\GoodsClass;
 use bizHd\stat\classes\StatOrderClass;
@@ -102,8 +103,6 @@ class InitController extends Controller
             StatCgGhsMonthClass::updateByCondition(['shopId' => $shopId], ['mainId' => $mainId]);
 
 
-
-
             /********琦海 start ************/
 
             //报损中央化
@@ -126,7 +125,6 @@ class InitController extends Controller
             /********琦海 end ************/
 
 
-
         }
 
         //零售
@@ -152,6 +150,7 @@ class InitController extends Controller
             GoodsClass::updateByCondition(['sjId' => $sjId], ['mainId' => $mainId]);
             GoodsCategoryClass::updateByCondition(['sjId' => $sjId], ['mainId' => $mainId]);
 
+            CategoryClass::updateByCondition(['sjId' => $sjId], ['mainId' => $mainId]);
 
             /********琦海 start ************/
 

+ 17 - 2
sql.txt

@@ -61,10 +61,12 @@ ALTER TABLE xhGoods ADD property TINYINT NOT NULL DEFAULT 0 COMMENT '属性 0鲜
 DROP TABLE IF EXISTS `xhWork`;
 CREATE TABLE IF NOT EXISTS `xhWork`(
 id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+`name` varchar(500) not null default '' comment '名称',
+`cover` varchar(800) not null default '' comment '封面',
 `sjId` INT(11) NOT NULL DEFAULT '0' COMMENT '商家id',
 `shopId` INT(11) NOT NULL DEFAULT '0' COMMENT '门店id',
 `mainId` INT(11) NOT NULL DEFAULT '0' COMMENT '中央id',
-`makeSn` CHAR(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '工单编号',
+`workSn` CHAR(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '工单编号',
 `orderSn` CHAR(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '关联订单编号',
 `orderId` INT NOT NULL DEFAULT 0 COMMENT '关联订单id',
 `num` SMALLINT NOT NULL DEFAULT 0 COMMENT '数量',
@@ -72,6 +74,9 @@ id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
 `goodsId` INT NOT NULL DEFAULT 0 COMMENT '商品id',
 `from` TINYINT NOT NULL DEFAULT 0 COMMENT '来源 0门店下单 1小程序下单...',
 `remark` VARCHAR(1000) NOT NULL DEFAULT '' COMMENT '备注',
+`staffId` int not null default 0 comment '负责人',
+`staffName` varchar(100) not null default '' comment '负责人名称',
+`confirm` tinyint not null default 0 comment '确认花材 0未确认 1已确认',
 `status` TINYINT NOT NULL DEFAULT 0 COMMENT '状态 0待完成 1已完成 2已取消',
 `addTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间',
 `updateTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间'
@@ -473,4 +478,14 @@ ALTER TABLE xhStatOrderMonth ADD INDEX `mainId`(`mainId`,`time`);
 ALTER TABLE xhWastage ADD mainId INT NOT NULL DEFAULT 0 COMMENT '中央id' AFTER `id`;
 ALTER TABLE xhWastageItem ADD mainId INT NOT NULL DEFAULT 0 COMMENT '中央id' AFTER `id`;
 
-====报损中央化 shish 20220319
+====报损中央化 shish 20220319
+
+ALTER TABLE xhCategory ADD mainId INT NOT NULL DEFAULT 0 COMMENT '中央id' AFTER `parentId`;
+ALTER TABLE xhCategory CHANGE `property` `flower` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '0 绿植盆栽花瓶 1鲜花成品';
+drop table if exists `xhWorkSn`;
+CREATE TABLE `xhWorkSn` (
+  `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+  PRIMARY KEY (`id`)
+) AUTO_INCREMENT=126520 COMMENT='工单号';
+
+====商品分类中央化 shish 20220319