Forráskód Böngészése

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

LD 4 éve
szülő
commit
09191dda3f

+ 12 - 5
app/Http/Controllers/Auth/PasswordController.php

@@ -2,9 +2,10 @@
 
 namespace App\Http\Controllers\Auth;
 
+use App\Components\AsyncResponse;
 use App\Http\Controllers\Controller;
+use App\User;
 use Illuminate\Auth\Events\PasswordReset;
-use Illuminate\Foundation\Auth\ResetsPasswords;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Hash;
@@ -12,7 +13,7 @@ use Illuminate\Support\Str;
 
 class PasswordController extends Controller
 {
-
+    use AsyncResponse;
 
     /**
      * Where to redirect users after resetting their password.
@@ -34,16 +35,22 @@ class PasswordController extends Controller
     {
         return view('auth.passwords.change');
     }
-    public function update(Request $request)
+    public function update(/*Request $request*/)
     {
+        /** @var User|\stdClass $user */
         $user=Auth::user();
-        $request->validate($this->rules(), $this->validationErrorMessages());
+        if (!$user)$this->error("登录过期,请重新登录");
+        if (!Hash::check(\request("old"),$user->password))$this->error("旧密码输入有误");
+        if (Hash::check(\request("pwd"),$user->password))$this->error("新密码不得与旧密码相同");
+        $user->update(["password" => Hash::make(\request("pwd"))]);
+        $this->success();
+        /*$request->validate($this->rules(), $this->validationErrorMessages());
         $user->password = Hash::make($request->input('password'));
         $user->setRememberToken(Str::random(60));
         $user->save();
         event(new PasswordReset($user));
         Auth::guard()->login($user);
-        return view('auth.passwords.changed');
+        return view('auth.passwords.changed');*/
     }
     protected function rules()
     {

+ 77 - 1
app/Services/StorageService.php

@@ -350,7 +350,11 @@ sql;
     }
 
 
-
+    /**
+     * 获取事务现号
+     *
+     * @return string
+     */
     private function getTrNumber()
     {
         $val = ValueStore::query()->select("value")->where("name","flux_tr_number")->first();
@@ -360,8 +364,80 @@ sql;
         return 'W'.$number;
     }
 
+    /**
+     * 设置事务现号
+     */
     private function setTrNumber()
     {
         ValueStore::query()->select("value")->where("name","flux_tr_number")->update(["value"=>DB::raw("flux_tr_number+1")]);
     }
+
+    /**
+     * 入库
+     *
+     * @param integer $boxId
+     * @param integer $amount
+     * @param integer $commodityId
+     *
+     * @return bool
+     */
+    public function warehousing($boxId, $amount, $commodityId = null):bool
+    {
+        DB::beginTransaction();
+        try{
+            $storage = Storage::query()->where("material_box_id",$boxId)->lockForUpdate()->first();
+            if (!$storage && !$commodityId)return false;
+            if (!$storage){
+                Storage::query()->create([
+                    "station_id" => null,
+                    "material_box_id" => $boxId,
+                    "commodity_id" => $commodityId,
+                    "amount" => $amount,
+                ]);
+                return true;
+            }
+            if ($commodityId && $storage->commodity_id && $storage->commodity_id!=$commodityId)return false;
+            $obj = [
+                "station_id" => null,
+                "amount" => DB::raw("amount + {$amount}"),
+            ];
+            if (!$storage->commodity_id && $commodityId)$obj["commodity_id"] = $commodityId;
+            $storage->update($obj);
+            DB::commit();
+            return true;
+        }catch (\Exception $e){
+            DB::rollBack();
+            return false;
+        }
+    }
+
+    /**
+     * 出库
+     *
+     * @param integer $boxId
+     * @param integer $amount
+     * @param integer $commodityId
+     *
+     * @return bool
+     */
+    public function outWarehousing($boxId, $amount, $commodityId = null):bool
+    {
+        DB::beginTransaction();
+        try{
+            $storage = Storage::query()->where("material_box_id",$boxId)->lockForUpdate()->first();
+            if (!$storage)return false;
+            if ($commodityId && $storage->commodity_id && $storage->commodity_id!=$commodityId)return false;
+            $obj = [
+                "station_id" => null,
+                "amount" => DB::raw("amount - {$amount}"),
+            ];
+            if (!$storage->commodity_id && $commodityId)$obj["commodity_id"] = $commodityId;
+            $storage->update($obj);
+            DB::commit();
+            return true;
+        }catch (\Exception $e){
+            DB::rollBack();
+            return false;
+        }
+    }
 }

+ 28 - 0
resources/views/layouts/app.blade.php

