wugg пре 2 година
родитељ
комит
ee49f35dec

+ 8 - 5
app/abutment/controller/Consult.php

@@ -958,7 +958,9 @@ class Consult extends HomeBaseController
                                             "order_type" => 'PRO',
                                             "order_code" => $projetc['projectNo'],
                                             "order_id" => $projetc['id'],
-                                            "order_status" => 2, "before_status" => 1
+                                            "order_status" => 2,
+                                            "before_status" => 1,
+                                            'holder_id'=>$projetc['createrid']
                                         ]);
                                     }
                                 }
@@ -1186,9 +1188,9 @@ class Consult extends HomeBaseController
 
                                 if ($count == 0) {
                                     //先查询是否存在status==1的项目,有的话再更新,否则跳过
-                                    $project_id = Db::name("project")->where(["projectNo" => $projectinfo['projectNo'], "status" => 1])->value('id', 0);
+                                    $project_id = Db::name("project")->where(["projectNo" => $projectinfo['projectNo'], "status" => 1])->field('id,createrid')->findOrEmpty();
                                     if ($project_id) {
-                                        $proc = Db::name("project")->where(["id" => $project_id])->update(["status" => 2, "updatetime" => date("Y-m-d H:i:s")]);
+                                        $proc = Db::name("project")->where(["id" => $project_id['id']])->update(["status" => 2, "updatetime" => date("Y-m-d H:i:s")]);
                                         if ($proc == false) {
                                             Db::rollback();
                                             return json_show(1006, "项目反馈失败");
@@ -1204,9 +1206,10 @@ class Consult extends HomeBaseController
                                             ProcessOrder::AddProcess(['id' => $createrid, 'nickname' => $creater], [
                                                     "order_type" => 'PRO',
                                                     "order_code" => $projectinfo['projectNo'],
-                                                    "order_id" => $project_id,
+                                                    "order_id" => $project_id['id'],
                                                     "order_status" => 2,
-                                                    "before_status" => 1
+                                                    "before_status" => 1,
+                                                    'holder_id'=>$project_id['createrid']
                                                 ]
                                             );
                                         }

+ 15 - 5
app/abutment/controller/Good.php

@@ -530,7 +530,9 @@ class Good extends HomeBaseController
                     "order_type" => 'SPCB',
                     "order_code" => $spucode,//咨询单详情编号
                     "order_id" => $in,
-                    "order_status" => 0, "before_status" => 0
+                    "order_status" => 0,
+                    "before_status" => 0,
+                    'holder_id' => $data['createrid'],
                 ]);
                 Db::commit();
                 return json_show(0, "创建成功", ["spuCode" => $spucode]);
@@ -796,7 +798,9 @@ class Good extends HomeBaseController
                     "order_type" => 'SPCB',
                     "order_code" => $supcode,//咨询单详情编号
                     "order_id" => $data['id'],
-                    "order_status" => $temp['status'], "before_status" => $data['status']
+                    "order_status" => $temp['status'],
+                    "before_status" => $data['status'],
+                    'holder_id' => $data['createrid'],
                 ]);
                 Db::commit();
                 return json_show(0, "更新成功");
@@ -900,7 +904,9 @@ class Good extends HomeBaseController
                     "order_type" => 'SPCB',
                     "order_code" => $supcode,//咨询单详情编号
                     "order_id" => $datas['id'],
-                    "order_status" => $data['status'], "before_status" => $datas['status']
+                    "order_status" => $data['status'],
+                    "before_status" => $datas['status'],
+                    'holder_id' => $datas['createrid'],
                 ]);
 //                $online =  Db::name("good_platform")->where(["spuCode"=>$supcode,"is_del"=>0])->find();
 //                if($online){
@@ -1257,7 +1263,9 @@ class Good extends HomeBaseController
                     "order_type" => 'SPCB',
                     "order_code" => $supcode,//咨询单详情编号
                     "order_id" => $data['id'],
-                    "order_status" => 0, "before_status" => 0
+                    "order_status" => 0,
+                    "before_status" => 0,
+                    'holder_id' => $data['createrid'],
                 ]);
                 if ($speclist !== "" && !empty($speclist)) {
                     foreach ($speclist as $value) {
@@ -1695,7 +1703,9 @@ class Good extends HomeBaseController
                     "order_type" => 'SPCB',
                     "order_code" => $newCode,//咨询单详情编号
                     "order_id" => Db::name("good_basic")->getLastInsID(),
-                    "order_status" => 7, "before_status" => 0
+                    "order_status" => 7,
+                    "before_status" => 0,
+                    'holder_id' => $data['createrid'],
                 ]);
                 if (!empty($ladd)) {
                     $na = Db::name("good_nake")->insertAll($ladd);

+ 16 - 5
app/abutment/controller/Order.php

@@ -386,7 +386,7 @@ class Order extends HomeBaseController
         $info = Db::name("purchease_order")
             ->whereIn('cgdNo', $cgdNo)
             ->where('status', 0)
-            ->column('id,cgdNo,status', 'cgdNo');
+            ->column('id,cgdNo,status,supplierNo', 'cgdNo');
         if (empty($info)) return json_show(1005, '没有可供确认的订单');
 
         $upd = Db::name("purchease_order")
@@ -402,8 +402,13 @@ class Order extends HomeBaseController
             $uid = $this->request->user['uid']; //isset($user['data']['id'])?$user['data']['id']:0;
             $uname = $this->request->user['nickname'];//isset($user['data']['nickname'])?$user['data']['nickname']:'';
 
+            $supplier_cgderid = Db::name('supplier')
+                ->where('is_del',0)
+                ->whereIn('code',array_column($info,'supplierNo'))
+                ->column('personid','code');
+
             foreach ($cgdNo as $vlue) {
-                $process = ["order_code" => $vlue, "order_id" => isset($info[$vlue]['id']) ? $info[$vlue]['id'] : 0, "order_status" => $status, "order_type" => 'CGD', "before_status" => isset($info[$vlue]['status']) ? $info[$vlue]['status'] : 0];
+                $process = ["order_code" => $vlue, "order_id" => isset($info[$vlue]['id']) ? $info[$vlue]['id'] : 0, "order_status" => $status, "order_type" => 'CGD', "before_status" => isset($info[$vlue]['status']) ? $info[$vlue]['status'] : 0,'holder_id'=> isset($supplier_cgderid[$info[$vlue]['supplierNo']]) ? $supplier_cgderid[$info[$vlue]['supplierNo']] : 0];
                 ProcessOrder::AddProcess(['id' => $uid, 'nickname' => $uname], $process);
                 $order = ["order_code" => $vlue, "status" => '', "action_remark" => $remark, "action_type" => "status"];
                 ActionLog::logAdd(['id' => $uid, 'nickname' => $uname], $order, 'CGD', $status, $this->post);
@@ -449,6 +454,11 @@ class Order extends HomeBaseController
 
             $date = date('Y-m-d H:i:s');
 
+            $supplier_cgderid = Db::name('supplier')
+                ->where('is_del',0)
+                ->whereIn('code',array_column($cgdinfo,'supplierNo'))
+                ->column('personid','code');
+
             $i = 0;
             $status = 4;//4入库完成
             foreach ($param['cgdNo'] as $cgdNo) {
@@ -488,7 +498,7 @@ class Order extends HomeBaseController
                 if ($win) {
                     $sto = ["order_code" => $wsm_in_code, "status" => $status, "action_remark" => '', "action_type" => "edit"];
                     ActionLog::logAdd(['id' => $uid, 'nickname' => $nickname], $sto, "RKD", $status, $this->request->filter('trim')->post());
-                    $process = ["order_code" => $wsm_in_code, "order_id" => $win, "order_status" => $status, "order_type" => 'RKD', "before_status" => $status];
+                    $process = ["order_code" => $wsm_in_code, "order_id" => $win, "order_status" => $status, "order_type" => 'RKD', "before_status" => $status,'holder_id' => $this->request->user['uid']];
                     ProcessOrder::AddProcess(['id' => $uid, 'nickname' => $nickname], $process);
                     $order = ["order_code" => $cgdNo, "status" => $cgdinfo[$cgdNo]['status'], "action_remark" => '', "action_type" => "edit"];
 
@@ -591,7 +601,8 @@ class Order extends HomeBaseController
                                                 "order_code" => $v_outCode['outCode'],//出库单号
                                                 "order_id" => $v_outCode['id'],
                                                 "order_status" => 1,
-                                                "before_status" => 0
+                                                "before_status" => 0,
+                                                'holder_id' => $v_outCode['apply_id']
                                             ]);
                                         }
                                     }
@@ -617,7 +628,7 @@ class Order extends HomeBaseController
                             }
                         }
                         ActionLog::logAdd(['id' => $uid, 'nickname' => $nickname], $order, "CGD", $cgdinfo[$cgdNo]['status'], $cgdinfo[$cgdNo]);
-                        $process = ["order_code" => $cgdNo, "order_id" => $cgdinfo[$cgdNo]['id'], "order_status" => $cgdinfo[$cgdNo]['status'], "order_type" => 'CGD', "before_status" => $order['status']];
+                        $process = ["order_code" => $cgdNo, "order_id" => $cgdinfo[$cgdNo]['id'], "order_status" => $cgdinfo[$cgdNo]['status'], "order_type" => 'CGD', "before_status" => $order['status'], 'holder_id' => isset($supplier_cgderid[$cgdinfo[$cgdNo]['supplierNo']]) ? $supplier_cgderid[$cgdinfo[$cgdNo]['supplierNo']] : 0];
                         ProcessOrder::AddProcess(['id' => $uid, 'nickname' => $nickname], $process);
 //                        Db::commit();
 //                        return json_show(0, '商品入库成功', ["wsm_in_code" => $wsm_in_code]);

+ 9 - 3
app/abutment/controller/Sale.php

@@ -271,6 +271,7 @@ class Sale extends HomeBaseController
                     "before_status" => $old_outinfo_status,
                     'wait_id' => $outinfo['apply_id'],
                     'wait_name' => $outinfo['apply_name'],
+                    'holder_id' => $outinfo['apply_id'],
                 ]);
                 $orderstatus = $einfo['status'];
                 $einfo['send_num'] += $outinfo['send_num'];
@@ -298,7 +299,9 @@ class Sale extends HomeBaseController
                     "order_type" => 'XSQRD',
                     "order_code" => $einfo['orderCode'],//出库单号
                     "order_id" => $einfo['id'],
-                    "order_status" => $einfo['status'], "before_status" => $orderstatus
+                    "order_status" => $einfo['status'],
+                    "before_status" => $orderstatus,
+                    'holder_id' => $einfo['apply_id']
                 ]);
 
                 $stokc = Db::name("good_stock")->where(['spuCode' => $einfo['good_code'], "wsm_code" => $outinfo['wsm_code'], "is_del" => 0])->find();
@@ -416,7 +419,7 @@ class Sale extends HomeBaseController
                 $sale_infos = Db::name("sale")
                     ->where('orderCode', $order_out_infos[$value['outCode']]['orderCode'])
                     ->where('is_del', 0)
-                    ->column('id,send_num,wsend_num,status,good_code,order_source', 'orderCode');
+                    ->column('id,send_num,wsend_num,status,good_code,order_source,apply_id', 'orderCode');
 
                 if (!isset($sale_infos[$order_out_infos[$value['outCode']]['orderCode']])) throw new Exception($value['outCode'] . '该发货单对应的销售单未找到');
 
@@ -460,6 +463,7 @@ class Sale extends HomeBaseController
                         "before_status" => $order_out_infos[$value['outCode']]['status'],
                         'wait_id' => $order_out_infos[$value['outCode']]['apply_id'],
                         'wait_name' => $order_out_infos[$value['outCode']]['apply_name'],
+                        'holder_id' => $order_out_infos[$value['outCode']]['apply_id'],
                     ]);
 
 
@@ -488,7 +492,9 @@ class Sale extends HomeBaseController
                         "order_type" => 'XSQRD',
                         "order_code" => $order_out_infos[$value['outCode']]['orderCode'],//出库单号
                         "order_id" => $sale_infos[$order_out_infos[$value['outCode']]['orderCode']]['id'],
-                        "order_status" => $einfo['status'], "before_status" => $sale_infos[$order_out_infos[$value['outCode']]['orderCode']]['status']
+                        "order_status" => $einfo['status'],
+                        "before_status" => $sale_infos[$order_out_infos[$value['outCode']]['orderCode']]['status'],
+                        'holder_id' => $sale_infos[$order_out_infos[$value['outCode']]['orderCode']]['apply_id']
                     ]);
 
                     //【库存】

+ 14 - 10
app/admin/controller/ActionProcess.php

@@ -78,7 +78,6 @@ class ActionProcess extends Base
             'next_action_ids|下一节点' => 'array|requireIf:action_type,' . APModel::$action_type_start . '|requireIf:action_type,' . APModel::$action_type_process,
         ]);
 
