wugg 3 жил өмнө
parent
commit
cd146fd984

+ 18 - 0
app/admin/controller/Purch.php

@@ -58,6 +58,23 @@ class Purch extends \app\BaseController
            // $where['good_code'] = Db::raw(" like %{$good_code}%");
             $where[]=['good_code',"like", "%{$good_code}%"];
         }
+        $supplierNo = isset($this->post['supplierNo']) && $this->post['supplierNo']!="" ? trim($this->post['supplierNo'])
+            :"";
+        if($supplierNo!=""){
+            // $where['good_code'] = Db::raw(" like %{$good_code}%");
+            $where[]=['supplierNo',"=", $supplierNo];
+        }
+        $wsm_supplierNo = isset($this->post['wsm_supplierNo']) && $this->post['wsm_supplierNo']!="" ? trim($this->post['wsm_supplierNo'])
+            :"";
+        if($wsm_supplierNo!=""){
+            $supplier = Db::name("supplier")->where(["code"=>$wsm_supplierNo])->find();
+            if(empty($supplier)){
+                return error_show(1004,"未找到供应商信息");
+            }
+            $wsmcode = Db::name("warehouse_info")->where([
+                "is_del"=>0,"supplierNo"=>$supplierNo])->column("wsm_code");
+            $where[]=['wsm_code',"in", $wsmcode];
+        }
         $start = isset($this->post['start']) && $this->post['start']!="" ?$this->post['start']:"";
         if($start!=""){
            // $where['addtime'] = Db::raw(" >= '{$start}'");
@@ -93,6 +110,7 @@ class Purch extends \app\BaseController
                 $value['wsm_supplier'] =isset($wsmcode['name']) ? $wsmcode['name']:"";
                 $value['wsm_supplierNo'] =isset($wsmcode['code']) ? $wsmcode['code']:"";
             }
+            $value['child']=[];
             $data[]=$value;
         }
         return app_show(0,"获取成功",["list"=>$data,"count"=>$count]);

+ 37 - 0
app/admin/controller/Resign.php

@@ -158,6 +158,43 @@ class Resign extends BaseController
         return $in ? app_show(0,"新建成功",['bk_code'=>$bk_code]):error_show(1005,"新建失败");
     }
 
+    /**
+     * @return \think\response\Json|void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
+    public  function  copy(){
+        $id = isset($this->post['id']) ? intval($this->post['id']) : "";
+        if($id==""){
+            return error_show(1001,'id不能为空');
+        }
+        $info = Db::name("purchease")->where(["id"=>$id,"is_del"=>0])->find();
+        if(empty($info)){
+            return error_show(1002,'未找到数据');
+        }
+        $data = GetUserInfo($this->post['token']);
+        if((!empty($data) && $data['code']!=0) ||empty($data) ){
+            return error_show($data['code'],$data['message']);
+        }
+        $userinfo = $data['data'];
+        $bk_code=makeNo("BK");
+        $info['bk_code']=$bk_code;
+        $info['status']=0;
+        $info['addtime']=date("Y-m-d H:i:s");
+        $info['updatetime']=date("Y-m-d H:i:s");
+        $info['apply_id']=$userinfo['id'];
+        $info['apply_name']=$userinfo['nickname'];
+        unset($info['id']);
+        $in = Db::name("purchease")->insert($info);
+        return $in ? app_show(0,"新建成功",['bk_code'=>$bk_code]):error_show(1005,"新建失败");
+    }
+    /**
+     * @return \think\response\Json|void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
     public function info(){
         $id = isset($this->post['id']) ? intval($this->post['id']) : "";
         if($id==""){

+ 1 - 0
app/admin/route/app.php

@@ -157,6 +157,7 @@ Route::rule("getstockbet","admin/Good/GetStockBet");
 
 Route::rule("purchlist","admin/Resign/list");
 Route::rule("purchadd","admin/Resign/add");
+Route::rule("purchcopy","admin/Resign/copy");
 Route::rule("purchedit","admin/Resign/edit");
 Route::rule("purchdel","admin/Resign/delete");
 Route::rule("purchinfo","admin/Resign/info");