Bladeren bron

Merge branch 'version1.5' of wugg/phpstock into master-online

wugg 3 jaren geleden
bovenliggende
commit
a3bd6cdbca

+ 24 - 9
app/admin/controller/Purch.php

@@ -119,6 +119,29 @@ class Purch extends Base
                 $value['wsm_supplier'] =isset($wsmcode['name']) ? $wsmcode['name']:"";
                 $value['wsm_supplierNo'] =isset($wsmcode['code']) ? $wsmcode['code']:"";
             }
+            if($value['order_type']==3|| $value['order_type']==4){
+                $goon = Db::name("good_zixun")->where(["spuCode"=>$value['spuCode'],"is_del"=>0])->find();
+                $value["speclist"]=isset($goon['specinfo'])&&$goon['specinfo']!=""? json_decode($goon['specinfo'],true):"";
+            }else {
+                $goon =Db::name('good_basic')->where(['spuCode'=>$value['spuCode']])->find();
+                $spec = Db::name("good_spec")->where(["spuCode"=>$goon['spuCode'],"is_del"=>0])->select()->toArray();
+                $speclist=[];
+                if(!empty($spec)){
+                    foreach ($spec as $val){
+                        $temp=[];
+                        $temp['id']=$val['id'];
+                        $temp['spuCode']=$val['spuCode'];
+                        $temp['spec_id']=$val['spec_id'];
+                        $temp['spec_value_id']=$val['spec_value_id'];
+                        $sp = Db::name("specs")->where(["id"=>$val['spec_id']])->find();
+                        $temp['spec_name']=isset($sp["spec_name"]) ? $sp["spec_name"]:"";
+                        $spv = Db::name("spec_value")->where(["id"=>$val['spec_value_id']])->find();
+                        $temp['spec_value']=isset($spv["spec_value"]) ? $spv["spec_value"]:"";
+                        $speclist[]=$temp;
+                    }
+                }
+                $value["speclist"]=empty($speclist)?[]:$speclist;
+            }
             $inorder= Db::name("purchease_in")->where(['cgdNo'=>$value['cgdNo'],"is_del"=>0])->select();
             $value['child']=empty($inorder)? [] : $inorder;
             $data[]=$value;
@@ -135,11 +158,6 @@ class Purch extends Base
         if(empty($data)){
             return error_show(1004,"未找到数据");
         }
-        // $var['good_code']=$value['good_code'];
-        //            $var['good_name']=$value['good_name'];
-        //            $var['return_num']=$value['return_num'];
-        //            $var['good_price']=$value['good_price'];
-        //            $var['good_total']=$value['good_ total']
         $im = Db::name('purchease_back')->where(['cgdNo'=>$data['cgdNo'],'is_del'=>0])->select();
         $var=[];
         foreach ($im as $value){
@@ -151,14 +169,11 @@ class Purch extends Base
             $value['cant']=$cat;
             $var[]=$value;
         }
-        //$var = Db::name('purchease_in')->where(['cgdNo'=>$data['cgdNo'],'is_del'=>0])->select();
         $dom = Db::name("purchease_diff")->where(['cgdNo'=>$data['cgdNo'],'is_del'=>0])->find();