-
         $val->extend('checkOrderProcess', function ($val, $rule, $data) {
             return APModel::where([
                 'process_id' => $data['process_id'],
@@ -89,13 +88,20 @@ class ActionProcess extends Base
 
         if (!$val->check($param)) return error_show(1005, $val->getError());
 
-        $user = GetUserInfo($param['token']);
+        //获取流程
+        $process = PModel::field('id,process_name,process_type')
+            ->where(['id' => $param['process_id'], 'is_del' => PModel::$is_del_normal])
+            ->findOrEmpty()
+            ->toArray();
+        if (empty($process)) return error_show(1005, '您所选的流程不存在');
 
-        $uid = isset($user['data']['id']) ? $user['data']['id'] : 0;
-        $uname = isset($user['data']['nickname']) ? $user['data']['nickname'] : '';
+        $uid = $this->uid;
+        $uname = $this->uname;
         $date = date('Y-m-d H:i:s');
 
         return APModel::create(array_merge($param, [
+            'order_type' => $process['process_type'],
+            'order_name' => $process['process_name'],
             'status' => APModel::$status_disable,
             'is_del' => APModel::$is_del_normal,
             'createrid' => $uid,
@@ -156,7 +162,7 @@ class ActionProcess extends Base
             ->field('id,process_id')
             ->findOrEmpty();
 
-        if($info->isEmpty()) return error_show(1005,'该节点记录不存在');
+        if ($info->isEmpty()) return error_show(1005, '该节点记录不存在');
 
         if (isset($param['status']) && $param['status'] == APModel::$status_disable) {
             //禁用节点时,要校验其所属流程是否被禁用
@@ -169,10 +175,8 @@ class ActionProcess extends Base
 
         }
 
-        $user = GetUserInfo($param['token']);
-
-        $uid = isset($user['data']['id']) ? $user['data']['id'] : 0;
-        $uname = isset($user['data']['nickname']) ? $user['data']['nickname'] : '';
+        $uid = $this->uid;
+        $uname = $this->uname;
         $date = date('Y-m-d H:i:s');
 
         if (isset($param['next_action_ids']) && is_array($param['next_action_ids'])) $param['next_action_ids'] = implode(',', $param['next_action_ids']);
@@ -186,7 +190,7 @@ class ActionProcess extends Base
     {
 
         $data = PModel::where(['is_del' => PModel::$is_del_normal, 'status' => PModel::$status_normal])
-            ->order(['weight'=>'desc','id'=>'desc'])
+            ->order(['weight' => 'desc', 'id' => 'desc'])
             ->column('id,process_name,process_type', 'id');
 
         $action = APModel::where(['is_del' => APModel::$is_del_normal, 'status' => APModel::$status_normal, 'operation_type' => APModel::$operation_type_approval])

+ 5 - 5
app/admin/controller/Activity.php

@@ -336,7 +336,7 @@ class Activity extends Base
 
                 $stn = ["order_code" => $activity_code, "status" => 0, "action_remark" => '', "action_type" => "create"];
                 ActionLog::logAdd($this->post['token'], $stn, "HD", $data['status'], $data);
-                $process = ["order_code" => $activity_code, "order_id" => $inset, "order_status" => $data['status'], "order_type" => 'HD', "before_status" => 0];
+                $process = ["order_code" => $activity_code, "order_id" => $inset, "order_status" => $data['status'], "order_type" => 'HD', "before_status" => 0, 'holder_id' => $data['createrid']];
                 ProcessOrder::AddProcess($this->post['token'], $process);
 
                 Db::commit();
@@ -388,7 +388,7 @@ class Activity extends Base
 
                 $stn = ["order_code" => $activity_code, "status" => $old_activity_status, "action_remark" => '', "action_type" => "status"];
                 ActionLog::logAdd($this->post['token'], $stn, "HD", $activity['status'], $activity);
-                $process = ["order_code" => $activity_code, "order_id" => $activity['id'], "order_status" => $activity['status'], "order_type" => 'HD', "before_status" => $old_activity_status];
+                $process = ["order_code" => $activity_code, "order_id" => $activity['id'], "order_status" => $activity['status'], "order_type" => 'HD', "before_status" => $old_activity_status, 'holder_id' => $activity['createrid']];
                 ProcessOrder::AddProcess($this->post['token'], $process);
 
                 Db::commit();
@@ -448,7 +448,7 @@ class Activity extends Base
                     ->leftJoin('depart_user u', 'u.uid=ur.uid AND u.is_del=0 AND u.status=1')
                     ->where('r.id', 20)//财务负责人
                     ->findOrEmpty();
-                $process = ["order_code" => $activity_code, "order_id" => $activity['id'], "order_status" => $activity['status'], "order_type" => 'HD', "before_status" => $old_activity_status, 'wait_id' => isset($user['uid']) ? $user['uid'] : 0, 'wait_name' => isset($user['nickname']) ? $user['nickname'] : ''];
+                $process = ["order_code" => $activity_code, "order_id" => $activity['id'], "order_status" => $activity['status'], "order_type" => 'HD', "before_status" => $old_activity_status, 'wait_id' => isset($user['uid']) ? $user['uid'] : 0, 'wait_name' => isset($user['nickname']) ? $user['nickname'] : '', 'holder_id' => isset($user['uid']) ? $user['uid'] : 0];
                 ProcessOrder::AddProcess($this->post['token'], $process);
 
                 Db::commit();
@@ -500,7 +500,7 @@ class Activity extends Base
 
                 $stn = ["order_code" => $activity_code, "status" => $old_activity_status, "action_remark" => '', "action_type" => "status"];
                 ActionLog::logAdd($this->post['token'], $stn, "HD", $activity['status'], $activity);
-                $process = ["order_code" => $activity_code, "order_id" => $activity['id'], "order_status" => $activity['status'], "order_type" => 'HD', "before_status" => $old_activity_status];
+                $process = ["order_code" => $activity_code, "order_id" => $activity['id'], "order_status" => $activity['status'], "order_type" => 'HD', "before_status" => $old_activity_status, 'holder_id' => $activity['createrid']];
                 ProcessOrder::AddProcess($this->post['token'], $process);
 
                 Db::commit();
@@ -600,7 +600,7 @@ class Activity extends Base
 
             $stn = ["order_code" => $activity_code, "status" => $old_status, "action_remark" => '', "action_type" => "status"];
             ActionLog::logAdd($this->post['token'], $stn, "HD", $activity['status'], $activity);
-            $process = ["order_code" => $activity_code, "order_id" => $activity['id'], "order_status" => $activity['status'], "order_type" => 'HD', "before_status" => $old_status];
+            $process = ["order_code" => $activity_code, "order_id" => $activity['id'], "order_status" => $activity['status'], "order_type" => 'HD', "before_status" => $old_status, 'holder_id' => $activity['createrid']];
             ProcessOrder::AddProcess($this->post['token'], $process);
 
             return  app_show(0,"修改成功");

+ 27 - 15
app/admin/controller/After.php

@@ -131,7 +131,7 @@ class After extends Base
 
                 Db::execute("UPDATE `wsm_standing_book` SET `returnCode`=CONCAT(IFNULL(`returnCode`,''),',{$returnCode}'),`updatetime`='" . date('Y-m-d H:i:s') . "' WHERE FIND_IN_SET('{$outCode}',`outCode`)");
 
-                $process = ["order_code" => $returnCode, "order_id" => $create, "order_status" => $in['status'], "order_type" => 'SHD', "before_status" => 1];
+                $process = ["order_code" => $returnCode, "order_id" => $create, "order_status" => $in['status'], "order_type" => 'SHD', "before_status" => 1,'holder_id'=>$in['apply_id']];
                     ProcessOrder::AddProcess($token,$process);
                     Db::commit();
                     return app_show(0,"售后申请单新建成功",["returnCode"=>$returnCode]);
@@ -408,9 +408,9 @@ class After extends Base
                 $order = ["order_code"=>$info['returnCode'],"status"=>$var,"action_remark"=>'',"action_type"=>"edit"];
                 ActionLog::logAdd($this->post['token'],$order,"SHD", $info['status'],$this->post);
 
-                if (in_array($status, [2, 3])) $process = ["order_code" => $info['returnCode'], "order_id" => $info['id'], "order_status" => $status, "order_type" => "SHD", "before_status" => $var, 'wait_id' => $info['cgderid'], 'wait_name' => $info['cgder']];
-                elseif ($status == 4) $process = ["order_code" => $info['returnCode'], "order_id" => $info['id'], "order_status" => $status, "order_type" => "SHD", "before_status" => $var, 'wait_id' => $info['apply_id'], 'wait_name' => $info['apply_name']];
-                else $process = ["order_code" => $info['returnCode'], "order_id" => $info['id'], "order_status" => $status, "order_type" => "SHD", "before_status" => $var];
+                if (in_array($status, [2, 3])) $process = ["order_code" => $info['returnCode'], "order_id" => $info['id'], "order_status" => $status, "order_type" => "SHD", "before_status" => $var, 'wait_id' => $info['cgderid'], 'wait_name' => $info['cgder'],'holder_id'=>$info['cgderid']];
+                elseif ($status == 4) $process = ["order_code" => $info['returnCode'], "order_id" => $info['id'], "order_status" => $status, "order_type" => "SHD", "before_status" => $var, 'wait_id' => $info['apply_id'], 'wait_name' => $info['apply_name'],'holder_id'=>$info['apply_id']];
+                else $process = ["order_code" => $info['returnCode'], "order_id" => $info['id'], "order_status" => $status, "order_type" => "SHD", "before_status" => $var,'holder_id'=>$info['apply_id']];
 
                 ProcessOrder::AddProcess($this->post['token'],$process);
                 Db::commit();
@@ -515,7 +515,9 @@ class After extends Base
                         "order_type" => 'SHD',
                         "order_code" => $info['returnCode'],//销售单code
                         "order_id" => $info['id'],
-                        "order_status" => $info['status'],"before_status"=>$old_info_status
+                        "order_status" => $info['status'],
+                        "before_status"=>$old_info_status,
+                        'holder_id'=>$info['apply_id']
                     ]);
 
                     Db::commit();
@@ -631,7 +633,7 @@ class After extends Base
                 if($in){
                     $order = ["order_code"=>$info['returnCode'],"status"=>$var,"action_remark"=>'',"action_type"=>"edit"];
                     ActionLog::logAdd($this->post['token'],$order,"SHD",$info['status'],$this->post);
-                    $process=["order_code"=>$info['returnCode'],"order_id"=>$info['id'],"order_status"=>$info['status'],"order_type"=>"SHD","before_status"=>$var];
+                    $process=["order_code"=>$info['returnCode'],"order_id"=>$info['id'],"order_status"=>$info['status'],"order_type"=>"SHD","before_status"=>$var,'holder_id'=>$info['apply_id']];
                     ProcessOrder::AddProcess($this->post['token'],$process);
                     Db::commit();
                     return app_show(0,"更新成功");
@@ -705,7 +707,7 @@ class After extends Base
             if($up){
                 $order = ["order_code"=>$info['orderCode'],"status"=>$str,"action_remark"=>'',"action_type"=>"edit"];
                 ActionLog::logAdd($this->post['token'],$order,"SHD",$info['status'],$this->post);
-                $process=["order_code"=>$info['returnCode'],"order_id"=>$info['id'],"order_status"=>$info['status'],"order_type"=>"SHD","before_status"=>$str];
+                $process=["order_code"=>$info['returnCode'],"order_id"=>$info['id'],"order_status"=>$info['status'],"order_type"=>"SHD","before_status"=>$str,'holder_id'=>$info['apply_id']];
                 ProcessOrder::AddProcess($this->post['token'],$process);
                 $in=Db::name("order_returninfo")->save($return_info);
                 if($in){
@@ -843,7 +845,7 @@ class After extends Base
                 if($in){
                     $order = ["order_code"=>$info['returnCode'],"status"=>$stat,"action_remark"=>'',"action_type"=>"edit"];
                     ActionLog::logAdd($this->post['token'],$order,"SHD", $info['status'],$this->post);
-                    $process=["order_code"=>$info['returnCode'],"order_id"=>$info['id'],"order_status"=>$info['status'],"SHD","before_status"=>$stat];
+                    $process=["order_code"=>$info['returnCode'],"order_id"=>$info['id'],"order_status"=>$info['status'],"SHD","before_status"=>$stat,'holder_id'=>$info['apply_id']];
                     ProcessOrder::AddProcess($this->post['token'],$process);
                     Db::commit();
                     return app_show(0,"更新成功");
@@ -1008,7 +1010,9 @@ class After extends Base
                         "order_type" => 'SHD',
                         "order_code" => $info['returnCode'],//销售单code
                         "order_id" => $info['id'],
-                        "order_status" => $info['status'],"before_status"=>$old_info_status
+                        "order_status" => $info['status'],
+                        "before_status"=>$old_info_status,
+                        'holder_id'=>$info['apply_id']
                     ]);
 
                     $thNo =makeNo("ST");
@@ -1168,7 +1172,7 @@ class After extends Base
         Db::startTrans();
         try {
 
-            $rs = Db::name('order_return')->field('id,status')->where([['returnCode', '=', $data['returnCode']], ['is_del', '=', 0], ['status', '<>', 8]])->find();
+            $rs = Db::name('order_return')->field('id,status,apply_id')->where([['returnCode', '=', $data['returnCode']], ['is_del', '=', 0], ['status', '<>', 8]])->find();
 
             if (!$rs) throw new Exception('该售后单记录不存在');
 
@@ -1179,7 +1183,7 @@ class After extends Base
 
             //记录日志
             ActionLog::logAdd($data['token'], ["order_code" => $data['returnCode'], "status" => $rs['status'], "action_remark" => '', "action_type" => "delete"], 'SHD', 8, $this->post);
-            ProcessOrder::AddProcess($this->post['token'], ["order_code" => $data['returnCode'], "order_id" => $rs['id'], "order_status" => 8, "order_type" => 'SHD',"before_status"=>$rs['status']]);
+            ProcessOrder::AddProcess($this->post['token'], ["order_code" => $data['returnCode'], "order_id" => $rs['id'], "order_status" => 8, "order_type" => 'SHD',"before_status"=>$rs['status'],'holder_id'=>$rs['apply_id']]);
 
             //提交
             Db::commit();
@@ -1459,7 +1463,9 @@ class After extends Base
                     "order_type" => 'XSQRD',
                     "order_code" => $orderCode,//销售单code
                     "order_id" => $datainfo,
-                    "order_status" => 0, "before_status" => 0
+                    "order_status" => 0,
+                    "before_status" => 0,
+                    'holder_id' => $data['apply_id']
                 ]);
 
                 if ($is_activity == 1) {
@@ -1832,7 +1838,9 @@ class After extends Base
                     "order_type" => 'XSQRD',
                     "order_code" => $orderCode,//销售单code
                     "order_id" => $datainfo,
-                    "order_status" => $data['status'], "before_status" => 0
+                    "order_status" => $data['status'],
+                    "before_status" => 0,
+                    'holder_id' => $data['apply_id']
                 ]);
 //                $old_zx_status = $zx['status'];
 //                $zx['status']=5;
@@ -1987,7 +1995,9 @@ class After extends Base
                         "order_type" => 'CKD',
                         "order_code" => $outCode,//出库单号
                         "order_id" => Db::name("order_out")->getLastInsID(),
-                        "order_status" => 0, "before_status" => 0
+                        "order_status" => 0,
+                        "before_status" => 0,
+                        'holder_id' => $out['apply_id']
                     ]);
 
                     //将发货编号添加到台账中
@@ -2136,7 +2146,9 @@ class After extends Base
                 "order_type" => 'CGD',
                 "order_code" => $cg['cgdNo'],//销售单code
                 "order_id" => $up,
-                "order_status" => $cg['status'],"before_status"=> 0
+                "order_status" => $cg['status'],
+                "before_status"=> 0,
+                'holder_id' => $supplier['personid'],
             ]);
 
             $standing_book_da = array_merge($standing_book_da, [

+ 5 - 5
app/admin/controller/Allot.php

@@ -226,7 +226,7 @@ class Allot extends Base
                 if ($io) {
                     $order = ["order_code"=>$allot_code,"status"=>$status,"action_remark"=>'',"action_type"=>"create"];
                     ActionLog::logAdd($this->post['token'],$order,"DBD",$status,$this->post);
-                    $process=["order_code"=>$allot_code,"order_id"=>$pd,"order_status"=>$status,"order_type"=>'DBD',"before_status"=>0];
+                    $process = ["order_code" => $allot_code, "order_id" => $pd, "order_status" => $status, "order_type" => 'DBD', "before_status" => 0, 'holder_id' => $data['apply_id']];
                     ProcessOrder::AddProcess($token,$process);
                     Db::commit();
                     return error_show(0, "调拨创建成功");
@@ -485,7 +485,7 @@ class Allot extends Base
                 }
                 $order = ["order_code"=>$st['allot_code'],"status"=>$sr,"action_remark"=>'',"action_type"=>"status"];
                 ActionLog::logAdd($this->post['token'],$order,"DBD",$status,$this->post);
-                $process=["order_code"=>$st['allot_code'],"order_id"=>$st['id'],"order_status"=>$st['status'],"order_type"=>'DBD',"before_status"=>$sr];
+                $process=["order_code"=>$st['allot_code'],"order_id"=>$st['id'],"order_status"=>$st['status'],"order_type"=>'DBD',"before_status"=>$sr, 'holder_id' => $st['apply_id']];
                 ProcessOrder::AddProcess($this->post['token'],$process);
                 Db::commit();
                 return error_show(0,"状态更新成功");
@@ -558,7 +558,7 @@ class Allot extends Base
                 }
                 $order = ["order_code"=>$al['allot_code'],"status"=>$al['status'],"action_remark"=>'',"action_type"=>"edit"];
                 ActionLog::logAdd($this->post['token'],$order,"DBD",3,$this->post);
-                $process=["order_code"=>$allot_code,"order_id"=>$al['id'],"order_status"=>3,"order_type"=>'DBD',"before_status"=>$al['status']];
+                $process=["order_code"=>$allot_code,"order_id"=>$al['id'],"order_status"=>3,"order_type"=>'DBD',"before_status"=>$al['status'], 'holder_id' => $al['apply_id']];
                 ProcessOrder::AddProcess($this->post['token'],$process);
                 Db::commit();
                 return error_show(0,"发货更新成功");
@@ -667,7 +667,7 @@ class Allot extends Base
             GoodLog::LogAdd($this->post['token'],$good_data,'DBD');
             $order = ["order_code"=>$al['allot_code'],"status"=>$al['status'],"action_remark"=>'',"action_type"=>"edit"];
             ActionLog::logAdd($this->post['token'],$order,"DBD",4,$this->post);
-            $process=["order_code"=>$allot_code,"order_id"=>$al['id'],"order_status"=>4,"order_type"=>'DBD',"before_status"=>$al['status']];
+            $process=["order_code"=>$allot_code,"order_id"=>$al['id'],"order_status"=>4,"order_type"=>'DBD',"before_status"=>$al['status'], 'holder_id' => $al['apply_id']];
             ProcessOrder::AddProcess($this->post['token'],$process);
             Db::commit();
             return error_show(0, "入库验货更新成功");
@@ -750,7 +750,7 @@ public function vesio(){
                 $good_data[] = ['good_log_code' => $allot_code, "stock_id" => $stock['id'], "type" => 1, 'stock' => $p['stock_num'], "stock_name" => "usable_stock"];
             }
             GoodLog::LogAdd($this->post['token'],$good_data,'DBD');
-            $process=["order_code"=>$allot_code,"order_id"=>$al['id'],"order_status"=>5,"order_type"=>'DBD',"before_status"=>$al['status']];
+            $process=["order_code"=>$allot_code,"order_id"=>$al['id'],"order_status"=>5,"order_type"=>'DBD',"before_status"=>$al['status'], 'holder_id' => $al['apply_id']];
             ProcessOrder::AddProcess($this->post['token'],$process);
             Db::commit();
             return error_show(0, "验货更新成功");

+ 4 - 6
app/admin/controller/Check.php

@@ -333,7 +333,7 @@ public function create(){
         if($da){
             $orde = ["order_code"=>$check_code,"status"=>$data['status'],"action_remark"=>'',"action_type"=>"create"];
             ActionLog::logAdd($this->post['token'],$orde,'PDD',$data['status'],$orde);
-            $process=["order_code"=>$check_code,"order_id"=>$da,"order_status"=>$data['status'],"order_type"=>'PDD',"before_status"=>$data['status']];
+            $process=["order_code"=>$check_code,"order_id"=>$da,"order_status"=>$data['status'],"order_type"=>'PDD',"before_status"=>$data['status'], 'holder_id' => $data['apply_id']];
             ProcessOrder::AddProcess($this->post['token'],$process);
            Db::commit();
             return error_show(0,"盘点创建成功");
@@ -475,8 +475,7 @@ public function edit()
         $sv = Db::name('good_check')->update(['id'=>$id,'is_del'=>1,'updatetime'=>date("Y-m-d H:i:s")]);
         if($sv){
             $orde = ["order_code"=>$deln['check_code'],"status"=>$deln['status'],"action_remark"=>'',"action_type"=>"delete"];
-            ActionLog::logAdd($this->post['token'],$orde,'PDD',$deln['status'],['id'=>$id,'is_del'=>1,
-                'updatetime'=>date("Y-m-d H:i:s")]);
+            ActionLog::logAdd($this->post['token'],$orde,'PDD',$deln['status'],['id'=>$id,'is_del'=>1, 'updatetime'=>date("Y-m-d H:i:s")]);
             $process=["order_code"=>$deln['check_code'],"order_status"=>$deln['status'],"order_type"=>'PDD'];
             ProcessOrder::workdel($process);
             return error_show(0,"删除成功");
@@ -532,8 +531,7 @@ public function edit()
                         return error_show(1003,"未上传盘点结果");
                     }
                 }
-                $process=["order_code"=>$st['check_code'],"order_id"=>$st['id'],"order_status"=>$stauts,
-                    "order_type"=>'PDD',"before_status"=>$temp];
+                $process=["order_code"=>$st['check_code'],"order_id"=>$st['id'],"order_status"=>$stauts, "order_type"=>'PDD',"before_status"=>$temp, 'holder_id' => $st['apply_id']];
                 ProcessOrder::AddProcess($this->post['token'],$process);
                 Db::commit();
                 return error_show(0,"状态更新成功");
@@ -642,7 +640,7 @@ public function edit()
                 if($check_up){
                     $orde = ["order_code"=>$fo['check_code'],$fo['status'],"action_remark"=>'',"action_type"=>"edit"];
                     ActionLog::logAdd($this->post['token'],$orde,'PDD',2,["status"=>2,"updatetime"=>date("Y-m-d H:i:s")]);
-                    $process=["order_code"=>$fo['check_code'],"order_id"=>$fo['id'],"order_status"=>2,"order_type"=>'PDD',"before_status"=>$fo['status']];
+                    $process = ["order_code" => $fo['check_code'], "order_id" => $fo['id'], "order_status" => 2, "order_type" => 'PDD', "before_status" => $fo['status'], 'holder_id' => $fo['apply_id']];
                     ProcessOrder::AddProcess($this->post['token'],$process);
                     Db::commit();
                     return app_show(0,"盘点数据导入成功");

+ 4 - 2
app/admin/controller/Consult.php

@@ -1377,7 +1377,8 @@ class Consult extends Base
                     "order_code" => $bargainNo,
                     "order_id" => $int,
                     "order_status" =>0,
-                    "before_status"=>0
+                    "before_status"=>0,
+                    'holder_id'=>$data['createrid']
                 ]);
                 $odlstatus=$info['status'];
                 $info['status']=3;
@@ -1613,7 +1614,8 @@ class Consult extends Base
                     "action_remark" => '',//备注
                     "action_type" => "status"//新建create,编辑edit,更改状态status
                 ], "YJD", $info['status'], $info);
-                $process=["order_code"=>$bargainNo,"order_id"=>$info['id'],"order_status"=>$info['status'],"order_type"=>'YJD',"before_status"=>$ra_status];
+                $process=["order_code"=>$bargainNo,"order_id"=>$info['id'],"order_status"=>$info['status'],"order_type"=>'YJD',"before_status"=>$ra_status,'holder_id'=>$info['createrid']
+                ];
                 ProcessOrder::AddProcess($token,$process);
                 if($info['status']==1||$info['status']==3||$info['status']==8||$info['status']==6||$info['status']==9||$info['status']==10||$info['status']==11){
                     $bidstatus=$bids['status'];

+ 60 - 34
app/admin/controller/Goodup.php

@@ -531,7 +531,9 @@ class Goodup extends Base
                     "order_type" => 'SPCB',
                     "order_code" => $spucode,//咨询单详情编号
                     "order_id" => $in,
-                    "order_status" => 0, "before_status" => 0
+                    "order_status" => 0,
+                    "before_status" => 0,
+                    'holder_id'=>$data['createrid'],
                 ]);
                     Db::commit();
                     return app_show(0,"创建成功",["spuCode"=>$spucode]);
