panlumeng 3 years ago
parent
commit
059f16ca82

+ 157 - 0
app/admin/controller/Check.php

@@ -0,0 +1,157 @@
+<?php
+
+namespace app\admin\controller;
+
+use app\BaseController;
+use think\App;
+use think\facade\Db;
+
+class Check extends BaseController
+{
+public $post = "";
+public function __construct(App $app)
+{
+    parent::__construct($app);
+    $this->post=$this->request->post();
+}
+public function list()
+{
+    $page = isset($this->post['page']) && $this->post['page'] !== "" ? intval($this->post['page']) : "1";
+    $size = isset($this->post['size']) && $this->post['size'] !== "" ? intval($this->post['size']) : "10";
+    $where = ['is_del' => 0];
+    $addtime = isset($this->post['addtime']) && $this->post['addtime'] !== "" ? intval($this->post['addtime']) : "";
+    if ($addtime !== "") {
+        $where['check_code'] = $addtime;
+    }
+    $check_code = isset($this->post['check_code']) && $this->post['check_code'] !== "" ? intval($this->post['check_code']) : "";
+    if ($check_code !== "") {
+        $where['check_code'] = $check_code;
+    }
+    $wsm_code = isset($this->post['wsm_code ']) && $this->post['wsm_code '] !== "" ? intval($this->post['wsm_code ']) : "";
+    if ($wsm_code  !== "") {
+        $where['wsm_code '] = $wsm_code;
+    }
+    $status= isset($this->post['status ']) && $this->post['status '] !== "" ? intval($this->post['status ']) : "";
+    if ($status !== "") {
+        $where['status '] = $status;
+    }
+    $count = Db::name('good_check')->count();
+    $total = ceil($count / $size);
+    $page = $page >= $total ? $page : $total;
+    $list = Db::name('good_check')->field('apply_id,apply_name,type,addtime')->where($where)->page($page,$size)->select();
+    return app_show(0,"获取成功",['count'=>$count,'list'=>$list]);
+    }
+public function goodlist(){
+    $page = isset($this->post['page']) && $this->post['page'] !=="" ? intval($this->post['page']) :"1";
+    $size = isset($this->post['size']) && $this->post['size'] !=="" ? intval($this->post['size']) :"10";
+    $where = ['is_del'=>0,'status'=>0];
+    $count = Db::name('check_item')->count();
+    $total = ceil($count / $size);
+    $page = $page >= $total ? $page : $total;
+    $list = Db::name('check_item')->where($where)->page($page,$size)->select();
+    return app_show(0,"获取成功",['count'=>$count,'list'=>$list]);
+}
+public function create(){
+    $wsm_code = isset($this->post['wsm_code ']) && $this->post['wsm_code '] !=="" ? trim($this->post['wsm_code ']):"";
+    if($wsm_code!==""){
+        return error_show(1002,"盘点仓库编号不能为空");
+    }
+    $type = isset($this->post['type']) && $this->post['type'] !=="" ? trim($this->post['type']) :"";
+    if($type==""){
+        return error_show(1002,"盘点类型不能为空");
+    }
+    $check_code = isset($this->post['check_code']) && $this->post['check_code'] !=="" ? trim($this->post['check_code']) : "";
+    $apply_id = isset($this->post['apply_id']) && $this->post['apply_id'] !=="" ? trim($this->post['apply_id']):"";
+    $apply_name = isset($this->post['apply_name']) && $this->post['apply_name'] !=="" ? trim($this->post['apply_name']):"";
+    $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status']) :"0";
+    $good_type_code = isset($this->post['good_type_code']) && $this->post['good_type_code'] !=="" ? $this->post['good_type_code']:"";
+    $good_name = isset($this->post['good_name']) && $this->post['good_name'] !=="" ? $this->post['good_name'] : "";
+    $origin_price = isset($this->post['origin_price']) && $this->post['origin_price'] !=="" ? $this->post['origin_price'] :"";
+    $origin_num = isset($this->post['origin_num']) && $this->post['origin_num'] !=="" ? $this->post['origin_num'] :"";
+    $check_num = isset($this->post['check_num']) && $this->post['check_num'] !=="" ? $this->post['check_num'] :"";
+    $diff_num = isset($this->post['diff_num']) && $this->post['diff_num'] !=="" ? $this->post['diff_num'] :"";
+    $remark = isset($this->post['remark']) && $this->post['remark'] !=="" ? $this->post['remark'] :"";
+    $check_time = isset($this->post['check_time']) && $this->post['check_time'] !=="" ? $this->post['startTime']:date("Y-m-d H:i:s");
+    Db::startTrans();
+    try{
+        $data=[
+            "check_code"=>$check_code,
+            "wsm_code"=>$wsm_code,
+            "type"=>$type,
+            "status"=>$status,
+            "apply_id"=>$apply_id,
+            "apply_name"=>$apply_name,
+            "is_del"=>0,
+            "addtime"=>date('Y-m-d H:i:s'),
+            "updatetime"=>date("Y-m-d H:i:s")
+        ];
+        $da= Db::name('good_check')->insert($data,true);
+        if($da>0){
+            $dain=[
+                "good_type_code"=>$good_type_code,
+                "good_name"=>$good_name,
+                "status"=>$status,
+               "origin_price" =>$origin_price,
+                "origin_num"=>$origin_num,
+                "check_num"=>$check_num,
+                "diff_num"=>$diff_num,
+                "remark"=>$remark,
+                "check_time"=>$check_time,
+                "is_del"=>0,
+                "addtime"=>date('Y-m-d H:i:s'),
+                "updatetime"=>date("Y-m-d H:i:s")
+            ];
+            $in= Db::name('check_item')->insert($dain);
+        }
+        if($in){
+            Db::commit();
+            return error_show(0,"盘点创建成功");
+        }else{
+            Db::rollback();
+           return error_show(1002,"创建失败");
+        }
+    }catch (\Exception $e){
+    }
+        Db::rollback();
+        return error_show(1005,$e->getMessage());
+}
+public function info(){
+    $id = isset($this->post['id']) && $this->post['id'] !=="" ? intval($this->post['id']) :"";
+    if($id==""){
+        return error_show(1002,"盘点单号不能为空");
+    }
+    $fo = Db::name('good_check')->where(['id'=>$id,'is_del'=>0])->find();
+    if(empty($fo)){
+        return error_show(1002,"未找到盘点编号");
+    }else{
+        return app_show(0,"获取成功",$fo);
+    }
+}
+public function edit(){
+    $id = isset($this->post['id']) && $this->post['id'] !=="" ? intval($this->post['id']) :"";
+    $eid = Db::name('good_check')->where(['id'=>$id,'is_del'=>0])->find();
+    if($eid==""){
+        return error_show(1002,"未找到盘点编号信息");
+    }
+    $wsm_code = isset($this->post['wsm_code']) && $this->post['wsm_code'] !=="" ? trim($this->post['wsm_code']) :"";
+    if($wsm_code==""){
+        return error_show(1002,"盘点仓库不能为空");
+    }
+    $type = isset($this->post['type']) && $this->post['type'] !=="" ? trim($this->post['type']) :"";
+    if($type==""){
+        return error_show(1002,"盘点类型不能为空");
+    }
+    $good_type_code = isset($this->post['good_type_code']) && $this->post['good_type_code'] !=="" ? trim($this->post['good_type_code']) :"";
+    if($good_type_code==""){
+        return error_show(1002,"商品属性不能为空");
+    }
+    $good_name= isset($this->post['good_name']) && $this->post['good_name'] !=="" ? trim($this->post['good_name']):"";
+    if($good_name==""){
+        return error_show(1002,"商品名称不能为空");
+    }
+    $apply_id = isset($this->post['apply_id']) && $this->post['apply_id'] !=="" ? intval($this->post['apply_id']) :"";
+    $apply_name= isset($this->post['apply_name']) && $this->post['apply_name'] !=="" ? trim($this->post['apply_name']) :"";
+    $status = isset($this->post['status']) && $this->post['status'] !=="" ? trim($this->post['status']) :"";
+
+}
+}