-        //$goon = Db::name('good')->where(['spuCode'=>$data['spuCode']])->find();
         if($data['order_type']==3|| $data['order_type']==4){
             $goon = Db::name("good_zixun")->where(["spuCode"=>$data['spuCode'],"is_del"=>0])->find();
         }else {
-            $goon = Db::name('good_platform')->alias('a')->join('good b', 'b.spuCode=a.spuCode', 'left')
-                ->where(['a.skuCode' => $data['skuCode']])->find();
+            $goon =Db::name('good_basic')->where(['spuCode'=>$data['spuCode']])->find();
         }
         if(empty($goon)){
             return error_show(1002,"未找到商品数据");

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

@@ -94,7 +94,7 @@ public function list(){
     }
     $good_type_code=isset($this->post['good_type_code']) && $this->post['good_type_code']!==""? trim($this->post['good_type_code']):"";
     if($good_type_code !=""){
-        $where[]= ["b.good_type_code",'like',"%$good_type_code%"];
+        $where[]= ["b.spuCode",'like',"%$good_type_code%"];
     }
     $good_name=isset($this->post['good_name']) && $this->post['good_name']!==""? trim($this->post['good_name']):"";
     if($good_name !=""){

+ 11 - 2
app/admin/controller/Purchin.php

@@ -138,7 +138,7 @@ class Purchin extends BaseController
         $post_fee = isset($this->post['post_fee'])&&$this->post['post_fee']!="" ? $this->post['post_fee']:"0";
         $post_time = isset($this->post['post_time'])&&$this->post['post_time']!="" ? $this->post['post_time']:date("Y-m-d H:i:s");
         $send_num = isset($this->post['send_num'])&&$this->post['send_num']!="" ? intval($this->post['send_num']):"";
-        $status = isset($this->post['status'])&&$this->post['status']!="" ? intval($this->post['status']):"0";
+        $status = isset($this->post['status'])&&$this->post['status']!="" ? intval($this->post['status']):"1 ";
         if($send_num==''){
             return error_show(1004,"参数 send_num 不能为空或零");
         }
@@ -273,7 +273,11 @@ class Purchin extends BaseController
             return error_show(1004,"未找到数据");
         }
         $dom = Db::name("purchease_order")->where(['cgdNo'=>$info['cgdNo'],'is_del'=>0])->find();
-        $goon = Db::name('good_basic')->where(['spuCode'=>$dom['spuCode']])->field("cat_id")->find();
+        if($dom['order_type']==3|| $dom['order_type']==4){
+            $goon = Db::name("good_zixun")->where(["spuCode"=>$dom['spuCode'],"is_del"=>0])->find();
+        }else {
+            $goon =Db::name('good_basic')->where(['spuCode'=>$dom['spuCode']])->find();
+        }
         if(empty($goon)){
             return error_show(1002,"未找到商品数据");
         }
@@ -308,6 +312,11 @@ class Purchin extends BaseController
         $return['return_mobile']=isset($return['return_mobile'])&&$return['return_mobile']!="" ?$return['return_mobile']:$info['wsm_mobile'];
         $info['return']= $return;
         $info['can']=$cat;
+        if(isset($goon['companyNo'])&&$goon['companyNo']!=""){
+            $company = Db::name("business")->where(["companyNo"=>$goon['companyNo']])->find();
+        }
+        $info['company'] = isset($company['company'])?$company['company']:"";
+        $info['companyNo'] = isset($goon['companyNo'])?$goon['companyNo']:"";
         return app_show(0,'获取成功',$info);
     }
 

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

@@ -200,7 +200,7 @@ class Resign extends BaseController
         $userinfo = $data['data'];
         $bk_code=makeNo("BK");
         $info['bk_code']=$bk_code;
-        $info['status']=0;
+        $info['status']=1;
         $info['addtime']=date("Y-m-d H:i:s");
         $info['updatetime']=date("Y-m-d H:i:s");
         $info['apply_id']=$userinfo['id'];
@@ -695,7 +695,7 @@ class Resign extends BaseController
             return error_show(1004,"未找到仓库数据");
         }
         $info['wsm_code']=$wsm;
-        $info['status']=2;
+        $info['status']=1;
         $info['updatetime']=date("y-m-d H;i:s");
         $up =Db::name("purchease")->save($info);
         if($up){
@@ -807,8 +807,14 @@ class Resign extends BaseController
                             ActionLog::logAdd($this->post['token'], $order, "仓库库存", 1, $good);
                             $process=["order_code"=>$cgdCode,"order_id"=>Db::name("purchease_order")->getLastInsID(),"order_status"=>$cg['status'],"order_type"=>'CGD'];
                             ProcessOrder::AddProcess($this->post['token'],$process);
-                            Db::commit();
-                            return app_show(0, "采购单新建成功", ["cgdNo" => $cgdCode]);
+                            $info['status']=2;
+                            $info['updatetime']=date("Y-m-d H:i:s");
+                            $bas= Db::name("purchease")->save($info);
+                            if($bas){
+                                Db::commit();
+                                return app_show(0, "采购单新建成功", ["cgdNo" => $cgdCode]);
+                            }
+
                         }
                 }
             }