@@ -793,7 +795,9 @@ class Goodup extends Base
                     "order_type" => 'SPCB',
                     "order_code" => $supcode,//咨询单详情编号
                     "order_id" => $data['id'],
-                    "order_status" =>$temp['status'],"before_status"=>$data['status']
+                    "order_status" =>$temp['status'],
+                    "before_status"=>$data['status'],
+                    'holder_id'=>$data['createrid'],
                 ]);
                 Db::commit();
                 return app_show(0,"更新成功");
@@ -887,7 +891,9 @@ class Goodup extends Base
                     "order_type" => 'SPCB',
                     "order_code" => $supcode,//咨询单详情编号
                     "order_id" => $datas['id'],
-                    "order_status" =>$data['status'],"before_status"=>$datas['status']
+                    "order_status" =>$data['status'],
+                    "before_status"=>$datas['status'],
+                    'holder_id'=>$datas['createrid'],
                 ]);
 //                $online =  Db::name("good_platform")->where(["spuCode"=>$supcode,"is_del"=>0])->find();
 //                if($online){
@@ -1016,7 +1022,9 @@ class Goodup extends Base
                         "order_type" => 'SPSX',
                         "order_code" =>$online['skuCode'],//咨询单详情编号
                         "order_id" => $online['id'],
-                        "order_status" => 2,"before_status"=>$online['exam_status']
+                        "order_status" => 2,
+                        "before_status"=>$online['exam_status'],
+                        'holder_id' => $online['createrid'],
                     ]);
                 }
             }
@@ -1045,7 +1053,9 @@ class Goodup extends Base
                     "order_type" => 'SPCB',
                     "order_code" => $supcode,//咨询单详情编号
                     "order_id" => $data['id'],
-                    "order_status" =>$data['status'],"before_status"=>$old_status
+                    "order_status" =>$data['status'],
+                    "before_status"=>$old_status,
+                    'holder_id'=>$data['createrid'],
                 ]);
                 $data=[
                     "code"=>$supcode,
@@ -1340,7 +1350,9 @@ class Goodup extends Base
                         "order_type" => 'SPSX',
                         "order_code" =>$skuCode,//咨询单详情编号
                         "order_id" => $create,
-                        "order_status" =>$tmp['exam_status'],"before_status"=>$tmp['exam_status']
+                        "order_status" =>$tmp['exam_status'],
+                        "before_status"=>$tmp['exam_status'],
+                        'holder_id' => $tmp['createrid'],
                     ]);
                     $iso = Db::name("good")->where(["spuCode"=>$value['spuCode'],"is_del"=>0])->find();
                     if($iso==false){
@@ -1555,22 +1567,22 @@ class Goodup extends Base
                         //消息表
                         Db::name('order_msg')->insertAll($insert_order_msg_data);
 
-                    } else {
-                        ActionLog::logAdd(['id' => $createrid, 'nickname' => $creater], [
-                            "order_code" => $skuCode,//编号
-                            "status" => $bifore,
-                            "action_remark" => '',//备注
-                            "action_type" => "status"//新建create,编辑edit,更改状态status
-                        ], "SPSX", $exam_status, $platform);
-
-                        ProcessOrder::AddProcess(['id' => $createrid, 'nickname' => $creater], [
-                            "order_type" => 'SPSX',
-                            "order_code" => $skuCode,//咨询单详情编号
-                            "order_id" => $platform['id'],
-                            "order_status" => $exam_status, "before_status" => $bifore
-                        ]);
                     }
+                    ActionLog::logAdd(['id' => $createrid, 'nickname' => $creater], [
+                        "order_code" => $skuCode,//编号
+                        "status" => $bifore,
+                        "action_remark" => '',//备注
+                        "action_type" => "status"//新建create,编辑edit,更改状态status
+                    ], "SPSX", $exam_status, $platform);
 
+                    ProcessOrder::AddProcess(['id' => $createrid, 'nickname' => $creater], [
+                        "order_type" => 'SPSX',
+                        "order_code" => $skuCode,//咨询单详情编号
+                        "order_id" => $platform['id'],
+                        "order_status" => $exam_status,
+                        "before_status" => $bifore,
+                        'holder_id' => $platform['createrid'],
+                    ]);
 
                     //商品上线的话,将数据包塞入到队列中
                     if ($exam_status == 6) {
@@ -1687,7 +1699,9 @@ class Goodup extends Base
                     "order_type" => 'SPSX',
                     "order_code" =>$platform['skuCode'],//咨询单详情编号
                     "order_id" => $platform['id'],
-                    "order_status" => $platform['exam_status'],"before_status"=>$bifore
+                    "order_status" => $platform['exam_status'],
+                    "before_status"=>$bifore,
+                    'holder_id' => $platform['createrid'],
                 ]);
                 $proof=[
                     'spuCode'=>$platform['spuCode'],
@@ -1800,7 +1814,9 @@ class Goodup extends Base
                     "order_type" => 'SPSX',
                     "order_code" =>$platform['skuCode'],//咨询单详情编号
                     "order_id" => $platform['id'],
-                    "order_status" => $platform['exam_status'],"before_status"=>$bifore
+                    "order_status" => $platform['exam_status'],
+                    "before_status"=>$bifore,
+                    'holder_id' => $platform['createrid'],
                 ]);
                 $data=[
                     "code"=>$platform['skuCode'],
@@ -1921,7 +1937,9 @@ class Goodup extends Base
                     "order_type" => 'SPCB',
                     "order_code" =>$newCode,//咨询单详情编号
                     "order_id" => $cre,
-                    "order_status" =>7,"before_status"=>0
+                    "order_status" =>7,
+                    "before_status"=>0,
+                    'holder_id'=>$data['createrid'],
                 ]);
                 if(!empty($ladd)){
                     $na = Db::name("good_nake")->insertAll($ladd);
@@ -1985,8 +2003,7 @@ class Goodup extends Base
         if($unit==''){
             return error_show(1004,"商品单位不能为空");
         }
-        $good_type = isset($this->post['good_type'])&&$this->post['good_type']!==""? intval($this->post['good_type'])
-            :"";
+        $good_type = isset($this->post['good_type'])&&$this->post['good_type']!==""? intval($this->post['good_type']) :"";
         if($good_type===''){
             return error_show(1004,"参数good_type不能为空");
         }
@@ -2019,13 +2036,14 @@ class Goodup extends Base
         if($supplierNo==''){
             return error_show(1004,"参数supplierNo不能为空");
         }
-        $good_size = isset($this->post['good_size'])&&$this->post['good_size']!=""? trim($this->post['good_size'])
-            :"";
+        $supplier = Db::name("supplier")->field('id,personid,person')->where(["code" => $supplierNo])->findOrEmpty();
+        if (empty($supplier)) return error_show(1004, "供应商信息未找到");
+
+        $good_size = isset($this->post['good_size'])&&$this->post['good_size']!=""? trim($this->post['good_size']) :"";
         if($good_size==''){
             return error_show(1004,"参数good_size不能为空");
         }
-        $company_id = isset($this->post['companyNo'])&&$this->post['companyNo']!=""? trim($this->post['companyNo'])
-            :"";
+        $company_id = isset($this->post['companyNo'])&&$this->post['companyNo']!=""? trim($this->post['companyNo']) :"";
         if($company_id==''){
             return error_show(1004,"参数companyNo不能为空");
         }
@@ -2203,7 +2221,9 @@ class Goodup extends Base
                 "stock_moq"=>$stock_moq,
                 "status"=>"0",
                 "updatetime"=>date("Y-m-d H:i:s"),
-                'is_support_barter'=>$is_support_barter
+                'is_support_barter'=>$is_support_barter,
+                'chargerid' => $supplier['personid'] ?? $this->uid,
+                'charger' => $supplier['person'] ?? $this->uname,
             ];
             $field = array_diff_assoc($temp,$data);
             $temp['field_change'] =empty($field)?"":json_encode(array_keys($field));
@@ -2225,7 +2245,9 @@ class Goodup extends Base
                     "order_type" => 'SPCB',
                     "order_code" =>$supcode,//咨询单详情编号
                     "order_id" => $data['id'],
-                    "order_status" =>0,"before_status"=>0
+                    "order_status" =>0,
+                    "before_status"=>0,
+                    'holder_id'=>$data['createrid'],
                 ]);
                 if($speclist!=="" && !empty($speclist)){
                     foreach ($speclist as $value){
@@ -2660,6 +2682,7 @@ class Goodup extends Base
                         "order_id" => isset($value['id']) ? $value['id'] : 0,
                         "order_status" => 8,//待产品审核
                         "before_status" => 0,//待产品审核
+                        'holder_id'=>$value['createrid'],
                     ]);
                 }
                 foreach ($data as $value) {
@@ -2676,7 +2699,8 @@ class Goodup extends Base
                         "order_code" =>$value['skuCode'],//
                         "order_id" => isset($value['id']) ? $value['id'] : 0,
                         "order_status" =>$value['exam_status'],//待产品审核
-                        "before_status" => 0
+                        "before_status" => 0,
+                        'holder_id' => $value['createrid'],
                     ]);
                 }
                 Db::commit();
@@ -2710,7 +2734,7 @@ class Goodup extends Base
         try {
 
             $rs = Db::name("good_platform")
-                ->field('id,spuCode,skuCode,exam_status')
+                ->field('id,spuCode,skuCode,exam_status,createrid')
                 ->where(['skuCode' => $param['skuCode'], 'is_del' => 0])
                 ->where('exam_status', '<>', 6)//exam_status==6上线成功
                 ->find();
@@ -2755,7 +2779,9 @@ class Goodup extends Base
                 "order_type" => 'SPSX',
                 "order_code" => $param['skuCode'],//咨询单详情编号
                 "order_id" => $rs['id'],
-                "order_status" => $exam_status, "before_status" => $rs['exam_status']
+                "order_status" => $exam_status,
+                "before_status" => $rs['exam_status'],
+                'holder_id' => $rs['createrid'],
             ]);
 
             Db::commit();

+ 13 - 5
app/admin/controller/Project.php

@@ -141,7 +141,7 @@ class Project extends Base
                             "action_remark" => '',//备注
                             "action_type" => "create"//新建create,编辑edit,更改状态status
                         ], "PRO", 1, $this->post);
-                        $process = ["order_code" => $projectNo, "order_id" => $pro, "order_status" =>1, "order_type" =>"PRO","before_status"=>1];
+                        $process = ["order_code" => $projectNo, "order_id" => $pro, "order_status" =>1, "order_type" =>"PRO","before_status"=>1,'holder_id'=>$data['createrid']];
                         ProcessOrder::AddProcess(['id'=>$createrid,'nickname'=>$creater], $process);
 
                     //台账记录
@@ -295,7 +295,9 @@ class Project extends Base
                                 "order_type"=>'PRO',
                                 "order_code"=>$projectinfo['projectNo'],
                                 "order_id"=>$project['id'],//这里更新是根据编码更新的,没有主键id
-                                "order_status"=>2,"before_status"=>1
+                                "order_status"=>2,
+                                "before_status"=>1,
+                                'holder_id'=>$project['createrid']
                             ]);
 
                             Db::commit();
@@ -695,7 +697,9 @@ class Project extends Base
                             "order_type" => 'PRO',
                             "order_code" => $projectNo,
                             "order_id" => $info['id'],
-                            "order_status" => 4,"before_status"=>$old_project_status
+                            "order_status" => 4,
+                            "before_status"=>$old_project_status,
+                            'holder_id'=>$info['createrid']
                         ]);
                         Db::commit();
                         return app_show(0,"方案制作成功",["planNo"=>$planNo]);
@@ -874,7 +878,9 @@ class Project extends Base
                                     "order_type" => 'PRO',
                                     "order_code" =>$value['projectNo'],
                                     "order_id" => $poject['id'],
-                                    "order_status" => 3,"before_status"=>$poject['status']
+                                    "order_status" => 3,
+                                    "before_status"=>$poject['status'],
+                                    'holder_id'=>$poject['createrid']
                                 ]);
                             }
                         }
@@ -949,7 +955,9 @@ class Project extends Base
                             "order_type" => 'PRO',
                             "order_code" =>$value,
                             "order_id" => $poject['id'],