+ 27 - 27
app/admin/controller/Supplier.php

@@ -28,36 +28,36 @@ public function list(){
     $where = ['is_del'=>0];
     $name = isset($this->post['name']) && $this->post['name'] !== "" ? trim($this->post['name']) : "";
     if ($name !== "") {
-        $where['name'] = ["like", "%{name}%"];
+        $where['name'] = ["like", "%$name%"];
     }
     $code = isset($this->post['code']) && $this->post['code'] !== "" ? trim($this->post['code']) : "";
     if ($code !== "") {
-        $where['code'] = ["like", "%{code}%"];
-    }
-    $source = isset($this->post['source']) && $this->post['source'] !== "" ? trim($this->post['source']) : "";
-    if ($source !== "") {
-        $where['source'] = ["like", "%{source}%"];
-    }
-    $area = isset($this->post['area']) && $this->post['area'] !== "" ? trim($this->post['area']) : "";
-    if ($area !== "") {
-        $where['area'] = ["like", "%{area}%"];
-    }
-    $city = isset($this->post['city']) && $this->post['city'] !== "" ? trim($this->post['city']) : "";
-    if ($city !== "") {
-        $where['city'] = ["like", "%{city}%"];
-    }
-    $nature = isset($this->post['nature']) && $this->post['nature'] !== "" ? trim($this->post['nature']) : "";
-    if ($nature !== "") {
-        $where['nature'] = ["like", "%{nature}%"];
-    }
-    $legaler = isset($this->post['legaler']) && $this->post['legaler'] !== "" ? trim($this->post['legaler']) : "";
-    if ($legaler !== "") {
-        $where['legaler'] = ["like", "%{legaler}%"];
-    }
-    $addr = isset($this->post['addr']) && $this->post['addr'] !== "" ? trim($this->post['addr']) : "";
-    if ($addr !== "") {
-        $where['addr'] = ["like", "%{addr}%"];
-    }
+        $where['code'] = $code;
+    }
+//    $source = isset($this->post['source']) && $this->post['source'] !== "" ? trim($this->post['source']) : "";
+//    if ($source !== "") {
+//        $where['source'] = ["like", "%{source}%"];
+//    }
+//    $area = isset($this->post['area']) && $this->post['area'] !== "" ? trim($this->post['area']) : "";
+//    if ($area !== "") {
+//        $where['area'] = ["like", "%{area}%"];
+//    }
+//    $city = isset($this->post['city']) && $this->post['city'] !== "" ? trim($this->post['city']) : "";
+//    if ($city !== "") {
+//        $where['city'] = ["like", "%{city}%"];
+//    }
+//    $nature = isset($this->post['nature']) && $this->post['nature'] !== "" ? trim($this->post['nature']) : "";
+//    if ($nature !== "") {
+//        $where['nature'] = ["like", "%{nature}%"];
+//    }
+//    $legaler = isset($this->post['legaler']) && $this->post['legaler'] !== "" ? trim($this->post['legaler']) : "";
+//    if ($legaler !== "") {
+//        $where['legaler'] = ["like", "%{legaler}%"];
+//    }
+//    $addr = isset($this->post['addr']) && $this->post['addr'] !== "" ? trim($this->post['addr']) : "";
+//    if ($addr !== "") {
+//        $where['addr'] = ["like", "%{addr}%"];
+//    }
     $count = Db::name("supplier")->where($where)->count();
     $total = ceil($count/$size);
     $page = $page >= $total ? $total : $page;

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