+ 21 - 7
app/admin/controller/Sale.php

@@ -1363,9 +1363,27 @@ class Sale extends Base
         foreach ($list as $value) {
             if($value['order_type']==3|| $value['order_type']==4){
                 $var = Db::name("good_zixun")->where(["spuCode"=>$value['good_code'],"is_del"=>0])->find();
+                $value["speclist"]=isset($var['specinfo'])&&$var['specinfo']!=""? json_decode($var['specinfo'],true):"";
             }else {
                 $var = Db::name('good_platform')->alias('a')->join('good b', 'b.spuCode=a.spuCode', 'left')
                     ->where(['a.skuCode' => $value['skuCode']])->find();
+                $spec = Db::name("good_spec")->where(["spuCode"=>$var['spuCode'],"is_del"=>0])->select()->toArray();
+                $speclist=[];
+                if(!empty($spec)){
+                    foreach ($spec as $val){
+                        $temp=[];
+                        $temp['id']=$val['id'];
+                        $temp['spuCode']=$val['spuCode'];
+                        $temp['spec_id']=$val['spec_id'];
+                        $temp['spec_value_id']=$val['spec_value_id'];
+                        $sp = Db::name("specs")->where(["id"=>$val['spec_id']])->find();
+                        $temp['spec_name']=isset($sp["spec_name"]) ? $sp["spec_name"]:"";
+                        $spv = Db::name("spec_value")->where(["id"=>$val['spec_value_id']])->find();
+                        $temp['spec_value']=isset($spv["spec_value"]) ? $spv["spec_value"]:"";
+                        $speclist[]=$temp;
+                    }
+                }
+                $value["speclist"]=empty($speclist)?[]:$speclist;
             }
 
             $value['can'] = isset($var['cat_id']) && $var['cat_id'] != 0 ? made($var['cat_id']) : [];
@@ -2468,13 +2486,9 @@ class Sale extends Base
             if ($goodinfo == false) {
                 return error_show(1002, "未找到商品数据");
             }
-
         }
         $int = isset($goodinfo['cat_id']) && $goodinfo['cat_id'] != 0 ? made($goodinfo['cat_id']) : [];
-//        $wsmcode = Db::name("warehouse_info")->alias("k")->leftJoin("supplier c", "k.supplierNo=c.code")
-//            ->where(["k.wsm_code" => $codeinfo['wsm_code']])->field("k.name as wsm_name,c.name,c.code")->find();
         $addr = Db::name("order_addr")->where(["id" => $codeinfo['addrid']])->find();
-        //$item = Db::name("sale")->where(['orderCode' => $codeinfo['orderCode']])->find();
         $codeinfo['good_name'] = isset($item['good_name']) ? $item['good_name'] : "";
         $codeinfo['good_num'] = isset($item['good_num']) ? $item['good_num'] : "";
         $codeinfo['good_code'] = isset($item['good_code']) ? $item['good_code'] : "";
@@ -2482,9 +2496,6 @@ class Sale extends Base
         $codeinfo['sale_price'] = isset($item['sale_price']) ? $item['sale_price'] : "";
         $codeinfo['total_price'] = isset($item['total_price']) ? $item['total_price'] : "";
         $codeinfo['skuCode'] = isset($item['skuCode']) ? $item['skuCode'] : "";
-//        $codeinfo['wsm_name'] = isset($wsmcode['wsm_name']) ? $wsmcode['wsm_name'] : "";
-//        $codeinfo['wsm_supplier'] = isset($wsmcode['name']) ? $wsmcode['name'] : "";
-//        $codeinfo['wsm_supplierNo'] = isset($wsmcode['code']) ? $wsmcode['code'] : "";
         $codeinfo['addr'] = GetAddr($addr['addr_code']);
         $codeinfo['addr'] .= isset($addr['addr']) ? $addr['addr'] : "";
         $codeinfo['addr_code'] = isset($addr['addr_code']) ? $addr['addr_code'] : "";
@@ -2641,6 +2652,9 @@ class Sale extends Base
         }
     }
 
+    public function outdel(){
+
+    }
 
     public function outSend(){
        $outCode=isset($this->post['outCode'])&& $this->post['outCode']!=""? trim($this->post['outCode']):"";