-                            "order_status" => 5,"before_status"=>4
+                            "order_status" => 5,
+                            "before_status"=>4,
+                            'holder_id'=>$poject['createrid']
                         ]);
                     }
 

+ 184 - 36
app/admin/controller/Proorder.php

@@ -10,11 +10,10 @@ use think\facade\Db;
 class Proorder extends Base
 {
 
-public function __construct(App $app)
-{
-    parent::__construct($app);
-}
-
+    public function __construct(App $app)
+    {
+        parent::__construct($app);
+    }
 
     //已读列表
     public function list()
@@ -108,20 +107,21 @@ public function __construct(App $app)
         $param = $this->request->filter('trim')->only(['token', 'apply_id' => '', 'action_uid' => '', 'order_code' => '', 'page' => 1, 'size' => 10], 'post');
 
         $db = ProcessWait::alias("a")
-            ->leftJoin("workflow b", "a.order_type=b.order_type and a.order_code=b.order_code")
-            ->where(['is_del' => 0, 'a.status' => ProcessWait::$status_wait]);
+            ->leftJoin('workflow b', 'a.order_type=b.order_type and a.order_code=b.order_code')
+//            ->leftJoin('process p', 'p.process_type=a.order_type AND p.is_del=0 AND p.status=1')
+            ->where(['a.status' => ProcessWait::$status_wait])
+            ->whereFindInSet('handle_user_list', $this->uid);
 
-        $db->where(function ($query) use ($param) {
-            //所属角色
-            $role = $this->checkRole();
+//        $db->where(function ($query) use ($param) {
+        //所属角色
+//            $role = $this->checkRole();
 
 //            if (!empty($role['write']) || $role['roleid'] == 33) $query->whereFindInSet('roleid', $role['roleid']);
-            $query->whereFindInSet('roleid', $role['roleid']);
+//            $query->whereFindInSet('roleid', $role['roleid']);
 
-            //本人id
-            $user = GetUserInfo($param['token']);
-            if (isset($user['data']['id'])) $query->whereOr('wait_id', $user['data']['id']);
-        });
+        //本人id
+//            $query->whereOr('wait_id', $this->uid);
+//        });
 
         if ($param['order_code'] != '') $db->whereLike('a.order_code', '%' . $param['order_code'] . '%');
         if ($param['action_uid'] != '') $db->where('a.action_uid', $param['action_uid']);
@@ -131,9 +131,13 @@ public function __construct(App $app)
         $total = ceil($count / $param['size']);
         $page = $param['page'] > $total ? $total : $param['page'];
         $list = $db
-            ->field("a.id,b.apply_id,b.apply_name,a.addtime,a.action_uid,a.action_name,a.order_status,a.order_type,a.order_process,a.order_code,a.order_id")
+            ->field("a.id,a.addtime,a.action_name,a.order_status,a.order_type,a.order_process,a.order_code,a.order_id,a.handle_user_list")
             ->page($page, $param['size'])
             ->order("a.addtime desc")
+//            ->append(['handle_user_list'])
+//            ->withAttr('handle_user_list', function ($val, $da) {
+//                return [];
+//            })
             ->select()
             ->toArray();
 
@@ -151,29 +155,173 @@ public function __construct(App $app)
             $value['process_name'] = isset($all_process[$value['order_type']]) ? $all_process[$value['order_type']] : '';
             $value['order_name'] = $var['order_name'];
             $value['status_name'] = $var['status_name'];
+
+            //找到流程对应记录的所有人(创建人 or 申请人 or 采购员)
+//            $holder_id = 0;
+
+//            switch ($value['order_type']) {
+//                //1.采购单流程
+//                case 'CGD':
+//                    $holder_id = Db::name('purchease_order')->where(['id' => $value['order_id'], 'is_del' => 0])->value('cgder_id', 0);
+//                    break;
+//                //2.采购单入库流程
+//                case 'RKD':
+//                    $holder_id = Db::name('purchease_in')->where(['id' => $value['order_id'], 'is_del' => 0])->value('apply_id', 0);
+//                    break;
+//                //3.备货申请单流程
+//                case 'BHD':
+//                    $holder_id = Db::name('purchease')->where(['id' => $value['order_id'], 'is_del' => 0])->value('apply_id', 0);
+//                    break;
+//                //4.销售订单流程
+//                case 'XSQRD':
+//                    $holder_id = Db::name('sale')->where(['id' => $value['order_id'], 'is_del' => 0])->value('apply_id', 0);
+//                    break;
+//                //5.发货申请单流程
+//                case 'CKD':
+//                    $holder_id = Db::name('order_out')->where(['id' => $value['order_id'], 'is_del' => 0])->value('apply_id', 0);
+//                    break;
+//                //6.售后申请单流程
+//                case 'SHD':
+//                    $holder_id = Db::name('order_return')->where(['id' => $value['order_id'], 'is_del' => 0])->value('apply_id', 0);
+//                    break;
+//                //7.售后退货单流程
+//                case 'CKTHD':
+//                    $holder_id = Db::name('order_back')->where(['id' => $value['order_id'], 'is_del' => 0])->value('apply_id', 0);
+//                    break;
+//                //8.销售退货单流程
+//                case 'XSTHD':
+//                    $holder_id = Db::name('sale_return')->where(['id' => $value['order_id'], 'is_del' => 0])->value('apply_id', 0);
+//                    break;
+//                //9.采购工差单流程
+//                case 'CGGCD':
+//                    $holder_id = Db::name('purchease_diff')->where(['id' => $value['order_id'], 'is_del' => 0])->value('apply_id', 0);
+//                    break;
+//                //10.销售工差单流程
+//                case 'XSGCD':
+//                    $holder_id = Db::name('sale_diff')
+//                        ->alias('a')
+//                        ->where(['a.id' => $value['order_id']])
+//                        ->leftJoin('sale s', 's.orderCode=a.orderCode')
+//                        ->value('s.apply_id', 0);
+//                    break;
+//                //11.调拨单流程
+//                case 'DBD':
+//                    $holder_id = Db::name('allot_stock')->where(['id' => $value['order_id'], 'is_del' => 0])->value('apply_id', 0);
+//                    break;
+//                //12.盘点单流程
+//                case 'PDD':
+//                    $holder_id = Db::name('good_check')->where(['id' => $value['order_id'], 'is_del' => 0])->value('apply_id', 0);
+//                    break;
+//                //13.议价单流程
+//                case 'YJD':
+//                    $holder_id = Db::name('bargain_order')->where(['id' => $value['order_id'], 'is_del' => 0])->value('createrid', 0);
+//                    break;
+//                //14.项目单流程
+//                case 'PRO':
+//                    $holder_id = Db::name('project')->where(['id' => $value['order_id'], 'is_del' => 0])->value('createrid', 0);
+//                    break;
+//                //15.商品成本流程
+//                case 'SPCB':
+//                    $holder_id = Db::name('good_basic')->where(['id' => $value['order_id'], 'is_del' => 0])->value('chargerid', 0);
+//                    break;
+//                //16.商品上线流程
+//                case 'SPSX':
+//                    $holder_id = Db::name('good_platform')
+//                        ->alias('a')
+//                        ->where(['a.id' => $value['order_id']])
+//                        ->leftJoin('good g', 'g.spuCode=a.spuCode')
+//                        ->value('g.createrid', 0);
+//                    break;
+//                //17.活动流程
+//                case 'HD':
+//                    $holder_id = Db::name('good_activity')->where(['id' => $value['order_id'], 'is_del' => 0])->value('createrid', 0);
+//                    break;
+//                //19.有赞商品上架流程
+//                case 'YZSX':
+//                    $holder_id = Db::name('platform_youzan')
+//                        ->alias('a')
+//                        ->where(['a.id' => $value['order_id']])
+//                        ->leftJoin('good g', 'g.spuCode=a.spuCode')
+//                        ->value('g.createrid', 0);
+//                    break;
+//                //20.有赞订单审核流程
+////                case 'YZQRD':
+////                    $holder_id = Db::name('')->where(['id' => $value['order_id'], 'is_del' => 0])->value('', 0);
+////                    break;
+//                //22.离职交接流程
+//                case 'LZJJ':
+//                    $holder_id = Db::name('resign_info')->where(['id' => $value['order_id'], 'is_del' => 0])->value('hand_uid', 0);
+//                    break;
+//                //23.采购单退货流程
+//                case 'CGTHD':
+//                    $holder_id = Db::name('purchease_return')->where(['id' => $value['order_id'], 'is_del' => 0])->value('apply_id', 0);
+//                    break;
+//                //24.竞价单流程
+//                case 'ZXD':
+//                    $holder_id = Db::name('consult_order')->where(['id' => $value['order_id'], 'is_del' => 0])->value('createrid', 0);
+//                    break;
+//                //25.商品下线流程
+//                case 'GOL':
+//                    $holder_id = Db::name('good_offline_log')->where(['id' => $value['order_id'], 'is_del' => 0])->value('createrid', 0);
+//                    break;
+//            }
+
+            //根据记录的所有人判断哪些人能看到它的记录
+//            $uids_1 = $this->get_uids_by_group_share($holder_id, $value['api_url']);
+
+            //根据角色筛选
+            $uid = Db::name('user_role')
+                ->field('uid')
+                ->where([
+                    ['is_del', '=', 0],
+                    ['uid', 'in', $value['handle_user_list']],
+//                    ['roleid', '<>', 1],//超级管理员不在这个范围内
+                    ['status', '=', 1],
+                ])
+                ->buildSql();
+            $value['handle_user_list'] = Db::name('depart_user')
+                ->where(['is_del' => 0, 'status' => 1])
+                ->where('uid IN ' . $uid)
+                ->column('nickname');
+
+//            $value['uid_1'] = $uids_1;
+//            $value['uid_2'] = $uids_2;
+
+//            $uids = array_intersect($uids_1, $uids_2);
+
+//            $users = Db::name('depart_user')->where(['is_del' => 0, 'status' => 1])->whereIn('uid', $uids)->column('nickname');
+
+            //当前操作人
+//            $value['handle_user_list'] = $value['wait_name'] ? array_merge($users, [$value['wait_name']]) : $users;
+
             $data[] = $value;
         }
         return app_show(0, "获取成功", ["list" => $data, 'count' => $count]);
     }
-public function all(){
-    $token = isset($this->post['token']) ? trim($this->post['token']) : "";
-    if($token==""){
-        return error_show(101,'token不能为空');
-    }
-    $effetc = VerifyTokens($token);
-    if(!empty($effetc) && $effetc['code']!=0){
-        return error_show($effetc['code'],$effetc['message']);
-    }
-    $where=[["is_del","=",0]];
-    $process_name = isset($this->post['process_name']) && $this->post['process_name'] !==""? trim($this->post['process_name']) :"";
-    if($process_name!=""){
-        $where[]=["process_name","like","%$process_name%"];
-    }
-    $process_type = isset($this->post['process_type']) && $this->post['process_type'] !==""? trim($this->post['process_type']) :"";
-    if($process_type!=""){
-        $where[]=["process_type","like","%$process_type%"];
+
+    public function all()
+    {
+        $token = isset($this->post['token']) ? trim($this->post['token']) : "";
+        if ($token == "") {
+            return error_show(101, 'token不能为空');
+        }
+        $effetc = VerifyTokens($token);
+        if (!empty($effetc) && $effetc['code'] != 0) {
+            return error_show($effetc['code'], $effetc['message']);
+        }
+        $where = [["is_del", "=", 0]];
+        $process_name = isset($this->post['process_name']) && $this->post['process_name'] !== "" ? trim($this->post['process_name']) : "";
+        if ($process_name != "") {
+            $where[] = ["process_name", "like", "%$process_name%"];
+        }
+        $process_type = isset($this->post['process_type']) && $this->post['process_type'] !== "" ? trim($this->post['process_type']) : "";
+        if ($process_type != "") {
+            $where[] = ["process_type", "like", "%$process_type%"];
+        }
+        $list = Db::name('process')->where($where)->order("addtime desc")->select();
+        return app_show(0, "获取成功", $list);
     }
-    $list = Db::name('process')->where($where)->order("addtime desc")->select();
-    return app_show(0,"获取成功",$list);
-}
+
+
+
 }

+ 26 - 19
app/admin/controller/Purch.php

@@ -659,7 +659,7 @@ class Purch extends Base
         //原始数据
         $info = Db::name("purchease_order")
             ->whereIn('cgdNo', $cgdNo)
-            ->column('id,cgdNo,status','cgdNo');
+            ->column('id,cgdNo,status,supplierNo','cgdNo');
 
         $upd = Db::name("purchease_order")
             ->whereIn('cgdNo', $cgdNo)
@@ -670,12 +670,19 @@ class Purch extends Base
             ]);
         if ($upd) {
 
-            $user=GetUserInfo($this->post['token']);
-            $uid = isset($user['data']['id'])?$user['data']['id']:0;
-            $uname = isset($user['data']['nickname'])?$user['data']['nickname']:'';
+            $supplier_cgderid = Db::name('supplier')
+                ->where('is_del',0)
+                ->whereIn('code',array_column($info,'supplierNo'))
+                ->column('personid','code');
+//            ->leftJoin('supplier sip', 'sip.code=po.supplierNo')
+//                ->field('po.*,on.orderCode,u.itemid,sip.personid as supplier_cgderid,sip.person as supplier_cgder')
+
+//            $user=GetUserInfo($this->post['token']);
+            $uid = $this->uid;
+            $uname = $this->uname;
 
             foreach ($cgdNo as $vlue) {
-                $process = ["order_code" => $vlue, "order_id" => isset($info[$vlue]['id']) ? $info[$vlue]['id'] : 0, "order_status" => $status, "order_type" => 'CGD', "before_status" => isset($info[$vlue]['status']) ? $info[$vlue]['status'] : 0];
+                $process = ["order_code" => $vlue, "order_id" => isset($info[$vlue]['id']) ? $info[$vlue]['id'] : 0, "order_status" => $status, "order_type" => 'CGD', "before_status" => isset($info[$vlue]['status']) ? $info[$vlue]['status'] : 0, 'holder_id' => isset($supplier_cgderid[$info[$vlue]['supplierNo']]) ? $supplier_cgderid[$info[$vlue]['supplierNo']] : 0];
                 ProcessOrder::AddProcess(['id' => $uid, 'nickname' => $uname], $process);
                 $order = ["order_code" => $vlue, "status" => '', "action_remark" => $remark, "action_type" => "status"];
                 ActionLog::logAdd(['id' => $uid, 'nickname' => $uname], $order, 'CGD', $status, $this->post);
@@ -710,12 +717,12 @@ class Purch extends Base
         if($diff_weight===""){
             return error_show(1002,"参数diff_weight不能为空");
         }
-        $apply_id =GetUserInfo($token);
-        if(empty($apply_id)||$apply_id['code']!=0){
-            return error_show(1002,"申请人数据不存在");
-        }
-        $rid= isset($apply_id["data"]['id']) ?  $apply_id["data"]['id'] : "";
-        $rname= isset($apply_id["data"]['nickname']) ?  $apply_id["data"]['nickname'] : "";
+//        $apply_id =GetUserInfo($token);
+//        if(empty($apply_id)||$apply_id['code']!=0){
+//            return error_show(1002,"申请人数据不存在");
+//        }
+        $rid= $this->uid;
+        $rname= $this->uname;
         $diff_price = round($diff_weight*$cg['gold_price']+$diff_weight*$cg['teach_fee'],2);
 
         //如果有未处理的工差单,不允许创建新的
@@ -749,9 +756,9 @@ class Purch extends Base
             if($item>0){
 
                 $sto = ["order_code"=>$cgdNo,"status"=>1,"action_remark"=>'',"action_type"=>"create"];
-                ActionLog::logAdd($this->post['token'],$sto,"CGGCD",1,$data);
-                $process=["order_code"=>$cgdNo,"order_id"=>$item,"order_status"=>1,"order_type"=>'CGGCD',"before_status"=>1];
-                ProcessOrder::AddProcess($this->post['token'],$process);
+                ActionLog::logAdd(['id'=>$rid,'nickname'=>$rname],$sto,"CGGCD",1,$data);
+                $process=["order_code"=>$cgdNo,"order_id"=>$item,"order_status"=>1,"order_type"=>'CGGCD',"before_status"=>1,'holder_id'=>$rid];
+                ProcessOrder::AddProcess(['id'=>$rid,'nickname'=>$rname],$process);
 
                 $update_standing_book_data = [
                     'cgd_diff_id' => $item,//采购工差单id
@@ -793,7 +800,7 @@ class Purch extends Base
                     }
                     $sto = ["order_code"=>$orderCode['orderCode'],"status"=>1,"action_remark"=>'',"action_type"=>"create"];
                     ActionLog::logAdd($this->post['token'],$sto,"XSGCD",1,$data);
-                    $process=["order_code"=>$orderCode['orderCode'],"order_id"=>$cgd,"order_status"=>1,"order_type"=>'XSGCD',"before_status"=>1];
+                    $process=["order_code"=>$orderCode['orderCode'],"order_id"=>$cgd,"order_status"=>1,"order_type"=>'XSGCD',"before_status"=>1,'holder_id'=>$order['apply_id']];
                     ProcessOrder::AddProcess($this->post['token'],$process);
 
                     $update_standing_book_data['sale_diff_id']=$cgd;//工差单id
@@ -970,10 +977,10 @@ class Purch extends Base
                         }
                     }
                 }