@@ -97,6 +97,34 @@
             location.reload();
         }
     });
+    function resetPwd(){
+        let old = document.getElementById("old_password").value;
+        let pwd = document.getElementById("password").value;
+        let pwdConfirmation = document.getElementById("password-confirm").value;
+        window.tempTip.setDuration("3000");
+        window.tempTip.setIndex(1099);
+        if (!old || !pwd || !pwdConfirmation){
+            window.tempTip.show("密码不得为空");
+            return;
+        }
+        if (old.length<6 || pwd.length<6 || pwdConfirmation.length<6){
+            window.tempTip.show("密码最低为6位");
+            return;
+        }
+        if (old === pwd){
+            window.tempTip.show("新密码不得与旧密码相同");
+            return;
+        }
+        if (pwd !== pwdConfirmation){
+            window.tempTip.show("新密码与确认密码不同");
+            return;
+        }
+        window.tempTip.postBasicRequest("{{url('password/update')}}",{old:old,pwd:pwd,pwdConfirmation:pwdConfirmation},()=>{
+            $("#resetPwd").modal('hide');
+            return "密码已成功修改";
+        },true)
+
+    }
 </script>
 @component('demand._createjs')@endcomponent
 @yield('lastScript')

+ 37 - 1
resources/views/layouts/menu.blade.php

@@ -92,7 +92,7 @@
                 </a>
 
                 <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
-                    <a class="dropdown-item" href="{{ url('password/change') }}">修改密码</a>
+                    <a class="dropdown-item" {{--href="{{ url('password/change') }}"--}} data-toggle="modal" data-target="#resetPwd">修改密码</a>
                     <a class="dropdown-item" href="{{ route('logout') }}"
                        onclick="event.preventDefault();
                                                      document.getElementById('logout-form').submit();">登出
@@ -105,4 +105,40 @@
             </li>
         @endguest
     </ul>
+    <div class="modal fade" id="resetPwd">
+        <div class="modal-dialog modal-dialog-centered">
+            <div class="modal-content">
+                <div class="modal-header">
+                    <button type="button" class="close" data-dismiss="modal">&times;</button>
+                </div>
+                <div class="modal-body">
+                    <div class="form-group row">
+                        <label for="old_password" class="col-md-4 col-form-label text-md-right">旧密码</label>
+
+                        <div class="col-md-6">
+                            <input id="old_password" type="password" class="form-control">
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="password" class="col-md-4 col-form-label text-md-right">输入新密码</label>
+
+                        <div class="col-md-6">
+                            <input type="password"  id="password" class="form-control"/>
+                        </div>
+                    </div>
+
+                    <div class="form-group row">
+                        <label for="password-confirm" class="col-md-4 col-form-label text-md-right">重输密码</label>
+
+                        <div class="col-md-6">
+                            <input id="password-confirm" type="password" class="form-control" autocomplete="new-password">
+                        </div>
+                    </div>
+                </div>
+                <div class="modal-footer">
+                    <button type="button" class="btn btn-success" onclick="resetPwd()">确认修改</button>
+                </div>
+            </div>
+        </div>
+    </div>
 </div>

+ 1 - 0
resources/views/store/checkingReceive/mission.blade.php

@@ -138,6 +138,7 @@
                     name: "checkingReceiveMission",
                     column: column,
                     data: this.storeCheckingReceives,
+                    isCheckAllBox:false,
                     fixedTop:($('#form_div').height())+2,
                 }).init();
             },

+ 1 - 2
resources/views/store/deliveryAppointment/list.blade.php

@@ -74,6 +74,7 @@
                 <td>@{{ i+1 }}</td>
                 <td>
                     <span v-if="info.status==0">
+                        @can("入库管理-入库预约-预约管理-签到")<button class="btn btn-sm btn-outline-success" @click="signIn(i,0)" v-if="info.status==0 && info.cars[0].status==0">签到</button>@endcan<br>
                         <button type="button" @click="cancel(info.id,i)" class="btn btn-sm btn-outline-danger">取消预约</button><br>
                         <button type="button" @click="updateDeliveryDate(info,i)" class="btn btn-sm btn-outline-primary">修改预约</button>
                     </span>
@@ -116,7 +117,6 @@
                             <div class="col-2 text-secondary">@{{ info.cars[0].driver_phone }}</div>
                             <div class="col-3">
                                 @can("入库管理-入库预约-预约管理-卸货完成")<button class="btn btn-sm btn-outline-success" @click="unloading(i,0)" v-if="info.cars[0].status==1">卸货完成</button>@endcan
