Browse Source

Merge branch 'version1.5' into dev_wf

wufeng 2 years ago
parent
commit
65fec1783d

+ 9 - 1
app/admin/controller/Consult.php

@@ -965,8 +965,16 @@ class Consult extends Base
         }
         $info['specinfo'] = json_decode($info['specinfo'],true);
         $place = ["provice_code"=>"","city_code"=>"","area_code"=>""];
-        list($place['provice_code'],$place['city_code'],$place['area_code'])=explode(",",$info['delivery_place']);
+        if($info['delivery_place']!=""){
+            list($place['provice_code'],$place['city_code'],$place['area_code'])=explode(",",$info['delivery_place']);
+        }
         $info['delivery_place_cn']=GetAddr(json_encode($place));
+        $place = ["provice_code"=>"","city_code"=>"","area_code"=>""];
+        if($info['origin_place']!=""){
+            list($place['provice_code'],$place['city_code'],$place['area_code'])=explode(",",$info['origin_place']);
+        }
+
+        $info['origin_place_cn']=GetAddr(json_encode($place));
         $info['metal_name']=isset($info['metal_id'])&& $info['metal_id']!=0?$this->noble[$info['metal_id']]:"";
         $bargain =Db::name("bargain_order")->where(['bidsNo'=>$bidNo,"is_del"=>0])->find();
         $info['bargain'] =$bargain;

+ 21 - 9
app/admin/controller/Goodup.php

@@ -794,7 +794,15 @@ class Goodup extends Base
             $jsp = json_encode($datas,JSON_UNESCAPED_UNICODE);
             if($up){
                 ChangeLog::logAdd(3,$datas['spuCode'],$jsp,$json,$this->post['token'],$this->post);
-                $online = Db::name("good_platform")->where(["spuCode"=>$supcode,"is_del"=>0])->save(["is_online"=>0,"status"=>0,"updatetime"=>date("Y-m-d H:i:s")]);
+                $online =  Db::name("good_platform")->where(["spuCode"=>$supcode,"is_del"=>0])->find();
+                if($online){
+                    $onup = Db::name("good_platform")->where(["spuCode"=>$supcode,"is_del"=>0])->save
+                    (["exam_status"=>2,"updatetime"=>date("Y-m-d H:i:s")]);
+                    if($onup==false){
+                        Db::rollback();
+                        return app_show(1004,"商品规成本修改失败");
+                    }
+                }
                 if($good_ladder!=="" && !empty($good_ladder)){
 
                     $user =GetUserInfo($this->post['token']);
@@ -878,16 +886,20 @@ class Goodup extends Base
         Db::startTrans();
         try {
             if($data['status']==3 && $status==1){
-                $online = Db::name("good_platform")->where(["spuCode"=>$supcode,"is_online"=>0,"status"=>0, "is_del"=>0])->save(["is_online"=>0,"exam_status"=>2,"updatetime"=>date("Y-m-d H:i:s")]);
+                $online = Db::name("good_platform")->where(["spuCode"=>$supcode,"is_del"=>0])->save(["exam_status"=>2,"updatetime"=>date("Y-m-d H:i:s")]);
+                if($online!=false){
+                    Db::rollback();
+                    return error_show(1004,"审核失败");
+                }
             }
 
-            if ($status == 1) {
-                //把同一个spuCode,且状态为1待完善成本,的记录更改状态为2待产品审核
-                Db::name('good')
-                    ->where(['is_del' => 0, 'status' => 1])
-                    ->whereIn('spuCode', $supcode)
-                    ->update(['status' => 2, 'updatetime' => date('Y-m-d H:i:s')]);
-            }
+//            if ($status == 1) {
+//                //把同一个spuCode,且状态为1待完善成本,的记录更改状态为2待产品审核
+//                Db::name('good')
+//                    ->where(['is_del' => 0, 'status' => 1])
+//                    ->whereIn('spuCode', $supcode)
+//                    ->update(['status' => 2, 'updatetime' => date('Y-m-d H:i:s')]);
+//            }
             $data['status']=$status;
             $data['updatetime']=date("Y-m-d H:i:s");
             $up= Db::name("good_basic")->save($data);

+ 1 - 1
app/admin/controller/Sale.php

@@ -3556,7 +3556,7 @@ class Sale extends Base
             ->find();
 
         if (empty($rs)) return error_show(1005, '该出库单不存在或不允许确认收货');
-        else return Db::name('order_out')->field('id')->where(['id' => $rs['id'], 'status' => 2])->update(['status' => 3, 'updatetime' => date('Y-m-d H:i:s')]) ? app_show(0, '收货完成') : error_show(1005, '收货失败');
+        else return Db::name('order_out')->where(['id' => $rs['id'], 'status' => 2])->update(['status' => 3, 'updatetime' => date('Y-m-d H:i:s')]) ? app_show(0, '收货完成') : error_show(1005, '收货失败');
     }
 
 

+ 12 - 0
app/admin/model/ActionProcess.php

@@ -0,0 +1,12 @@
+<?php
+
+
+namespace app\admin\model;
+
+
+use think\Model;
+
+class ActionProcess extends Model
+{
+
+}

+ 2 - 5
app/admin/model/ProcessOrder.php

@@ -18,10 +18,6 @@ class ProcessOrder extends \think\Model
             $uid = isset($token['id']) ? $token['id'] : 0;
             $name = isset($token['nickname']) ? $token['nickname'] : '';
         }
-
-       // $conf =Config::get("process");
-        //$action = isset($conf[$order['order_type']]) ? $conf[$order['order_type']]:[];
-
         $data=[
             "order_type"=>$order['order_type'],
             "order_code"=>$order['order_code'],
@@ -34,10 +30,11 @@ class ProcessOrder extends \think\Model
         ];
         OrderMsg::addmsg($data);
         if(self::insert($data)){
-            Workflow::SaveFlow($data);
+         //   Workflow::SaveFlow($data);
         };
     }
     public static function workdel($order){
         Workflow::where(["order_type"=>$order['order_type'],"order_code"=>$order['order_code']])->save(["is_del"=>1,"updatetime"=>date("y-m-d H:i:s")]);
     }