-                $sto = ["order_code"=>$dio['cgdNo'],"status"=>1,"action_remark"=>'',"action_type"=>"create"];
-                ActionLog::logAdd($this->post['token'],$sto,"CGGCD",$status,$this->post);
-                $process=["order_code"=>$dio['cgdNo'],"order_id"=>$dio['id'],"order_status"=>$status,"order_type"=>'CGGCD',"before_status"=>1];
-                ProcessOrder::AddProcess($this->post['token'],$process);
+                $sto = ["order_code" => $dio['cgdNo'], "status" => 1, "action_remark" => '', "action_type" => "create"];
+                ActionLog::logAdd(['id' => $this->uid, 'nickname' => $this->uname], $sto, "CGGCD", $status, $this->post);
+                $process = ["order_code" => $dio['cgdNo'], "order_id" => $dio['id'], "order_status" => $status, "order_type" => 'CGGCD', "before_status" => 1, 'holder_id' => $dio['apply_id']];
+                ProcessOrder::AddProcess(['id' => $this->uid, 'nickname' => $this->uname], $process);
                 Db::commit();
                 return error_show(0,"更新成功");
             }else{

+ 14 - 12
app/admin/controller/Purchin.php

@@ -234,7 +234,7 @@ class Purchin extends Base
             if($win){
                 $sto = ["order_code"=>$wsm_in_code,"status"=>$status,"action_remark"=>'',"action_type"=>"edit"];
                 ActionLog::logAdd($this->post['token'],$sto,"RKD",$status,$this->post);
-                $process=["order_code"=>$wsm_in_code,"order_id"=>$win,"order_status"=>$status,"order_type"=>'RKD',"before_status"=>$status];
+                $process=["order_code"=>$wsm_in_code,"order_id"=>$win,"order_status"=>$status,"order_type"=>'RKD',"before_status"=>$status,'holder_id' => $orin['apply_id']];
                 ProcessOrder::AddProcess($this->post['token'],$process);
                 $order = ["order_code"=>$cgdNo,"status"=>$cgdinfo['status'],"action_remark"=>'',"action_type"=>"edit"];
 
@@ -338,7 +338,9 @@ class Purchin extends Base
                                                 "order_type" => 'CKD',
                                                 "order_code" => $v_outCode['outCode'],//出库单号
                                                 "order_id" => $v_outCode['id'],
-                                                "order_status" => 1,"before_status"=>0
+                                                "order_status" => 1,
+                                                "before_status"=>0,
+                                                'holder_id' => $v_outCode['apply_id']
                                             ]);
                                         }
                                     }
@@ -376,7 +378,7 @@ class Purchin extends Base
                         }
 
                         ActionLog::logAdd($this->post['token'],$order,"CGD", $cgdinfo['status'],$cgdinfo);
-                        $process=["order_code"=>$cgdNo,"order_id"=>$cgdinfo['id'],"order_status"=>$cgdinfo['status'],"order_type"=>'CGD',"before_status"=>$order['status']];
+                        $process = ["order_code" => $cgdNo, "order_id" => $cgdinfo['id'], "order_status" => $cgdinfo['status'], "order_type" => 'CGD', "before_status" => $order['status'], 'holder_id' => Db::name('supplier')->where(['code' => $cgdinfo['supplierNo'], 'is_del' => 0])->value('personid', 0)];
                         ProcessOrder::AddProcess($this->post['token'],$process);
                         Db::commit();
                         return app_show(0,'商品入库成功',["wsm_in_code"=>$wsm_in_code]);
