Prechádzať zdrojové kódy

Merge branch 'plm' of wugg/stock into master

panlumeng 3 rokov pred
rodič
commit
871e766dd5

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

@@ -420,22 +420,32 @@ class Good extends \app\BaseController
             $where[]=['b.wsm_code',"in",$wsmcode];
         }
         $count = Db::name("good_log")->alias('a')
-            ->join("good_stock b","b.id=a.id","left")->where($where)->count();
+            ->join("good_stock b","b.id=a.id","left")->where($where)
+            ->join("good_type c","c.type_code=b.good_type_code","left")
+            ->join("good v","v.good_code=c.good_code","left")->count();
         $total = ceil($count/$size);
         $page = $total>=$page ? $page :$total;
         $list = Db::name("good_log")->alias('a')
             ->join("good_stock b","b.id=a.stock_id","left")
+            ->join("good_type c","c.type_code=b.good_type_code","left")
+            ->join("good v","v.good_code=c.good_code","left")
             ->where($where)->page($page,$size)->order("a.addtime desc")
-            ->field("a.action_name,a.type,a.stock_name,a.stock,a.action_type,a.addtime,a.action_uid,b.wsm_code")->select();
-        $data=[];
+            ->field("a.action_name,a.type,a.stock_name,a.stock,a.action_type,
+            a.addtime,a.action_uid,b.wsm_code,v.good_code,v.good_name,v.cat_id")->select();
+       $data=[];
         foreach ($list as $value){
             $db = Db::name("depart_user")->where(['uid'=>$value['action_uid']])->column("itemid");
             $item = Db::name("company_item")->where(['id'=>$db])->column("id,name");
             $wsm = Db::name("warehouse_info")->alias("a")->Join("supplier b","a.supplierNo=b.code","left")->where
             (['a.wsm_code'=>$value['wsm_code'],"a.is_del"=>0])->field("a.name as wsm_name,wsm_code,b.code,b.name")->find();
-            $value['item'] =$item;
-            $value['empty'] =$wsm;
+            $int = isset($value['cat_id']) && $value['cat_id'] != 0 ? made($value['cat_id']) : [];
+            $value['wsm_name'] =$wsm['wsm_name'];
+            $value['wsm_code'] =$wsm['wsm_code'];
+            $value['code'] =$wsm['code'];
+            $value['name'] =$wsm['name'];
             $value['action_type_cn'] =$this->acton[$value['action_type']];
+            $value['item'] =$item;
+            $value['can'] =$int;
             $data[]=$value;
         }
         return app_show(0,"获取成功",['list'=>$data,'count'=>$count]);

+ 17 - 1
app/admin/controller/Reorder.php

@@ -314,7 +314,7 @@ class Reorder extends \app\BaseController
         $del = Db::name("sale_return")->save($info);
         if($del){
             $ste = ["order_code"=>$code,"status"=>0,"action_remark"=>'',"action_type"=>"delete"];
-            ActionLog::logAdd($this->post['token'],$ste,"xsd",0,$ste);
+            ActionLog::logAdd($this->post['token'],$ste,"QRTHD",0,$ste);
             $process=["order_code"=>$code,"order_id"=>$info['id'],"order_status"=>0,"order_type"=>'QRTHD'];
             ProcessOrder::workdel($process);
             return app_show(0,"删除成功");
@@ -382,6 +382,7 @@ class Reorder extends \app\BaseController
 
         Db::startTrans();
         try{
+            $temp= $info['status'];
             $info['status'] =$status;
             $info['remark'] =$remark;
             $info["updatetime"]=date("Y-m-d H:i:s");
@@ -389,6 +390,8 @@ class Reorder extends \app\BaseController
             if($up){
                 $process=["order_code"=>$code,"order_id"=>$info['id'],"order_status"=>$status,"order_type"=>'QRTHD'];
                 ProcessOrder::AddProcess($this->post['token'],$process);
+                $ste = ["order_code"=>$code,"status"=>$temp,"action_remark"=>'',"action_type"=>"status"];
+                ActionLog::logAdd($this->post['token'],$ste,"QRTHD",$status,$info);
                 if($info['order_type']==2&&$status==4){
                     $returnCode=makeNo("TH");
                     $data = [
@@ -415,6 +418,9 @@ class Reorder extends \app\BaseController
                     if($pd>0){
                         $process=["order_code"=>$returnCode,"order_id"=>$pd,"order_status"=>1,"order_type"=>'CGTHD'];
                         ProcessOrder::AddProcess($this->post['token'],$process);
+                        $ste = ["order_code"=>$returnCode,"status"=>1,"action_remark"=>'',"action_type"=>"create"];
+                        ActionLog::logAdd($this->post['token'],$ste,"CGTHD",1,$data);
+                        $cg_status=$cgd['status'];
                         $cgd['wsend_num']=0;
                         $cgd['status']=3;
                         $cgd['send_status']=3;
@@ -423,6 +429,9 @@ class Reorder extends \app\BaseController
                         if($up){
                             $process=["order_code"=>$cgd['cgdNo'],"order_id"=>$cgd['id'],"order_status"=>1,"order_type"=>'CGD'];
                             ProcessOrder::AddProcess($this->post['token'],$process);
+                            $ste = ["order_code"=>$cgd['cgdNo'],"status"=>$cg_status,"action_remark"=>'',
+                                "action_type"=>"edit"];
+                            ActionLog::logAdd($this->post['token'],$ste,"CGD",3,$data);
                             Db::commit();
                             return app_show(0,"更新成功");
                         }else{
@@ -505,18 +514,25 @@ class Reorder extends \app\BaseController
             if($create>0) {
                 $process=["order_code"=>$returnCode,"order_id"=>$create,"order_status"=>0,"order_type"=>'QRTHD'];
                 ProcessOrder::AddProcess($this->post['token'],$process);
+                $ste = ["order_code"=>$returnCode,"status"=>0,"action_remark"=>'',
+                    "action_type"=>"create"];
+                ActionLog::logAdd($this->post['token'],$ste,"QRTHD",3,$in);
                 if ($order['send_type'] == 1) {
                     $wsend = Db::name("order_out")->where(['orderCode' => $ordeCode, "status" => 1, "order_type"
                     =>2])->select();
                        // ->save(["status" => 0, "updatetime" => date("Y-m-d H:i:s")]);
                     if(!empty($wsend)){
                         foreach ($wsend as $value){
+                            $tt = $value['status'];
                             $value['status']=0;
                             $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'];
                                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);
                            }else{
                                Db::rollback();
                                return error_show(1005,"退货单新建失败");