Kaynağa Gözat

Merge branch 'master' of ssh://was.baoshi56.com:10022/var/git/bswas

loustwo 4 yıl önce
ebeveyn
işleme
f0ad917bc9

+ 11 - 4
app/Http/ApiControllers/LoginController.php

@@ -4,7 +4,7 @@
 namespace App\Http\ApiControllers;
 
 
-use Illuminate\Foundation\Auth\User;
+use App\User;
 use Illuminate\Http\JsonResponse;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
@@ -40,15 +40,22 @@ class LoginController
     {
         $userName = $request->get('username','');
         $password = $request->get('password','');
-        $user = User::query()->where("name",$userName)->orWhereHas("userDetail",function ($query)use($userName){
+        $users = User::query()->where("name",$userName)->orWhereHas("userDetail",function ($query)use($userName){
             $query->where("mobile_phone",$userName);
-        })->first();
+        })->get();
         $response = [
             'message' => '请求成功',
             'status_code' => 200,
         ];
+        $user = null;
+        foreach ($users as $item){
+            if (Hash::check(base64_decode($password),$item->password)){
+                $user = $item;
+                break;
+            }
+        }
         //验证用户登录
-        if (!$user || !Hash::check(base64_decode($password),$user->password)){
+        if (!$user){
             $response["message"] = "用户名或密码错误";
             $response["status_code"] = 410;
             return response()->json($response);

+ 0 - 2
app/Http/Controllers/Auth/LoginController.php

@@ -10,8 +10,6 @@ use Illuminate\Http\RedirectResponse;
 use Illuminate\Http\Request;
 use Illuminate\Http\Response;
 use Illuminate\Support\Facades\Auth;
-use Illuminate\Support\Facades\Cache;
-use Illuminate\Support\Facades\Session;
 use Illuminate\Support\Facades\Validator;
 use Illuminate\Validation\ValidationException;
 

+ 59 - 78
app/Http/Controllers/TestController.php

@@ -2,17 +2,22 @@
 
 namespace App\Http\Controllers;
 
-use App\Batch;
 use App\Components\AsyncResponse;
 use App\Components\Database;
 use App\Components\ErrorPush;
-use App\Order;
-use App\OrderBin;
-use App\Services\WorkOrderService;
-use App\WorkOrder;
+use App\MaterialBox;
+use App\MaterialBoxModel;
+use App\Services\RejectedService;
+use App\User;
+use App\Waybill;
+use Illuminate\Database\Capsule\Manager;
+use Illuminate\Database\DatabaseManager;
+use Illuminate\Foundation\Auth\AuthenticatesUsers;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\DB;
-
+use Illuminate\Support\Facades\Hash;
+use Illuminate\Support\Facades\Log;
+use Oursdreams\Export\Export;
 
 class TestController extends Controller
 {
@@ -33,86 +38,62 @@ class TestController extends Controller
             dd("方法不存在");
         }
     }
-
-    public function assignBatch($code)
+    public function test($main, $x)
     {
-        $batches = Batch::query()->where("code",$code)->get();
-        if (!$batches->count()){
-            $wave = DB::connection("oracle")->selectOne(DB::raw("select * from DOC_WAVE_HEADER where WAVENO = ?"),[$code]);
-            if (!$wave){
-                dd("FLUX无波次");
-            }
-            $owner = app("OwnerService")->codeGetOwner($wave->customerid);
-            $obj = [
-                "wms_status" => $this->wms_status($wave),
-                "wms_type"=>$wave->descr,
-                "created_at"=>date("Y-m-d H:i:s"),
-                "wms_created_at"=>$wave->addtime,
-                "updated_at"=>$wave->edittime,
-                "owner_id"=>$owner->id,
-            ];
-            $wave = Batch::query()->where("code",$code)->first();
-            if (!$wave){
-                $obj["code"] = $code;
-                $wave = Batch::query()->create($obj);
+        return;
+        $db = DB::connection("aliyunMysql");
+        foreach ($db->select(DB::raw("select * from equipments where code like 'W4%' and info is not null and id <= 4972")) as $eq){
+            $arr = str_split ($eq->code);
+            if (strlen($main)==2){
+                $arr1 = str_split ($main);
+                $arr[4] = $arr1[0];
+                $arr[5] = $arr1[1];
             }else{
-                Batch::query()->where("code",$code)->update($obj);
+                $arr[5] = $main;
             }
-            $ordernos = array_column(DB::connection("oracle")->select(DB::raw("select orderno from DOC_WAVE_DETAILS where WAVENO = ?"),[$code]),"orderno");
-            Order::query()->whereIn("code",$ordernos)->update([
-                "batch_id"=>$wave->id
-            ]);
-            Order::query()->with(["batch","bin"])->whereIn("code",$ordernos)->get()->each(function ($order){
-                if (!$order->bin){
-                    $bin = DB::connection("oracle")->selectOne(DB::raw("select seqno from DOC_WAVE_DETAILS where waveno = ? and orderno = ?"),[$order->batch->code,$order->code]);
-                    if ($bin){
-                        OrderBin::query()->create([
-                            'order_id' => $order->id,
-                            'number' => $bin->seqno,
-                        ]);
-                    }
+            $code = implode("",$arr);
+
+            $obj = json_decode($eq->info);
+            $obj->x +=$x;
+            $db->insert("insert into equipments(code,parent_id,info,depth,width,created_at,updated_at,warehouse_detail_id)
+values(?,null,?,?,?,?,?,1)",[$code,json_encode($obj),$eq->depth,$eq->width,now()->toDateTimeString(),now()->toDateTimeString()]);
+
+            $a = $db->selectOne("select * from equipments where parent_id is null and code = ? ",[$code]);
+            foreach ($db->select("select * from equipments where parent_id = ?",[$eq->id]) as $item){
+                $arr = str_split ($item->code);
+                if (strlen($main)==2){
+                    $arr1 = str_split ($main);
+                    $arr[4] = $arr1[0];
+                    $arr[5] = $arr1[1];
+                }else{
+                    $arr[5] = $main;
                 }
-            });
-            $batches = Batch::query()->where("code",$code)->get();
+                $code = implode("",$arr);
+                $db->insert("insert into equipments(code,parent_id,info,depth,width,height,location_tab,created_at,updated_at,warehouse_detail_id)
+values(?,?,null,?,?,?,?,?,?,2)",[$code,$a->id,$item->depth,$item->width,$item->height,$item->location_tab,now()->toDateTimeString(),now()->toDateTimeString()]);
+            }
+        }
+    }
+    public function test2(){
+        return;
+        $db = DB::connection("aliyunMysql");
+        foreach ($db->select("select * from equipments where (code like 'W3%') and info is not null") as $eq){
+            $obj = json_decode($eq->info);
+            $obj->x -= 105;
+            $db->update("UPDATE equipments SET info = ? where id = ?",[json_encode($obj),$eq->id]);
         }
-        app("BatchService")->assignTasks($batches);
     }
 
-    public function syncWorkOrder(){
-
-        WorkOrder::query()
-            ->where('work_order_status','1')
-            ->where('bao_shi_tag', 1)
-            ->update(['bao_shi_tag' => 3]);
-        WorkOrder::query()
-            ->whereIn('status',[1,4] )
-            ->where('work_order_status','<>','1')
-            ->update(['bao_shi_tag' => 2]);
-
-
-        WorkOrder::query()
-            ->where('work_order_status','1')
-            ->where('owner_tag', 1)
-            ->update(['owner_tag' => 3]);
-        WorkOrder::query()
-            ->whereIn('status',[2,6] )
-            ->where('work_order_status','<>','1')
-            ->update(['bao_shi_tag' => 2]);
-
-
-        WorkOrder::query()
-            ->where('work_order_status','1')
-            ->where('logistic_tag', 1)
-            ->update(['logistic_tag' => 3]);
-        WorkOrder::query()
-            ->whereIn('status',[3] )
-            ->where('work_order_status','<>','1')
-            ->update(['logistic_tag' => 2]);
-
+    public function test1(Request $request){
+        return;
+        $x = 0;
+        $a1 = 8 + 30;
+        $a2 = 80 + 30;
+        $a3 = 32 + 30;
     }
-    public function baoHandler(){
-        $service = new WorkOrderService();
-        $service->timingTask();
+    use AuthenticatesUsers;
+    public function test3($request){
+        dd(Hash::make("wangyan"));
     }
 }
 

+ 4 - 4
config/database.php

@@ -89,9 +89,9 @@ return [
             'url' => env('DATABASE_URL'),
             'host' => 'rm-uf6f5v208b07hp198bo.mysql.rds.aliyuncs.com',
             'port' => '3306',
-            'database' => env('DB_DATABASE', 'forge'),
-            'username' => env('DB_USERNAME', 'forge'),
-            'password' => 'wasBaoshi56!',
+            'database' => 'swms',
+            'username' => 'swms',
+            'password' => 'baoshiSWMS123!',
             'unix_socket' => env('DB_SOCKET', ''),
             'charset' => 'utf8mb4',
             'collation' => 'utf8mb4_unicode_ci',
@@ -100,7 +100,7 @@ return [
             'strict' => false,
             'engine' => null,
             'options' => extension_loaded('pdo_mysql') ? array_filter([
-                PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
+                \PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
             ]) : [],
         ],
 

+ 26 - 16
resources/views/equipment/index.blade.php

@@ -255,6 +255,7 @@
     var vue = new Vue({
         el:"#container",
         data:{
+            increment:true,
             group:[],//库区列表
             ws:[],//仓库列表
             locationMapping:{},//库位的信息映射
@@ -283,11 +284,13 @@
             equipments:[                                                //备选设备池
                 {id:1,w:1.2,h:2.4,grid:2,layer:4,color:"RGB(252,228,214)",describe:"4层高位货架,可设八个标准托盘位"},
                 {id:2,w:1.2,h:2.4,grid:2,layer:5,color:"RGB(255,255,255)",describe:"5层高位货架,可设十个标准托盘位"},
-                {id:3,w:1.2,h:2.4,grid:1,layer:3,color:"RGB(169,208,142)",describe:"叉车通道,可设三个标准托盘位"},
-                {id:4,w:1.2,h:2.4,grid:2,layer:3,color:"RGB(221,235,247)",describe:"叉车通道,可设六个标准托盘位"},
+                {id:3,w:1.2,h:3.3,grid:3,layer:1,color:"RGB(169,208,142)",describe:"叉车通道,可设三个标准托盘位"},
+                {id:4,w:1.2,h:3.3,grid:3,layer:2,color:"RGB(221,235,247)",describe:"叉车通道,可设六个标准托盘位"},
                 {id:5,w:1.2,h:1.2,grid:1,layer:4,color:"RGB(255,255,0)",describe:"半组货架,可设四层高四个标准托盘位"},
-                {id:6,w:1.2,h:1.2,grid:2,layer:1,color:"RGB(189,215,238)",describe:"叉车通道,顶上两个托盘位"},
+                {id:6,w:1.2,h:2.4,grid:2,layer:1,color:"RGB(189,215,238)",describe:"叉车通道,顶上两个托盘位"},
                 {id:7,w:1.2,h:1.2,grid:1,layer:5,color:"RGB(255,255,5)",describe:"半组货架,可设五层高五个标准托盘位"},
+                {id:8,w:1.2,h:3.3,grid:3,layer:4,color:"RGB(146,208,80)",describe:"4层高位货架,可设十二个标准托盘位"},
+                {id:9,w:1.2,h:2.4,grid:2,layer:2,color:"RGB(228,243,211)",describe:"叉车通道,可设四个标准托盘位"},
             ],
             currentEq:{                                                 //选中的设备
                 el:null,
@@ -340,15 +343,17 @@
                 }
                 if(key===86  && e.ctrlKey){
                     let val = $('#clipboardDiv').val();
-                    if (!val)return;
+                    if (!val || JSON.stringify(val)==="{}")return;
                     let toolWid = document.getElementById("tool").offsetWidth;
-                    let obj = JSON.parse(val);
+                    let obj = Object.assign({},JSON.parse(val));
                     obj.x = this.client.x-toolWid+content.scrollLeft;
                     obj.y = this.client.y+content.scrollTop;
                     obj.children = [];
                     for (let i=0;i<obj.layer;i++)obj.children.push({});
                     if (this.currentEl.eqId){
                         obj.eqId = undefined;
+                        this.current = obj;
+                        this.currentEl = obj;
                         this.showAddModal(obj);
                     }else{
                         this.elements.push(obj);
@@ -425,9 +430,17 @@
                     let size = result.val.toString().length;
                     let val;
                     if(result.type==="CHAR"){
-                        val=this.charArr[result.val+index];
+                        if (this.increment){
+                            val=this.charArr[result.val+index];
+                        }else{
+                            val=this.charArr[result.val-index];
+                        }
                     }else{
-                        val=Number(result.val)+index;
+                        if (this.increment){
+                            val=Number(result.val)+index;
+                        }else{
+                            val=Number(result.val)-index;
+                        }
                         if (val.toString().length<size){
                             val = (Array(size).join('0') + val).slice(-size);
                         }
@@ -482,7 +495,9 @@
                 })
             },
             copyEle(){
-                $('#clipboardDiv').text(JSON.stringify(this.currentEl));
+                if (this.currentEl!=null && JSON.stringify(this.currentEl)!=="{}"){
+                    $('#clipboardDiv').text(JSON.stringify(this.currentEl));
+                }
             },
             delEquipment(){
                 this.equipmentElements.some((el,index)=>{
@@ -511,7 +526,7 @@
                     }else if (equipment.updateCoords){
                         equipments.push({
                             id:equipment.eqId,
-                            info:JSON.stringify({x:equipment.x,y:equipment.y,id:equipment.id})
+                            info:JSON.stringify({x:equipment.x,y:equipment.y,id:equipment.id,turn:equipment.turn})
                         });
                     }
                 });
@@ -616,15 +631,10 @@
                     let children = [];
                     for (let i=0;i<this.currentEq.obj.layer;i++)children.push({});
                     let newEquipment = Object.assign({children:children,x:x,y:y}, this.currentEq.obj);
-                    if (this.turn){
-                        let wid = newEquipment.w;
-                        newEquipment.w = newEquipment.h;
-                        newEquipment.h = wid;
-                        newEquipment.turn = this.turn;
-                        this.showAddModal(newEquipment);
-                    }
+                    newEquipment.turn = this.turn;
                     newEquipment.width = newEquipment.w;
                     newEquipment.depth = newEquipment.h;
+                    this.showAddModal(newEquipment);
                 }
                 this.currentEq.obj = null;
             },