@@ -502,7 +504,7 @@ class Purchin extends Base
             $up =Db::name("purchease_in")->save($info);
             if($up){
                 ActionLog::logAdd($this->post['token'],$order,"RKD",2,$this->post);
-                $process=["order_code"=>$info['wsm_in_code'],"order_id"=>$info['id'],"order_status"=>$info['status'],"order_type"=>'RKD',"before_status"=>$order['status']];
+                $process=["order_code"=>$info['wsm_in_code'],"order_id"=>$info['id'],"order_status"=>$info['status'],"order_type"=>'RKD',"before_status"=>$order['status'],'holder_id' => $info['apply_id']];
                 ProcessOrder::AddProcess($this->post['token'],$process);
                 if(!empty($error_list)){
                     $data=[];
@@ -564,7 +566,7 @@ class Purchin extends Base
             $update = Db::name("purchease_in")->save($info);
             if($update){
                 ActionLog::logAdd($this->post['token'],$order,"RKD",$status,$this->post);
-                $process=["order_code"=>$info['wsm_in_code'],"order_id"=>$info['id'],"order_status"=>$status,"order_type"=>'RKD',"before_status"=>$order['status']];
+                $process=["order_code"=>$info['wsm_in_code'],"order_id"=>$info['id'],"order_status"=>$status,"order_type"=>'RKD',"before_status"=>$order['status'],'holder_id' => $info['apply_id']];
                 ProcessOrder::AddProcess($this->post['token'],$process);
                 if($status==0){
                     $cgdinfo=Db::name("purchease_order")->where(['cgdNo'=>$info['cgdNo'],"is_del"=>0])->find();
@@ -581,7 +583,7 @@ class Purchin extends Base
                     $up=Db::name("purchease_order")->save($cgdinfo);
                     if($up){
                         ActionLog::logAdd($this->post['token'],$order,"CGD", $cgdinfo['status'],$cgdinfo);
-                        $process=["order_code"=>$info['cgdNo'],"order_id"=>$cgdinfo['id'],"order_status"=>$cgdinfo['status'],"order_type"=>'CGD',"before_status"=>$order['status']];
+                        $process=["order_code"=>$info['cgdNo'],"order_id"=>$cgdinfo['id'],"order_status"=>$cgdinfo['status'],"order_type"=>'CGD',"before_status"=>$order['status'],'holder_id'=>Db::name('supplier')->where(['code' => $cgdinfo['supplierNo'], 'is_del' => 0])->value('personid', 0)];
                         ProcessOrder::AddProcess($this->post['token'],$process);
                         Db::commit();
                         return app_show(0,'取消成功');
@@ -605,7 +607,7 @@ class Purchin extends Base
                     $up=Db::name("purchease_order")->save($cgdinfo);
                     if($up){
                         ActionLog::logAdd($this->post['token'],$order,"CGD", $cgdinfo['status'],$cgdinfo);
-                        $process=["order_code"=>$info['cgdNo'],"order_id"=>$cgdinfo['id'],"order_status"=>$cgdinfo['status'],"order_type"=>'CGD',"before_status"=>$order['status']];
+                        $process=["order_code"=>$info['cgdNo'],"order_id"=>$cgdinfo['id'],"order_status"=>$cgdinfo['status'],"order_type"=>'CGD',"before_status"=>$order['status'],'holder_id'=>Db::name('supplier')->where(['code' => $cgdinfo['supplierNo'], 'is_del' => 0])->value('personid', 0)];
                         ProcessOrder::AddProcess($this->post['token'],$process);
                         Db::commit();
                         return app_show(0,'发货成功');
@@ -632,7 +634,7 @@ class Purchin extends Base
                         return error_show(1002,"发货失败");
                     }
                     ActionLog::logAdd($this->post['token'],$order,"CGD", $cgdinfo['status'],$cgdinfo);
-                    $process=["order_code"=>$info['cgdNo'],"order_id"=>$cgdinfo['id'],"order_status"=>$cgdinfo['status'],"order_type"=>'CGD',"before_status"=>$order['status']];
+                    $process=["order_code"=>$info['cgdNo'],"order_id"=>$cgdinfo['id'],"order_status"=>$cgdinfo['status'],"order_type"=>'CGD',"before_status"=>$order['status'],'holder_id'=>Db::name('supplier')->where(['code' => $cgdinfo['supplierNo'], 'is_del' => 0])->value('personid', 0)];
                     ProcessOrder::AddProcess($this->post['token'],$process);
 
                     $good = Db::name("good_stock")->where(["wsm_code"=>$info['wsm_code'], "spuCode"=>$cgdinfo['spuCode'],"is_del"=>0])->find();
@@ -762,7 +764,7 @@ class Purchin extends Base
                     return error_show(1002,"发货失败");
                 }
                 ActionLog::logAdd($this->post['token'],$order,"CGD", $cgdinfo['status'],$cgdinfo);
-                $process=["order_code"=>$info['cgdNo'],"order_id"=>$cgdinfo['id'],"order_status"=>$cgdinfo['status'],"order_type"=>'CGD',"before_status"=>$order['status']];
+                $process=["order_code"=>$info['cgdNo'],"order_id"=>$cgdinfo['id'],"order_status"=>$cgdinfo['status'],"order_type"=>'CGD',"before_status"=>$order['status'],'holder_id'=>Db::name('supplier')->where(['code' => $cgdinfo['supplierNo'], 'is_del' => 0])->value('personid', 0)];
                 ProcessOrder::AddProcess($this->post['token'],$process);
                 $good = Db::name("good_stock")->where(["wsm_code"=>$info['wsm_code'], "spuCode"=>$cgdinfo['spuCode'],"is_del"=>0])->find();
                 if(empty($good)) {
@@ -835,7 +837,7 @@ class Purchin extends Base
 
             }
             ActionLog::logAdd($this->post['token'],$sto,"RKD", $info['status'],$this->post);
-            $process=["order_code"=>$info['wsm_in_code'],"order_id"=>$info['id'],"order_status"=>$info['status'],"order_type"=>'RKD',"before_status"=>$sto['status']];
+            $process=["order_code"=>$info['wsm_in_code'],"order_id"=>$info['id'],"order_status"=>$info['status'],"order_type"=>'RKD',"before_status"=>$sto['status'],'holder_id' => $info['apply_id']];
             ProcessOrder::AddProcess($this->post['token'],$process);
 
             //需要在详情页把相关退货记录原样取出来,所以这里把if去掉,所有记录都入purchease_return表
@@ -938,7 +940,7 @@ class Purchin extends Base
                 if($sa){
                     $stn = ["order_code"=>$info['wsm_in_code'],"status"=>$ark,"action_remark"=>'',"action_type"=>"edit"];
                     ActionLog::logAdd($this->post['token'],$stn,"RKD",6,$info);
-                    $process=["order_code"=>$info['wsm_in_code'],"order_id"=>$info['id'],"order_status"=>6,"order_type"=>'RKD',"before_status"=>$stn['status']];
+                    $process=["order_code"=>$info['wsm_in_code'],"order_id"=>$info['id'],"order_status"=>6,"order_type"=>'RKD',"before_status"=>$stn['status'],'holder_id' => $info['apply_id']];
                     ProcessOrder::AddProcess($this->post['token'],$process);
 
                         $good = Db::name("good_stock")->where(["wsm_code"=>$info['wsm_code'], "spuCode"=>$cgdinfo['spuCode'],"is_del"=>0])->find();
@@ -1016,7 +1018,7 @@ class Purchin extends Base
                         return error_show(1004,"采购单数量更新失败");
                     }
                     ActionLog::logAdd($this->post['token'],$order,"CGD", $cgdinfo['status'],$cgdinfo);
-                    $process=["order_code"=>$cgdinfo['cgdNo'],"order_id"=>$cgdinfo['id'],"order_status"=>$cgdinfo['status'],"order_type"=>'CGD',"before_status"=>$order['status']];
+                    $process=["order_code"=>$cgdinfo['cgdNo'],"order_id"=>$cgdinfo['id'],"order_status"=>$cgdinfo['status'],"order_type"=>'CGD',"before_status"=>$order['status'],'holder_id'=>Db::name('supplier')->where(['code' => $cgdinfo['supplierNo'], 'is_del' => 0])->value('personid', 0)];
                     ProcessOrder::AddProcess($this->post['token'],$process);
                     Db::commit();
                     return  app_show(0,"退货发货成功");

+ 9 - 8
app/admin/controller/Reorder.php

@@ -102,7 +102,7 @@ class Reorder extends Base
             if($create>0){
                 $stn = ["order_code"=>$returnCode,"status"=>0,"action_remark"=>'',"action_type"=>"create"];
                 ActionLog::logAdd($this->post['token'],$stn,"XSTHD",$in['status'],$in);
-                $process=["order_code"=>$returnCode,"order_id"=>$create,"order_status"=>$in['status'],"order_type"=>'XSTHD',"before_status"=>0];
+                $process=["order_code"=>$returnCode,"order_id"=>$create,"order_status"=>$in['status'],"order_type"=>'XSTHD',"before_status"=>0,'holder_id'=>$in['apply_id']];
                 ProcessOrder::AddProcess($this->post['token'],$process);
 
                 //维护台账信息
@@ -594,8 +594,7 @@ class Reorder extends Base
      * @throws \think\db\exception\ModelNotFoundException
      */
     public function exam(){
-        $code =  isset($this->post['returnCode']) && $this->post['returnCode'] !=="" ? trim($this->post['returnCode'])
-            :"";
+        $code =  isset($this->post['returnCode']) && $this->post['returnCode'] !=="" ? trim($this->post['returnCode']):"";
         if($code==""){
             return error_show(1004,"参数returnCode不能为空");
         }
@@ -649,7 +648,7 @@ class Reorder extends Base
             $info["updatetime"]=date("Y-m-d H:i:s");
             $up = Db::name("sale_return")->save($info);
             if($up) {
-                $process = ["order_code" => $code, "order_id" => $info['id'], "order_status" => $status,  "order_type"=>"XSTHD",'before_status'=>$temp];
+                $process = ["order_code" => $code, "order_id" => $info['id'], "order_status" => $status,  "order_type"=>"XSTHD",'before_status'=>$temp,'holder_id'=>$info['apply_id']];
                 ProcessOrder::AddProcess($this->post['token'], $process);
                 $ste = ["order_code" => $code, "status" => $temp, "action_remark" => '', "action_type" => "status"];
                 ActionLog::logAdd($this->post['token'], $ste,  "XSTHD", $status, $info);
@@ -1093,7 +1092,7 @@ class Reorder extends Base
             ];
             $create = Db::name("sale_return")->insert($in,true);
             if($create>0) {
-                $process=["order_code"=>$returnCode,"order_id"=>$create,"order_status"=>0,"order_type"=>'XSTHD',"before_status"=>0];
+                $process=["order_code"=>$returnCode,"order_id"=>$create,"order_status"=>0,"order_type"=>'XSTHD',"before_status"=>0,'holder_id'=>$in['apply_id']];
                 ProcessOrder::AddProcess($this->post['token'],$process);
                 $ste = ["order_code"=>$returnCode,"status"=>0,"action_remark"=>'',
                     "action_type"=>"create"];
@@ -1118,7 +1117,7 @@ class Reorder extends Base
                             $value['updatetime']=date("Y-m-d H:i:s");
                            $up =Db::name("order_out")->save($value);
                            if($up){
-                               $process=["order_code"=> $value['outCode'],"order_id"=>$value['id'],"order_status"=>0,"order_type"=>'CKD',"before_status"=>$tt];
+                               $process=["order_code"=> $value['outCode'],"order_id"=>$value['id'],"order_status"=>0,"order_type"=>'CKD',"before_status"=>$tt,'holder_id' => $value['apply_id']];
                                ProcessOrder::AddProcess($this->post['token'],$process);
                                $ste = ["order_code"=>$value['outCode'],"status"=>$tt,"action_remark"=>'',"action_type"=>"status"];
                                ActionLog::logAdd($this->post['token'],$ste,"CKD",0,$value);
@@ -1221,7 +1220,7 @@ class Reorder extends Base
             if($create>0){
             	$stn = ["order_code"=>$returnCode,"status"=>0,"action_remark"=>'',"action_type"=>"create"];
                 ActionLog::logAdd(["id"=>$this->uid,"nickname"=>$this->uname],$stn,"XSTHD",$in['status'],$in);
-                $process=["order_code"=>$returnCode,"order_id"=>$create,"order_status"=>$in['status'],"order_type"=>'XSTHD',"before_status"=>0];
+                $process=["order_code"=>$returnCode,"order_id"=>$create,"order_status"=>$in['status'],"order_type"=>'XSTHD',"before_status"=>0,'holder_id'=>$in['apply_id']];
                 ProcessOrder::AddProcess(["id"=>$this->uid,"nickname"=>$this->uname],$process);
                   //维护台账信息
                 Db::execute("UPDATE `wsm_standing_book` SET `returnGoodCode`=CONCAT(IFNULL(`returnGoodCode`,''),',{$returnCode}'),`updatetime`='" . date('Y-m-d H:i:s') . "' WHERE `orderCode`='{$orderCode}'");
@@ -1313,7 +1312,9 @@ class Reorder extends Base
                         "order_type" => 'XSQRD',
                         "order_code" =>$order["orderCode"],//出库单号
                         "order_id" => $order["id"],
-                        "order_status" =>$order['status'],"before_status"=>$lor
+                        "order_status" =>$order['status'],
+                        "before_status"=>$lor,
+                        'holder_id=' => $order['apply_id']
                     ]);
 
                     $ordernum['send_num'] -= $thnum;

+ 13 - 10
app/admin/controller/Resign.php

@@ -204,7 +204,7 @@ class Resign extends Base
         ];
         $in = Db::name("purchease")->insert($info,true);
         if($in>0){
-            $order=["order_type"=>'BHD',"order_code"=>$bk_code,"order_id"=>$in,"order_status"=>1,"before_status"=>1];
+            $order=["order_type"=>'BHD',"order_code"=>$bk_code,"order_id"=>$in,"order_status"=>1,"before_status"=>1, 'holder_id' => $info['apply_id']];
             ProcessOrder::AddProcess($token,$order);
             $ste = ["order_code"=>$bk_code,"status"=>0,"action_remark"=>'',"action_type"=>"create"];
             ActionLog::logAdd($token,$ste,"BHD",1,$info);
@@ -260,7 +260,7 @@ class Resign extends Base
         unset($info['id']);
         $in = Db::name("purchease")->insert($info,true);
         if($in>0){
-            $order=["order_type"=>'BHD',"order_code"=>$bk_code,"order_id"=>$in,"order_status"=>1,"before_status"=>1];
+            $order=["order_type"=>'BHD',"order_code"=>$bk_code,"order_id"=>$in,"order_status"=>1,"before_status"=>1, 'holder_id' => $info['apply_id']];
             ProcessOrder::AddProcess($this->post['token'],$order);
             $ste = ["order_code"=>$bk_code,"status"=>0,"action_remark"=>'',"action_type"=>"create"];
             ActionLog::logAdd($this->post['token'],$ste,"BHD",1,$info);
@@ -372,7 +372,7 @@ class Resign extends Base
         ];
         $in = Db::name("purchease")->where($info)->save($up);
         if($in){
-            $order=["order_type"=>'BHD',"order_code"=>$info['bk_code'],"order_id"=>$info['id'],"order_status"=>$info['status'],"before_status"=>1];
+            $order=["order_type"=>'BHD',"order_code"=>$info['bk_code'],"order_id"=>$info['id'],"order_status"=>$info['status'],"before_status"=>1, 'holder_id' => $info['apply_id']];
             ProcessOrder::AddProcess($this->post['token'],$order);
             $ste = ["order_code"=>$info['bk_code'],"status"=>$info['status'],"action_remark"=>'',"action_type"=>"edit"];
             ActionLog::logAdd($this->post['token'],$ste,"BHD",$info['status'],$up);
@@ -421,8 +421,7 @@ class Resign extends Base
         $info['updatetime']=date("Y-m-d H:i:s");
         $up = Db::name("purchease")->update($info);
         if($up){
-            $order=["order_type"=>'BHD',"order_code"=>$info['bk_code'],"order_id"=>$info['id'],
-                "order_status"=>$status,"before_status"=>$temp];
+            $order = ["order_type" => 'BHD', "order_code" => $info['bk_code'], "order_id" => $info['id'], "order_status" => $status, "before_status" => $temp, 'holder_id' => $info['apply_id']];
             ProcessOrder::AddProcess($this->post['token'],$order);
             $ste = ["order_code"=>$info['bk_code'],"status"=> $temp,"action_remark"=>'',"action_type"=>"status"];
             ActionLog::logAdd($this->post['token'],$ste,"BHD",$status,$info);
@@ -537,7 +536,7 @@ class Resign extends Base
                 $info['addtime']=date("Y-m-d H:i:s");
                 $ood=Db::name('purchease')->save($info);
                 if($ood){
-                    $order=["order_type"=>'BHD',"order_code"=>$info['bk_code'],"order_id"=>$info['id'], "order_status"=>$info['status'],"before_status"=>$temp];
+                    $order=["order_type"=>'BHD',"order_code"=>$info['bk_code'],"order_id"=>$info['id'], "order_status"=>$info['status'],"before_status"=>$temp, 'holder_id' => $info['apply_id']];
                     ProcessOrder::AddProcess($this->post['token'],$order);
                     $ste = ["order_code"=>$info['bk_code'],"status"=>$temp,"action_remark"=>'',"action_type"=>"status"];
                     ActionLog::logAdd($this->post['token'],$ste,"BHD",$info['status'],$info);
@@ -629,7 +628,7 @@ class Resign extends Base
             $feed['updatetime']=date("Y-m-d H:i:s");
             $up = Db::name("purchease")->update($feed);
             if($up){
-                $order=["order_type"=>'BHD',"order_code"=>$feed['bk_code'],"order_id"=>$feed['id'], "order_status"=>$feed['status'],"before_status"=>$tem];
+                $order=["order_type"=>'BHD',"order_code"=>$feed['bk_code'],"order_id"=>$feed['id'], "order_status"=>$feed['status'],"before_status"=>$tem, 'holder_id' => $feed['apply_id']];
                 ProcessOrder::AddProcess($this->post['token'],$order);
                 $ste = ["order_code"=>$feed['bk_code'],"status"=>$tem,"action_remark"=>'',"action_type"=>"edit"];
                 ActionLog::logAdd($this->post['token'],$ste,"BHD",$feed['status'],$feed);
@@ -790,7 +789,9 @@ class Resign extends Base
                 "order_type" => 'BHD',
                 "order_code" => $info['bk_code'],//销售单code
                 "order_id" => $info['id'],
-                "order_status" => $info['status'],"before_status"=>$old_info_status
+                "order_status" => $info['status'],
+                "before_status"=>$old_info_status,
+                'holder_id' => $info['apply_id']
             ]);
 
             return app_show(0,"备库单仓库选择成功");
@@ -915,7 +916,7 @@ class Resign extends Base
                         $order = ["order_code" =>  $cgdCode, "status" => 0, "action_remark" => '', "action_type" => "create"];
                         GoodLog::LogAdd($this->post['token'], $good_data, 'CGD');
                         ActionLog::logAdd($this->post['token'], $order, "CGD", 0, $good);
-                        $process = ["order_code" => $cgdCode, "order_id" => $up, "order_status" => $cg['status'], "order_type" => 'CGD',"before_status"=>0];
+                        $process = ["order_code" => $cgdCode, "order_id" => $up, "order_status" => $cg['status'], "order_type" => 'CGD',"before_status"=>0,'holder_id'=>Db::name('supplier')->where(['code' => $cg['supplierNo'], 'is_del' => 0])->value('personid', 0)];
                         ProcessOrder::AddProcess($this->post['token'], $process);
                         $info['wsm_code'] = $wsm_code;
                         $old_info_status = $info['status'];
@@ -936,7 +937,9 @@ class Resign extends Base
                                 "order_type" => 'BHD',
                                 "order_code" => $info['bk_code'],//销售单code
                                 "order_id" => $info['id'],
-                                "order_status" => $info['status'],"before_status"=> $old_info_status
+                                "order_status" => $info['status'],
+                                "before_status"=> $old_info_status,
+                                'holder_id' => $info['apply_id']
                             ]);
 
                             //维护台账记录

+ 4 - 4
app/admin/controller/Resigninfo.php

@@ -113,7 +113,7 @@ class Resigninfo extends Base
         $stn = ["order_code"=>'',"status"=>$status,"action_remark"=>'',"action_type"=>"create"];
         ActionLog::logAdd(['id'=>isset($resign_uid["data"]['id'])?$resign_uid["data"]['id']:0,'nickname'=>$ri],$stn,"LZJJ",$status,$stn);
 
-        $process=["order_code"=>'',"order_id"=>$in,"order_status"=>$status,"order_type"=>'LZJJ',"before_status"=>0];
+        $process=["order_code"=>'',"order_id"=>$in,"order_status"=>$status,"order_type"=>'LZJJ',"before_status"=>0, 'holder_id' => $data['hand_uid']];
         ProcessOrder::AddProcess(['id'=>isset($resign_uid["data"]['id'])?$resign_uid["data"]['id']:0,'nickname'=>$ri],$process);
         return $in ? error_show(0,"添加成功") : error_show(1002,"添加失败");
     }
@@ -174,8 +174,8 @@ class Resigninfo extends Base
       if($it){
           $stn = ["order_code"=>$id,"status"=>0,"action_remark"=>'',"action_type"=>"edit"];
           ActionLog::logAdd($this->post['token'],$stn,"LZJJ",0,$stn);
-          $process=["order_code"=>'',"order_id"=>$id,"order_status"=>$status,"order_type"=>'LZJJ',"before_status"=>0];
-          ProcessOrder::AddProcess(['id'=>isset($resign_uid["data"]['id'])?$resign_uid["data"]['id']:0,'nickname'=>$ri],$process);
+          $process=["order_code"=>'',"order_id"=>$id,"order_status"=>$eid['status'],"order_type"=>'LZJJ',"before_status"=>0, 'holder_id' => $eid['hand_uid']];
+          ProcessOrder::AddProcess(['id'=>$hand_id,'nickname'=>$r],$process);
           return error_show(0,"编辑成功");
       }else{
           return error_show(1002,"编辑失败");
@@ -218,7 +218,7 @@ class Resigninfo extends Base
         if($sv){
             $stn = ["order_code"=>$id,"status"=>$tn,"action_remark"=>'',"action_type"=>"edit"];
             ActionLog::logAdd($this->post['token'],$stn,"LZJJ",$stauts,$st);
-            $process=["order_code"=>'',"order_id"=>$id,"order_status"=>$stauts,"order_type"=>'LZJJ',"before_status"=>$tn];
+            $process = ["order_code" => '', "order_id" => $id, "order_status" => $stauts, "order_type" => 'LZJJ', "before_status" => $tn, 'holder_id' => $st['hand_uid']];
             ProcessOrder::AddProcess($this->post['token'],$process);
             return error_show(0,"状态更新成功");
         }else{

+ 99 - 48
app/admin/controller/Sale.php

@@ -203,12 +203,12 @@ class Sale extends Base
         $remark = isset($this->post['remark']) && $this->post['remark'] !== "" ? trim($this->post['remark']) : "";
         $proof_id = isset($this->post['proof_id']) && $this->post['proof_id'] !== "" ? intval($this->post['proof_id']) : 0;
 
-        $apply_id = GetUserInfo($token);
-        if (empty($apply_id) || $apply_id['code'] != 0) {
-            return error_show(1002, "申请人数据不存在");
-        }
-        $rm = isset($apply_id["data"]['id']) ? $apply_id["data"]['id'] : "";
-        $ri = isset($apply_id["data"]['nickname']) ? $apply_id["data"]['nickname'] : "";
+//        $apply_id = GetUserInfo($token);
+//        if (empty($apply_id) || $apply_id['code'] != 0) {
+//            return error_show(1002, "申请人数据不存在");
+//        }
+        $rm = $this->uid;
+        $ri = $this->uname;
         Db::startTrans();
         try {
             $data = [
@@ -273,7 +273,9 @@ class Sale extends Base
                     "order_type" => 'XSQRD',
                     "order_code" => $orderCode,//销售单code
                     "order_id" => $datainfo,
-                    "order_status" => 0, "before_status" => 0
+                    "order_status" => 0,
+                    "before_status" => 0,
+                    'holder_id' => $data['apply_id']
                 ]);
 
                 if ($is_activity == 1) {
@@ -438,7 +440,9 @@ class Sale extends Base
                                     "order_type" => 'CKD',
                                     "order_code" => $outCode,//出库单号
                                     "order_id" => $ou,
-                                    "order_status" => $out['status'], "before_status" => $out['status']
+                                    "order_status" => $out['status'],
+                                    "before_status" => $out['status'],
+                                    'holder_id'=>$out['apply_id'],
                                 ]);
 
 
@@ -561,7 +565,9 @@ class Sale extends Base
                 "order_type" => 'CGD',
                 "order_code" => $cg['cgdNo'],//销售单code
                 "order_id" => $up,
-                "order_status" => $cg['status'], "before_status" => 0
+                "order_status" => $cg['status'],
+                "before_status" => 0,
+                'holder_id' => $supplier['personid']
             ]);
 
             $standing_book_da = array_merge($standing_book_da, [
@@ -796,7 +802,9 @@ class Sale extends Base
                             "order_type" => 'CKD',
                             "order_code" => $outCode,//出库单号
                             "order_id" => $ou,
-                            "order_status" => $status, "before_status" => 0
+                            "order_status" => $status,
+                            "before_status" => 0,
+                            'holder_id'=>$out['apply_id'],
                         ]);
 
                         //处理台账-既然是根据orderCode更新的数据,那么肯定是有数据的,只需要更新就行了
@@ -1027,7 +1035,9 @@ class Sale extends Base
                     "order_type" => 'XSQRD',
                     "order_code" => $orderCode,//销售单code
                     "order_id" => $datainfo,
-                    "order_status" => $data['status'], "before_status" => 0
+                    "order_status" => $data['status'],
+                    "before_status" => 0,
+                    'holder_id' => $data['apply_id']
                 ]);
                 $old_zx_status = $zx['status'];
                 $sa = Db::name("consult_info")->where($zx)->save(["status" => 5, "updatetime" => date("Y-m-d H:i:s")]);
@@ -1169,7 +1179,9 @@ class Sale extends Base
                                     "order_type" => 'CKD',
                                     "order_code" => $outCode,//出库单号
                                     "order_id" => $ou,
-                                    "order_status" => 0, "before_status" => 0
+                                    "order_status" => 0,
+                                    "before_status" => 0,
+                                    'holder_id'=>$out['apply_id'],
                                 ]);
 
                                 //将发货编号添加到台账中
@@ -1408,7 +1420,9 @@ class Sale extends Base
                     "order_type" => 'PRO',
                     "order_code" => $project['projectNo'],
                     "order_id" => $project['id'],
-                    "order_status" => 6, "before_status" => $old_project_status
+                    "order_status" => 6,
+                    "before_status" => $old_project_status,
+                    'holder_id'=>$project['createrid']
                 ]);
             }
             //修改状态,添加待办,只记录动作
@@ -1541,7 +1555,9 @@ class Sale extends Base
                 "order_type" => 'XSQRD',
                 "order_code" => $orderCode,
                 "order_id" => $datainfo,
-                "order_status" => 0, "before_status" => 0
+                "order_status" => 0,
+                "before_status" => 0,
+                'holder_id' => $datas['apply_id']
             ]);
             $bol = $this->createCgd($cgd, $standing_book_data);
             if ($bol == false) {
@@ -1680,7 +1696,9 @@ class Sale extends Base
                             "order_type" => 'CKD',
                             "order_code" => $outCode,
                             "order_id" => $ou,
-                            "order_status" => 0, "before_status" => 0
+                            "order_status" => 0,
+                            "before_status" => 0,
+                            'holder_id'=>$out['apply_id'],
                         ]);
                         $order['send_num'] += $value['receipt_quantity'];
                         $order['wsend_num'] -= $value['receipt_quantity'];
@@ -1826,7 +1844,9 @@ class Sale extends Base
                 "order_type" => 'XSQRD',
                 "order_code" => $orderCode,
                 "order_id" => $datainfo,
-                "order_status" => 0, "before_status" => 0
+                "order_status" => 0,
+                "before_status" => 0,
+                'holder_id' => $datas['apply_id']
             ]);
             $cgd = [
                 "supplierNo" => $good['supplierNo'],
@@ -1999,7 +2019,9 @@ class Sale extends Base
                                 "order_type" => 'CKD',
                                 "order_code" => $outCode,//出库单号
                                 "order_id" => $ou,
-                                "order_status" => 0, "before_status" => 0
+                                "order_status" => 0,
+                                "before_status" => 0,
+                                'holder_id'=>$out['apply_id'],
                             ]);
                         }
                     } else {
@@ -2444,7 +2466,8 @@ class Sale extends Base
         if ($str) {
             $stc = ["order_code" => $id, "status" => $ed['status'], "action_remark" => '', "action_type" => "delete"];
             ActionLog::logAdd($this->post['token'], $stc, "XSQRD", $ed['status'], ['id' => $id, 'is_del' => 1, 'updatetime' => date("Y-m-d H:i:s")]);
-            $order = ["order_type" => 'XSQRD', "order_code" => $ed['orderCode'], "order_id" => $id, "order_status" => $ed['status']];
+            $order = ["order_type" => 'XSQRD', "order_code" => $ed['orderCode'], "order_id" => $id, "order_status" => $ed['status'],'holder_id' => $ed['apply_id']
+            ];
             ProcessOrder::workdel($order);
             return error_show(0, "删除成功");
         } else {
@@ -2491,12 +2514,12 @@ class Sale extends Base
             }
 
         }