-                                @can("入库管理-入库预约-预约管理-签到")<button class="btn btn-sm btn-outline-success" @click="signIn(i,0)" v-if="info.status==0 && info.cars[0].status==0">签到</button>@endcan
                                 <div v-if="info.cars[0].status==2">@{{ info.cars[0].delivery_time }}</div>
                             </div>
                         </div>
@@ -129,7 +129,6 @@
                                 <div class="col-2 text-secondary">@{{ car.driver_phone }}</div>
                                 <div class="col-3">
                                     @can("入库管理-入库预约-预约管理-卸货完成")<button class="btn btn-sm btn-outline-success" @click="unloading(i,j)" v-if="car.status==1">卸货完成</button>@endcan
-                                    @can("入库管理-入库预约-预约管理-签到")<button class="btn btn-sm btn-outline-success" @click="signIn(i,j)" v-if="info.status==0 && car.status==0">签到</button>@endcan
                                     <div v-if="car.status==2">@{{ car.delivery_time }}</div>
                                 </div>
                             </div>

+ 47 - 3
resources/views/store/inStorage/halfChestStorage.blade.php

@@ -10,8 +10,9 @@
         <div class="row">
             <div class="card offset-md-3 col-md-6 col-sm-12">
                 <div class="card-body">
-                    <div class="form-group text-center font-weight-bold h4">
-                        入库信息
+                    <div class="form-group text-center">
+                        <span class="font-weight-bold h4">入库信息</span>
+                        <a class="small" href="#" @click="openModal()">溢出减量</a>
                     </div>
                     <div class="form-group row">
                         <label for="asn" class="col-sm-2 col-3 text-right">ASN号:</label>
@@ -48,6 +49,29 @@
                     </div>
                 </div>
             </div>
+            <div class="modal fade" tabindex="-1" role="dialog" id="modal">
+                <div class="modal-dialog modal-lg modal-dialog-centered modal-dialog-scrollable">
+                    <div class="modal-content">
+                        <div class="modal-header">
+                            <div class="font-weight-bold h4">溢出减量</div>
+                            <button type="button" class="close" data-dismiss="modal">&times;</button>
+                        </div>
+                        <div class="modal-body">
+                            <div class="form-group">
+                                <label for="location">库位码</label>
+                                <input id="location" type="text" v-model="ov.station" class="form-control" placeholder="库位码">
+                            </div>
+                            <div class="form-group">
+                                <label for="ov_amount">溢出数量</label>
+                                <input id="ov_amount" type="number" v-model="ov.amount" min="1" step="1" class="form-control" placeholder="溢出数量">
+                            </div>
+                        </div>
+                        <div class="modal-footer">
+                            <button type="button" class="btn btn-success" @click="overflowRevision()">提交</button>
+                        </div>
+                    </div>
+                </div>
+            </div>
         </div>
     </div>
 @stop
@@ -58,7 +82,7 @@
             el:"#container",
             data:{
                 permissionList:[ //允许聚焦许可列表
-                    "asn","station","amount"
+                    "asn","station","amount","location","ov_amount"
                 ],
                 info:{},
                 mount:false,
@@ -66,6 +90,7 @@
                     asn:"",
                 },
                 errors:{},
+                ov:{},//溢出减量数值
             },
             mounted(){
                 this.codeFocus();
@@ -73,6 +98,25 @@
                 this.createBefore();
             },
             methods:{
+                //提交溢出减量
+                overflowRevision(){
+                    if (!this.ov.station || !this.ov.amount){
+                        window.tempTip.show("信息不完整");
+                        return;
+                    }
+                    window.tempTip.postBasicRequest("{{url('store/inStorage/overflowRevision')}}",this.ov,()=>{
+                        $("#modal").modal('hide');
+                        this.ov = {};
+                        return "溢出减量成功!";
+                    });
+                },
+                //打开溢出减量模态框
+                openModal(){
+                    $("#modal").modal("show");
+                    setTimeout(function () {
+                        document.getElementById("location").focus();
+                    },500);
+                },
                 //聚焦 白名单
                 codeFocus(){
                     if (!this.permissionList.includes(document.activeElement.id)) document.getElementById("barCode").focus();

+ 1 - 0
routes/web.php

@@ -420,6 +420,7 @@ Route::group(['prefix'=>'store'],function(){
         Route::post('resetCacheShelf','StorageController@resetCacheShelf');
         Route::post('setMaximum','StorageController@setMaximum');
         Route::post('checkMaximum','StorageController@checkMaximum');
+        Route::post('overflowRevision','StorageController@overflowRevision');
     });
     Route::group(['prefix'=>'fast'],function() {
         Route::resource('storeItem','StoreItemController');