@@ -171,7 +171,7 @@ class WareHouse extends BaseController
           return  error_show(1004,"参数id不能为空");
         };
         $warse = Db::name("warehouse_info")->alias("a")->join("warehouse_addr b ","a.wsm_code=b.wsm_code","left")
-            ->where(["a.id"=>$id,"a.is_del"=>0])->field("a.id,a.wsm_code,a.name,a.wsm_type,a.supplierNo,a.addr,a.contactor,a.mobile,a.position,a.status,a.addtime,
+            ->where(["a.id"=>$id,"a.is_del"=>0])->field("a.id,a.wsm._code,a.name,a.wsm_type,a.supplierNo,a.addr,a.contactor,a.mobile,a.position,a.status,a.addtime,
             a.updatetime,b.wsm_type,b.wsm_name,b.wsm_mobile,b.wsm_addr,b.addr_code,a.addrs_code")->find();
         if(empty($warse)){
             return error_show(1004,"未找到数据");

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

@@ -91,6 +91,12 @@ Route::rule('Consultlist','admin/Consult/list');
 Route::rule('Consultinfo','admin/Consult/info');
 Route::rule('Consultdel','admin/Consult/del');
 
+Route::rule('checklist','admin/Check/list');
+Route::rule('goodlist','admin/Check/goodlist');
+Route::rule('checkcreate','admin/Check/create');
+Route::rule('checkinfo','admin/Check/info');
+
+
 Route::rule('userlist', 'admin/User/list');
 Route::rule('userinfo', 'admin/User/userInfo');
 Route::rule('userall', 'admin/User/userAll');