-        $apply_id = GetUserInfo($token);
-        if (empty($apply_id) || $apply_id['code'] != 0) {
-            return error_show(1002, "申请人数据不存在");
-        }
-        $rm = isset($apply_id["data"]['id']) ? $apply_id["data"]['id'] : "";
-        $ri = isset($apply_id["data"]['nickname']) ? $apply_id["data"]['nickname'] : "";
+//        $apply_id = GetUserInfo($token);
+//        if (empty($apply_id) || $apply_id['code'] != 0) {
+//            return error_show(1002, "申请人数据不存在");
+//        }
+        $rm = $this->uid;
+        $ri = $this->uname;
 
         Db::startTrans();
         try {
@@ -2507,7 +2530,7 @@ class Sale extends Base
             if ($st) {
                 $stn = ["order_code" => $dio['orderCode'], "status" => $vmp, "action_remark" => '', "action_type" => "status"];
                 ActionLog::logAdd($this->post['token'], $stn, $dio['order_type'] == 2 ? "ZXQRD" : "XSQRD", $dio['status'], $dio);
-                $order = ["order_type" => "XSQRD", "order_code" => $dio['orderCode'], "order_id" => $id, "order_status" => $dio['status'], "before_status" => 1];
+                $order = ["order_type" => "XSQRD", "order_code" => $dio['orderCode'], "order_id" => $id, "order_status" => $dio['status'], "before_status" => 1,'holder_id' => $dio['apply_id']];
                 ProcessOrder::AddProcess($this->post['token'], $order);
                 if ($status == 3 && $dio['order_type'] == 1) {
                     $dn = Db::name('sale_info')->where(['orderCode' => $st['orderCode']])->select();
@@ -2626,7 +2649,9 @@ class Sale extends Base
                                     "order_type" => 'CKD',
                                     "order_code" => $outCode,//出库单号
                                     "order_id" => $datainfo,
-                                    "order_status" => 0, "before_status" => 0
+                                    "order_status" => 0,
+                                    "before_status" => 0,
+                                    'holder_id'=>$data['apply_id'],
                                 ]);
                             }
                         }
@@ -2718,7 +2743,7 @@ class Sale extends Base
             if ($datainfo) {
                 $stx = ["order_code" => $etid['orderCode'], "status" => $etid['status'], "action_remark" => '', "action_type" => "edit"];
                 ActionLog::logAdd($this->post['token'], $stx, "XSQRD", 2, $data);
-                $order = ["order_type" => "XSQRD", "order_code" => $etid['orderCode'], "order_id" => $id, "order_status" => $data['status'], "before_status" => 0];
+                $order = ["order_type" => "XSQRD", "order_code" => $etid['orderCode'], "order_id" => $id, "order_status" => $data['status'], "before_status" => 0,'holder_id'=>$etid['apply_id']];
                 ProcessOrder::AddProcess($this->post['token'], $order);
                 foreach ($vr as $value) {
                     $tm = [];
@@ -2828,7 +2853,8 @@ class Sale extends Base
             if ($datainfo > 0) {
                 $stx = ["order_code" => $outCode, "status" => $status, "action_remark" => '', "action_type" => "create"];
                 ActionLog::logAdd($this->post['token'], $stx, $der['order_type'] == 1 ? "CKD" : 'ZXCKD', $status, $data);
-                $order = ["order_type" => "CKD", "order_code" => $outCode, "order_id" => $datainfo, "order_status" => $data['status'], "before_status" => 0];
+                $order = ["order_type" => "CKD", "order_code" => $outCode, "order_id" => $datainfo, "order_status" => $data['status'], "before_status" => 0,                                    'holder_id'=>$data['apply_id']
+                ];
                 ProcessOrder::AddProcess($this->post['token'], $order);
                 if ($status == 1) {
                     $item = $der['status'];
@@ -2845,7 +2871,7 @@ class Sale extends Base
                     $stx = ["order_code" => $orderCode, "status" => $item, "action_remark" => '', "action_type" => "edit"];
 
                     ActionLog::logAdd($this->post['token'], $stx, "XSQRD", $der['status'], $der);
-                    $order = ["order_type" => "XSQRD", "order_code" => $orderCode, "order_id" => $der['id'], "order_status" => $data['status'], "before_status" => 0];
+                    $order = ["order_type" => "XSQRD", "order_code" => $orderCode, "order_id" => $der['id'], "order_status" => $data['status'], "before_status" => 0,'holder_id'=>$der['apply_id']];
 
                     ProcessOrder::AddProcess($this->post['token'], $order);
                 }
@@ -2894,7 +2920,7 @@ class Sale extends Base
             if ($cust) {
                 $stx = ["order_code" => $outCode, "status" => $time, "action_remark" => '', "action_type" => "status"];
                 ActionLog::logAdd($this->post['token'], $stx, "CKD", $codeinfo['status'], $codeinfo);
-                $order = ["order_type" => "CKD", "order_code" => $outCode, "order_id" => $codeinfo['id'], "order_status" => $codeinfo['status'], "before_status" => 0];
+                $order = ["order_type" => "CKD", "order_code" => $outCode, "order_id" => $codeinfo['id'], "order_status" => $codeinfo['status'], "before_status" => 0,            'holder_id'=>$codeinfo['apply_id']];
                 ProcessOrder::AddProcess($this->post['token'], $order);
                 if ($status == 1) {
                     $stokc = Db::name("good_stock")->where(['spuCode' => $codeinfo['spuCode'], "wsm_code" => $codeinfo['wsm_code'],
@@ -2928,9 +2954,8 @@ class Sale extends Base
                         return error_show(1003, "更新失败");
                     }
                     $stx = ["order_code" => $dr['orderCode'], "status" => $item, "action_remark" => '', "action_type" => "edit"];
-                    ActionLog::logAdd($this->post['token'], $stx, $dr['order_type'] == 2 ? "ZXQRD" : "XSQRD", $dr['status'],
-                        $dr);
-                    $order = ["order_type" => "XSQRD", "order_code" => $dr['orderCode'], "order_id" => $dr['id'], "order_status" => $dr['status'], "before_status" => 0];
+                    ActionLog::logAdd($this->post['token'], $stx, $dr['order_type'] == 2 ? "ZXQRD" : "XSQRD", $dr['status'],$dr);
+                    $order = ["order_type" => "XSQRD", "order_code" => $dr['orderCode'], "order_id" => $dr['id'], "order_status" => $dr['status'], "before_status" => 0, 'holder_id' => $dr['apply_id']];
                     ProcessOrder::AddProcess($this->post['token'], $order);
 
                     //商品变动日志表,good_log_code字段存储销售订单编号
@@ -3088,9 +3113,9 @@ class Sale extends Base
             $up = Db::name("sale_diff")->save($info);
             if ($up) {
                 $stx = ["order_code" => $info["orderCode"], "status" => $item, "action_remark" => '', "action_type" => "edit"];
-                ActionLog::logAdd($this->post['token'], $stx, "XSGCD", $info['status'], $info);
-                $order = ["order_type" => "XSGCD", "order_code" => $info["orderCode"], "order_id" => $info['id'], "order_status" => $info['status'], "before_status" => $item];
-                ProcessOrder::AddProcess($this->post['token'], $order);
+                ActionLog::logAdd(['id'=>$this->uid,'nickname'=>$this->uname], $stx, "XSGCD", $info['status'], $info);
+                $order = ["order_type" => "XSGCD", "order_code" => $info["orderCode"], "order_id" => $info['id'], "order_status" => $info['status'], "before_status" => $item,'holder_id'=>$sale['apply_id']];
+                ProcessOrder::AddProcess(['id'=>$this->uid,'nickname'=>$this->uname], $order);
                 $upda = [
                     "status" => $status,
                     "remark" => $remark,
@@ -3124,9 +3149,9 @@ class Sale extends Base
                     }
 
                     $a = ["order_code" => $old_purchease_diff["cgdNo"], "status" => $old_purchease_diff['status'], "action_remark" => '', "action_type" => "status"];
-                    ActionLog::logAdd($this->post['token'], $a, "CGGCD", $upda['status'], $info);
-                    $b = ["order_type" => "CGGCD", "order_code" => $old_purchease_diff["cgdNo"], "order_id" => $old_purchease_diff['id'], "order_status" => $upda['status'], "before_status" => $old_purchease_diff['status']];
-                    ProcessOrder::AddProcess($this->post['token'], $b);
+                    ActionLog::logAdd(['id' => $this->uid, 'nickname' => $this->uname], $a, "CGGCD", $upda['status'], $info);
+                    $b = ["order_type" => "CGGCD", "order_code" => $old_purchease_diff["cgdNo"], "order_id" => $old_purchease_diff['id'], "order_status" => $upda['status'], "before_status" => $old_purchease_diff['status'], 'holder_id' => $cgd['apply_id']];
+                    ProcessOrder::AddProcess(['id' => $this->uid, 'nickname' => $this->uname], $b);
 
                     Db::commit();
                     return app_show(0, "更新成功");
@@ -3180,8 +3205,7 @@ class Sale extends Base
             if ($up) {
                 $stx = ["order_code" => $info["orderCode"], "status" => $ite, "action_remark" => '', "action_type" => "status"];
                 ActionLog::logAdd($this->post['token'], $stx, "XSGCD", $status, $info);
-                $order = ["order_type" => "XSGCD", "order_code" => $info["orderCode"], "order_id" => $info['id'],
-                    "order_status" => $status, "before_status" => $ite];
+                $order = ["order_type" => "XSGCD", "order_code" => $info["orderCode"], "order_id" => $info['id'],"order_status" => $status, "before_status" => $ite,'holder_id'=>$sale['apply_id']];
                 ProcessOrder::AddProcess($this->post['token'], $order);
                 $cgdup = Db::name("purchease_diff")->where(["id" => $info['cgd_diffid']])->save($upda);
                 if ($cgdup) {
@@ -3624,7 +3648,9 @@ class Sale extends Base
                         "order_type" => 'CKD',
                         "order_code" => $data['outCode'],//出库单号
                         "order_id" => $datainfo,
-                        "order_status" => $data['status'], "before_status" => 0
+                        "order_status" => $data['status'],
+                        "before_status" => 0,
+                        'holder_id'=>$data['apply_id']
                     ]);
 
                     //维护台账记录
@@ -3721,6 +3747,7 @@ class Sale extends Base
                     "before_status" => $old_outinfo_status,
                     'wait_id'=>$outinfo['apply_id'],
                     'wait_name'=>$outinfo['apply_name'],
+                    'holder_id'=>$outinfo['apply_id'],
                 ]);
                 if($einfo['wsend_num']<$outinfo['send_num']){
                     Db::rollback();
@@ -3752,7 +3779,9 @@ class Sale extends Base
                     "order_type" => 'XSQRD',
                     "order_code" => $einfo['orderCode'],//出库单号
                     "order_id" => $einfo['id'],
-                    "order_status" => $einfo['status'], "before_status" => $orderstatus
+                    "order_status" => $einfo['status'],
+                    "before_status" => $orderstatus,
+                    'holder_id' => $einfo['apply_id']
                 ]);
 
                 $stokc = Db::name("good_stock")->where(['spuCode' => $einfo['good_code'], "wsm_code" => $outinfo['wsm_code'], "is_del" => 0])->find();
@@ -4287,7 +4316,7 @@ class Sale extends Base
         try {
 
             $rs = Db::name('order_out')
-                ->field('id,orderCode')
+                ->field('id,orderCode,apply_id')
                 ->where(['outCode' => $outCode, 'status' => 2, "is_del" => 0])
                 ->find();
 
@@ -4311,6 +4340,24 @@ class Sale extends Base
                     ->update(['status' => 2, 'updatetime' => date('Y-m-d H:i:s')]);
             }
 
+            //修改状态,添加待办
+            ActionLog::logAdd(['id' => $this->uid, 'nickname' => $this->uname], [
+                "order_code" => $outCode,
+                "status" => 2,//这里的status是之前的值
+                "action_remark" => '',//备注
+                "action_type" => "status"//新建create,编辑edit,更改状态status
+            ], "CKD", 3, $rs);
+
+            //将待办数据变为已办
+            ProcessOrder::AddProcess(['id' => $this->uid, 'nickname' => $this->uname], [
+                "order_code" => $outCode,
+                "order_id" => $rs['id'],
+                "order_status" => 3,
+                "order_type" => 'CKD',
+                "before_status" => 2,
+                'holder_id' => $rs['apply_id']
+            ]);
+
             if ($res_order_out) {
                 Db::commit();
                 return app_show(0, '收货完成');
@@ -4358,9 +4405,9 @@ class Sale extends Base
 
 
 
-        $user = GetUserInfo($param['token']);
-        $createrid = isset($user['data']['id']) ? $user['data']['id'] : 0;
-        $creater = isset($user['data']['nickname']) ? $user['data']['nickname'] : '';
+//        $user = GetUserInfo($param['token']);
+        $createrid = $this->uid;
+        $creater = $this->uname;
 
         //所有发货单信息
         $order_out_infos = Db::name("order_out")
@@ -4386,6 +4433,7 @@ class Sale extends Base
                     ->where('is_del', 0)
                     ->column('id,send_num,wsend_num,status,good_code,order_source,order_type', 'orderCode');
 
+
                 if (!isset($sale_infos[$order_out_infos[$value['outCode']]['orderCode']])) throw new Exception($value['outCode'] . '该发货单对应的销售单未找到');
 
                 //判断发货单是否重复
@@ -4428,6 +4476,7 @@ class Sale extends Base
                         "before_status" => $order_out_infos[$value['outCode']]['status'],
                         'wait_id' => $order_out_infos[$value['outCode']]['apply_id'],
                         'wait_name' => $order_out_infos[$value['outCode']]['apply_name'],
+                        'holder_id' => $order_out_infos[$value['outCode']]['apply_id'],
                     ]);
 
 
@@ -4456,7 +4505,9 @@ class Sale extends Base
                         "order_type" => 'XSQRD',
                         "order_code" => $order_out_infos[$value['outCode']]['orderCode'],//出库单号
                         "order_id" => $sale_infos[$order_out_infos[$value['outCode']]['orderCode']]['id'],
-                        "order_status" => $einfo['status'], "before_status" => $sale_infos[$order_out_infos[$value['outCode']]['orderCode']]['status']
+                        "order_status" => $einfo['status'],
+                        "before_status" => $sale_infos[$order_out_infos[$value['outCode']]['orderCode']]['status'],
+                        'holder_id' => $sale_infos[$order_out_infos[$value['outCode']]['orderCode']]['apply_id']
                     ]);
 
                     //【库存】

+ 11 - 7
app/admin/controller/Salezx.php

@@ -223,7 +223,8 @@ class Salezx extends \app\BaseController
                                    "order_code" => $outCode,//出库单号
                                    "order_id" => $ou,
                                    "order_status" => $out['status'],
-                                   'before_status'=>0
+                                   'before_status'=>0,
+                                   'holder_id' => $out['apply_id']
                                ]);
 
                                $standing_bood_data['outCode'][]=$outCode;
@@ -248,7 +249,8 @@ class Salezx extends \app\BaseController
                     "order_type" => 'XSQRD',
                     "order_code" => $orderCode,//销售单code
                     "order_id" => $datainfo,
-                    "order_status" => 0
+                    "order_status" => 0,
+                    'holder_id=' => $data['apply_id']
                 ]);
 
 
@@ -373,7 +375,8 @@ class Salezx extends \app\BaseController
                             "order_type" => 'CGD',
                             "order_code" => $cg['cgdNo'],//销售单code
                             "order_id" => $up,
-                            "order_status" => $cg['status']
+                            "order_status" => $cg['status'],
+                            'holder_id'=>$supplier['personid']
                         ]);
 
                         $standing_bood_data['cgdNo']=$cgdCode;