+
 }

+ 18 - 0
app/admin/model/ProcessWait.php

@@ -0,0 +1,18 @@
+<?php
+
+
+namespace app\admin\model;
+
+
+class ProcessWait extends \think\model
+{
+   public  static function add($data){
+        $da=self::find(['orderCode'=>$data['orderCode']]);
+        if($da==false){
+            self::insert($data);
+        }else{
+            self::where($da)->save($data);
+        }
+    }
+
+}

+ 49 - 9
app/admin/model/Workflow.php

@@ -8,30 +8,32 @@ use think\facade\Config;
 class Workflow extends \think\Model
 {
     public static  $conf=[];
+    public static  $order_status=2;
     public function __construct(array $data = [])
     {
         parent::__construct($data);
         self::$conf=Config::get("process");
-    }
-
-    public static function SaveFlow($data){
         $conf =self::$conf;
         $action = isset($conf[$data['order_type']]) ? $conf[$data['order_type']]:[];
         $last =end($action);
-        $order_status=2;//默认进行中
+        self::$order_status=2;//默认进行中
         if((is_array($last)&&in_array($data['action_process'],$last))||$last==$data['action_process']){
-            $order_status=3; //流程结束
+            self::$order_status=3; //流程结束
         }
 
         $header =reset($action);
         if((is_array($header)&&in_array($data['action_process'],$header))||$header==$data['action_process']){
-            $order_status=1; //流程新建
+            self::$order_status=1; //流程新建
         }
+    }
+
+    public static function SaveFlow($data){
+
         $proces = self::where(["order_type"=>$data['order_type'],"order_code"=>$data['order_code'],"is_del"=>0])->find();
         if($proces){
             $info=[
                 "order_process"=>$data['order_status'],
-                "order_status"=>$order_status,
+                "order_status"=>self::$order_status,
                 "action_uid"=>$data['action_uid'],
                 "action_name"=>$data['action_name'],
                 "updatetime"=>date("Y-m-d H:i:s")
@@ -43,7 +45,7 @@ class Workflow extends \think\Model
                 "order_code"=>$data['order_code'],
                 "order_id"=>$data['order_id'],
                 "order_process"=>$data['order_status'],
-                "order_status"=>$order_status,
+                "order_status"=>self::$order_status,
                 "apply_id"=>$data['action_uid'],
                 "apply_name"=>$data['action_name'],
                 "action_uid"=>$data['action_uid'],
@@ -52,6 +54,7 @@ class Workflow extends \think\Model
                 "updatetime"=>date("Y-m-d H:i:s")
             ];
             self::insert($proces);
+            self::Addwait($data);
         }
 
     }
@@ -60,7 +63,44 @@ class Workflow extends \think\Model
      * 待办事项新建
      *
      */
-    public  function  Addwait($data){
+    public  static function  Addwait($data){
+        $conf =self::$conf;
+        $action = isset($conf[$data['order_type']]) ? $conf[$data['order_type']]:[];
+        if(!empty($action)){
+            $last =end($action);
+            $wait="";
+            foreach ($action as $key=>$value){
+                if((is_array($value)&&in_array($data['action_process'],$value))||$value==$data['action_process']){
+                    if($value!=$last){
+                        $index=$key+1;
+                        $wait= is_array($action[$index])? $action[$index][0]:$action[$index];
+                        break;
+                    }
+                }
+            }
+            $orderp =ActionProcess::where(["order_type"=>$data['order_type'],"order_process"=>$wait])->find();
+            if($orderp!=false){
+
+                $data=[
+                    "order_type"=>$data['order_type'],
+                    "order_code"=>$data['order_code'],
+                    "order_id"=>$data['order_id'],
+                    "order_process"=>$wait,
+                    "order_status"=>$data['action_process'],
+                    "apply_id"=>$data['action_uid'],
+                    "apply_name"=>$data['action_name'],
+                    "action_uid"=>$orderp['uid'],
+                    "action_name"=>$orderp['uname'],
+                    "status"=>self::$order_status==3?2:1,
+                    "addtime"=>date("Y-m-d H:i:s"),
+                    "updatetime"=>date("Y-m-d H:i:s")
+                ];
+                ProcessWait::add($data);
+            }
+
+
+        }
+
 
     }