@@ -585,7 +588,7 @@ class Salezx extends \app\BaseController
             if($datainfo) {
                 $st = ["order_code"=>$der['outCode'],"status"=>$var,"action_remark"=>'',"action_type"=>"edit"];
                 ActionLog::logAdd($this->post['token'],$st,"CKD",1,$der);
-                $ord=["order_type"=>"CKD","order_code"=>$der['outCode'],"order_id"=>$der['id'], "order_status"=>$der['status']];
+                $ord=["order_type"=>"CKD","order_code"=>$der['outCode'],"order_id"=>$der['id'], "order_status"=>$der['status'],'holder_id' => $der['apply_id']];
                 ProcessOrder::AddProcess($this->post['token'],$ord);
 //                    $send =Db::name("order_out")->where(["wsm_code"=>$der['wsm_code'],'orderCode'=>$der['orderCode']])->sum("send_num");
 //                    $order['send_num']+= $der['send_num'];
@@ -760,7 +763,7 @@ class Salezx extends \app\BaseController
                 }
                 $sio = ["order_code"=>$outCode,"status"=>0,"action_remark"=>'',"action_type"=>"create"];
                 ActionLog::logAdd(['id'=>$rm,'nickname'=>$ri],$sio,"CKD",0,$data);
-                $order=["order_type"=>"CKD","order_code"=>$data['outCode'],"order_id"=>$datainfo,"order_status"=>$data['status'],'before_status'=>0];
+                $order=["order_type"=>"CKD","order_code"=>$data['outCode'],"order_id"=>$datainfo,"order_status"=>$data['status'],'before_status'=>0, 'holder_id' => $data['apply_id']];
                 ProcessOrder::AddProcess(['id'=>$rm,'nickname'=>$ri],$order);
                 $item = $der['status'];
                 $der['send_num']+= $receipt_quantity;
@@ -785,12 +788,13 @@ class Salezx extends \app\BaseController
                         "order_type" => 'XSQRD',
                         "order_code" => $der['orderCode'],//销售单code
                         "order_id" => $der['id'],
-                        "order_status" => $der['status']
+                        "order_status" => $der['status'],
+                        'holder_id=' => $der['apply_id']
                     ]);
                 }
             $sio = ["order_code"=>$orderCode,"status"=>$item,"action_remark"=>'',"action_type"=>"edit"];
             ActionLog::logAdd($this->post['token'],$sio,"zxd",$der['status'],$der);
-            $order=["order_type"=>"CKD","order_code"=>$orderCode,"order_id"=>$der['id'],"order_status"=>$der['status']];
+            $order=["order_type"=>"CKD","order_code"=>$orderCode,"order_id"=>$der['id'],"order_status"=>$der['status'], 'holder_id' => $data['apply_id']];
             ProcessOrder::AddProcess($this->post['token'],$order);
                 Db::commit();
                 return error_show(0,"创建成功");

+ 2 - 2
app/admin/controller/Version.php

@@ -332,7 +332,7 @@ class Version extends BaseController
                                 "action_type" => "edit"//新建create,编辑edit更改状态status
                             ], "PRO", 3, ["status" => 3, "updatetime" => date("Y-m-d H:i:s")]);
 
-                            $process = ["order_code" => $value['projectNo'], "order_id" => $pr['id'], "order_status" =>3, "order_type" => 'PRO',"before_status"=> $pr['status']];
+                            $process = ["order_code" => $value['projectNo'], "order_id" => $pr['id'], "order_status" =>3, "order_type" => 'PRO',"before_status"=> $pr['status'],'holder_id'=>$pr['createrid']];
                             ProcessOrder::AddProcess(['id'=>0,"nickname"=>'客户'], $process);
                         }
                     }else{
@@ -411,7 +411,7 @@ class Version extends BaseController
                     "action_type" => "edit"//新建create,编辑edit更改状态status
                 ], "PRO", 5, ["status" => 5, "updatetime" => date("Y-m-d H:i:s")]);
 
-                $process = ["order_code" => $pr['projectNo'], "order_id" => $pr['id'], "order_status" =>5, "order_type" => 'PRO',"before_status"=> $pr['status']];
+                $process = ["order_code" => $pr['projectNo'], "order_id" => $pr['id'], "order_status" =>5, "order_type" => 'PRO',"before_status"=> $pr['status'],'holder_id'=>$pr['createrid']];
                 ProcessOrder::AddProcess(['id'=>0,"nickname"=>'客户'], $process);
                     Db::commit();
                     return app_show(0, "方案数据修改成功");

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

@@ -35,12 +35,15 @@ class ProcessOrder extends \think\Model
             "action_status"=>$order['before_status'],
             "action_uid"=>$uid,
             "action_name"=>$name,
-            "addtime"=>date("Y-m-d H:i:s")
+            "addtime"=>date("Y-m-d H:i:s"),
+//            'holder_id'=>$order['holder_id'],//数据所有人
         ];
         OrderMsg::addmsg($data);
 
         //手动排除竞价单ZXD
-        if($order['order_type']!='ZXD') ProcessWait::add($data, isset($order['wait_id']) ? $order['wait_id'] : 0, isset($order['wait_name']) ? $order['wait_name'] : '');
+        if($order['order_type']!='ZXD') {
+            ProcessWait::add(array_merge($data, ['holder_id' => $order['holder_id'] ?? 0]), isset($order['wait_id']) ? $order['wait_id'] : 0, isset($order['wait_name']) ? $order['wait_name'] : '');
+        }
 
         $insert = $data;
         //如果是【供应商】应用,即abutment,增加字段source==2(操作来源为供应商)

+ 3 - 1
app/admin/model/ProcessWait.php

@@ -43,7 +43,7 @@ class ProcessWait extends Model
         //查询流程下该节点值的id
         $info = Db::name('process')
             ->alias('a')
-            ->field('p.id,p.action_type,p.operation_type')
+            ->field('p.id,p.action_type,p.operation_type,a.api_url')
             ->join('action_process p', 'p.process_id=a.id AND p.order_process=' . $data['action_process'])
             ->where(['a.process_type' => $data['order_type'], 'a.status' => Process::$status_normal, 'a.is_del' => Process::$is_del_normal])
             ->findOrEmpty();
@@ -135,6 +135,7 @@ class ProcessWait extends Model
             ];
 
             if ($wait_id) {
+                $insert_data['handle_user_list'] = $wait_id;//handle_user_list当前待处理人的uid集合
                 $insert_data['wait_id'] = $wait_id;
                 $insert_data['wait_name'] = $wait_name;
             } else {
@@ -144,6 +145,7 @@ class ProcessWait extends Model
                     ->where('is_del', 0)
                     ->column('role_id');
                 $insert_data['roleid'] = implode(',', $roleid);
+                $insert_data['handle_user_list'] = get_handle_user_list($info['id'], $data['holder_id'] ?? 0, $info['api_url']);//handle_user_list当前待处理人的uid集合
             }
 
             //增加新的节点

+ 9 - 9
app/admin/route/app.php

@@ -91,11 +91,11 @@ Route::rule('Consultdel','admin/Consult/del');
 
 Route::rule('infolist','admin/Listcustomer/list');
 
-Route::rule('salecreate','admin/Sale/create');
-Route::rule('salelist','admin/Sale/list');
-Route::rule('saleedit','admin/Sale/edit');
-Route::rule('saleinfo','admin/Sale/info');
-Route::rule('saledelect','admin/Sale/del');
+Route::rule('salecreate','admin/Sale/create');//参加销售订单
+Route::rule('salelist','admin/Sale/list');//销售订单列表
+Route::rule('saleedit','admin/Sale/edit');//编辑销售订单
+Route::rule('saleinfo','admin/Sale/info');//销售订单详情
+Route::rule('saledelect','admin/Sale/del');//删除销售订单
 Route::rule('salestatus','admin/Sale/status');
 Route::rule('salefee','admin/Sale/fee');
 Route::rule('saleout','admin/Sale/out');
@@ -182,7 +182,7 @@ Route::rule("goodloglist","admin/Good/loglist");
 Route::rule("goodplist","admin/Good/goodlist");
 Route::rule("getgoodlistbyladder","admin/Good/getGoodListByLadder");
 
-Route::rule("purchlist","admin/Resign/list");
+Route::rule("purchlist","admin/Resign/list");//备库单列表
 Route::rule("purchadd","admin/Resign/add");//创建备库单
 Route::rule("purchcopy","admin/Resign/copy");
 Route::rule("purchedit","admin/Resign/edit");
@@ -197,7 +197,7 @@ Route::rule("feeddel","admin/Resign/delFeed");
 Route::rule("feedchange","admin/Resign/changeFeed");
 Route::rule("feedinfo","admin/Resign/infoFeed");
 
-Route::rule("cgdlist","admin/Purch/list");
+Route::rule("cgdlist","admin/Purch/list");//采购单列表
 Route::rule("cgdinfo","admin/Purch/info");
 Route::rule("cgdedit","admin/Purch/edit");
 Route::rule("cgdeditnew","admin/Purch/editNew");//修改采购单的供应商
@@ -268,8 +268,8 @@ Route::rule('aftercancel','admin/After/Cancel');
 Route::rule('createSaleAndCgdByAfter','admin/After/createSaleAndCgdByAfter');
 //Route::rule('aftersetwsm','admin/After/setWsm');
 
-Route::rule('processolist','admin/Proorder/list');
-Route::rule('processowaitlist','admin/Proorder/waitlist');
+Route::rule('processolist','admin/Proorder/list');//我的已办
+Route::rule('processowaitlist','admin/Proorder/waitlist');//我的待办
 Route::rule('processoall','admin/Proorder/all');
 
 Route::rule('orderbacklist','admin/Orderback/list');

+ 7 - 2
app/command/ImportOrderFromCHandleData.php

@@ -24,6 +24,9 @@ class ImportOrderFromCHandleData extends Command
 
     private $cgd_data = [];//存储采购单的数据,目前是为了做供应商api推送而准备的
 
+
+
+
     protected function configure()
     {
         // 指令配置
@@ -407,7 +410,8 @@ class ImportOrderFromCHandleData extends Command
                                         "order_code" => $outCode,//出库单号
                                         "order_id" => 0,
                                         "order_status" => 0,
-                                        "before_status" => 0
+                                        "before_status" => 0,
+                                        'holder_id' => $out['apply_id']
                                     ]);
 
                                     $standing_book_data['outCode'] = $outCode;
@@ -571,7 +575,8 @@ class ImportOrderFromCHandleData extends Command
                 "order_code" => $cg['cgdNo'],//销售单code
                 "order_id" => $up,
                 "order_status" => $cg['status'],
-                "before_status" => 0
+                "before_status" => 0,
+                'holder_id' => $supplier['personid']
             ]);
 
             $standing_book_data['cgdNo'] = $cgdCode;

+ 4 - 2
app/command/handleYzOrderData.php

@@ -478,7 +478,8 @@ class handleYzOrderData extends Command
                                     "order_code" => $outCode,//出库单号
                                     "order_id" => 0,
                                     "order_status" => 0,
-                                    "before_status" => 0
+                                    "before_status" => 0,
+                                    'holder_id'=>$data['apply_id']
                                 ]);
 
 //                                $standing_book_data['outCode'] = $outCode;
@@ -646,7 +647,8 @@ class handleYzOrderData extends Command
                 "order_code" => $cg['cgdNo'],//销售单code
                 "order_id" => $up,
                 "order_status" => $cg['status'],
-                "before_status" => 0
+                "before_status" => 0,
+                'holder_id'=>$supplier['personid']
             ]);
 
             $standing_book_data['cgdNo'] = $cgdCode;

+ 61 - 0
app/common.php

@@ -1213,5 +1213,66 @@ if (!function_exists('checkHasAccountBySupplierNos')) {
             ->where('status', \app\abutment\model\SupplierUser::$status_normal)
             ->column('uid','supplierNo');
 
+    }
+}
+
+
+//获取当前操作人(待办列表)
+if (!function_exists('get_handle_user_list')) {
+    function get_handle_user_list(int $action_process_id = 0, int $holder_id = 0, string $api_url = '')
+    {
+
+        //筛选符合流程权限的角色id集合
+        $roleids = Db::name('role_process')
+            ->where('is_del', 0)
+            ->where('role_id', '<>', 1)//排除超级管理员
+            ->whereFindInSet('action_data', $action_process_id)
+            ->field('role_id')
+            ->buildSql();
+
+        //根据角色id筛选用户id
+        $data = Db::name('user_role')
+            ->where(['is_del' => 0, 'status' => 1])
+            ->where('roleid IN ' . $roleids)
+            ->column('uid', []);
+
+        //根据菜单筛选符合条件的共享数据
+        //当前请求的接口地址
+        if ($api_url == '') $api_url = app('http')->getName() . '/' . request()->pathinfo();
+        $menu_id = Db::name('admin_menu')
+            ->where(['is_del' => 0, 'menu_api' => $api_url])
+            ->value('id', 0);
+
+        if ($menu_id) {
+            //共享规则
+            $share = Db::name('role_share')
+                ->field('id,to_user,to_group')
+                ->where([
+                    'share_user' => $holder_id,
+                    'is_del' => 0,
+                    'status' => 1,
+                ])
+                ->whereFindInSet('action_collect', $menu_id)
+                ->cursor();
+
+            foreach ($share as $s) {
+                if ($s['to_user']) $data[] = [$s['to_user']];
+                elseif ($s['to_group']) {
+                    $group_user = Db::name('role_group')
+                        ->where([
+                            'id' => $s['to_group'],
+                            'is_del' => 0,
+                            'status' => 1,
+                        ])->value('group_user');
+                    $data = array_merge($data, explode(',', $group_user));
+                }
+            }
+        }
+
+        sort($data);
+        $data = array_unique($data);
+
+        return $data;
+
     }
 }

+ 9 - 6
app/youzan/logic/Goodup.php

@@ -40,7 +40,7 @@ class Goodup
                 //校验是否存在起订量为1的信息
                 if (empty($all_nake[$value['spuCode']])) {
                     $god = Db::name("good_basic")
-                        ->field('id,good_name,good_thumb_img')
+                        ->field('id,good_name,good_thumb_img,chargerid')
                         ->where(["spuCode" => $value['spuCode'], "is_del" => 0])
                         ->find();
                     if ($god) {
@@ -80,7 +80,7 @@ class Goodup
                 $ist = isset($all_list[$value['spuCode']]) ? $all_list[$value['spuCode']] : [];
                 if ($ist) {
                     $god = Db::name("good_basic")
-                        ->field('id,good_name,good_thumb_img')
+                        ->field('id,good_name,good_thumb_img,chargerid')
                         ->where(["spuCode" => $value['spuCode'], "is_del" => 0])
                         ->find();
                     if ($god) {
@@ -169,7 +169,8 @@ class Goodup
                         "order_code" => $skuCode,
                         "order_id" => $create,
                         "order_status" => $tmp['exam_status'],
-                        "before_status" => $tmp['exam_status']
+                        "before_status" => $tmp['exam_status'],
+                        'holder_id'=>$god['chargerid'],
                     ]);
                     $iso = Db::name("good")->where(["spuCode" => $value['spuCode'], "is_del" => 0])->find();
                     if ($iso == false) {
@@ -210,7 +211,7 @@ class Goodup
             $db = new PlatformYouzan();
 
             $rs = $db
-                ->field('a.id,a.platform_id,a.spuCode,a.skuCode,a.exam_status,gb.good_name,gb.weight,gb.good_img,gb.cat_id,gb.good_info_img')
+                ->field('a.id,a.platform_id,a.spuCode,a.skuCode,a.exam_status,gb.good_name,gb.weight,gb.good_img,gb.cat_id,gb.good_info_img,gb.chargerid')
                 ->alias('a')
                 ->where(['a.id' => $platform_youzan_id, 'a.is_del' => $db::$del_normal])
                 ->leftJoin('good_basic gb', 'gb.spuCode=a.spuCode')
@@ -221,7 +222,7 @@ class Goodup
 
             $old_exam_status = $rs->exam_status;
 
-            $userinfo = GetUserInfo($data['token']);
+//            $userinfo = GetUserInfo($data['token']);
 
             //platform_youzan 更新信息
             $update_data = [
@@ -363,7 +364,9 @@ class Goodup
                 "order_type" => 'YZSX',
                 "order_code" => $rs->skuCode,//咨询单详情编号
                 "order_id" => $rs->id,
-                "order_status" => $update_data['exam_status'], "before_status" => $old_exam_status
+                "order_status" => $update_data['exam_status'],
+                "before_status" => $old_exam_status,
+                'holder_id'=>$rs->chargerid,
             ]);
 
             if ($res) {

+ 1 - 1
app/youzan/logic/Order.php

@@ -61,7 +61,7 @@ class Order
                 "order_code" => $res['data']['skuCode'],
                 "order_id" => $data['id'],
                 "order_status" => $data['status'],
-                "before_status" => $res['data']['old_status']
+                "before_status" => $res['data']['old_status'],
             ]);
 
             return app_show(0, '操作成功');