소스 검색

运输管理--手动刷新仓库计重

haozi 5 년 전
부모
커밋
38e43c5d2f

+ 3 - 0
app/Http/Controllers/PersonnelController.php

@@ -44,6 +44,9 @@ class PersonnelController extends Controller
         if ($userDutyCheckImport&&$userDutyCheck->type=='登入')return ['result'=>true,'data'=>'已存在进场记录!'];
         $userDutyCheckExport=UserDutyCheck::where('user_id',$user_id)->where('checked_at','like',$checkedAtDate.'%')->where('type','登出')->orderBy('id','desc')->first();
         if ($userDutyCheckExport&&$userDutyCheck->type=='登出')return ['result'=>true,'data'=>'已存在出场记录!'];
+//        $userDutyCheckBefore=UserDutyCheck::where('user_id',$user_id)->orderBy('id','desc')->first();
+//        if ($userDutyCheckBefore['type']=='登入'&&$userDutyCheck->type=='登入')return ['result'=>true,'data'=>'已存在进场记录!'];
+//        if ($userDutyCheckBefore['type']=='登出'&&$userDutyCheck->type=='登出')return ['result'=>true,'data'=>'已存在出场记录!'];
         if ($type=='登出')$userDutyCheck->verify_user_id=Auth::user()['id'];
         $userDutyCheck->save();
         $this->log(__METHOD__,"录入补卡".__FUNCTION__,json_encode($userDutyCheck),Auth::user()['id']);

+ 10 - 4
app/Http/Controllers/UserDutyCheckController.php

@@ -108,12 +108,12 @@ class UserDutyCheckController extends Controller
             'checked_at' => $date,
             'source' => '正常',
         ]);
+        //跨天登出情况
         if (!$userDutyCheckOld) {
-            //跨天登出情况
+            //当前日期的前一天
+            $yesterday = Carbon::yesterday()->format('Y-m-d');
+            $userDutyCheckYesterday = UserDutyCheck::where('user_id', $user_id)->where('checked_at', 'like', $yesterday . '%')->orderBy('id', 'desc')->limit(10)->first();
             if ($importAndExportQRCodeType && $importAndExportQRCodeType == 'export') {
-                //当前日期的前一天
-                $yesterday = Carbon::yesterday()->format('Y-m-d');
-                $userDutyCheckYesterday = UserDutyCheck::where('user_id', $user_id)->where('checked_at', 'like', $yesterday . '%')->orderBy('id', 'desc')->limit(10)->first();
                 if ($userDutyCheckYesterday && $userDutyCheckYesterday->type == '登入') {
                     $userDutyCheck->verify_user_id = $userDutyCheckYesterday->verify_user_id;
                     $userDutyCheck->type = '登出';
@@ -121,6 +121,12 @@ class UserDutyCheckController extends Controller
                     return $userDutyCheck;
                 }
             }
+            if ($importAndExportQRCodeType && $importAndExportQRCodeType == 'import') {
+                if ($userDutyCheckYesterday && $userDutyCheckYesterday->type == '登入') {
+                    $userDutyCheck->import = true;//已入场的不能再入场
+                    return $userDutyCheck;
+                }
+            }
             if ($importAndExportQRCodeType == 'export') {
                 $userDutyCheck->isNotImport = true;//还未进场,不可出场
                 return $userDutyCheck;

+ 23 - 2
app/Http/Controllers/WaybillController.php

@@ -96,7 +96,7 @@ class WaybillController extends Controller
     }
 
     public function update(Request $request, $id,WaybillPriceModelService $waybillPriceModelService,
-                        CarrierService $carrierService,WaybillPayoffService $waybillPayoffService)
+                           CarrierService $carrierService,WaybillPayoffService $waybillPayoffService)
     {
         if(!Gate::allows('运输管理-调度')){ return redirect(url('/'));  }
         if (!$request->warehouse_weight && $request->warehouse_weight_unit_id){
@@ -803,7 +803,6 @@ class WaybillController extends Controller
 
     // 软删除恢复
     public function apiRestoreSelected(Request $request){
-        DB::enableQueryLog();
         if(!Gate::allows('运输管理-删除')){return ['success'=>'false','fail_info'=>'没有权限'];}
         $ids = $request->input('ids')??'';
         if($ids == ''){return ['success'=>'false','fail_info'=>'没有可恢复对象'];}
@@ -856,5 +855,27 @@ class WaybillController extends Controller
         $result = WaybillOnTop::where('waybill_id',$id)->forceDelete();
         return ['success'=>$result,'status'=>$result];
     }
+    //同步刷新仓库计重
+    public function refreshWaveHouseWeight(Request $request){
+        $wms_bill_number=$request->input('wms_bill_number');
+        if(is_null($wms_bill_number)) return  ['success'=>false,'fail_info'=>'传参错误'];
+        $waybills=DB::connection('oracle')->table('DOC_ORDER_DETAILS')->where('orderno',$wms_bill_number)->get();
+        if($waybills->isEmpty()) return  ['success'=>false,'fail_info'=>'传参错误'];
+        $warehouseWeight=0;
+        foreach ($waybills as $waybill){
+            if ($waybill->grossweight) $warehouseWeight += $waybill->grossweight;
+            if (!$waybill->grossweight&& $waybill->netweight) $warehouseWeight +=$waybill->netweight;
+        }
+        $warehouseWeight=round($warehouseWeight,2);
+        if ($warehouseWeight!=0){
+            $waybill=Waybill::where('wms_bill_number',$wms_bill_number)->first();
+            if ($waybill['warehouse_weight_other']!=$warehouseWeight){
+                $waybill['warehouse_weight_other']=$warehouseWeight;
+                $waybill->update();
+                $this->log(__METHOD__,'刷新仓库计重'.__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
+            }
+        }
+        return ['success'=>true,'warehouseWeight'=>$warehouseWeight];
+    }
 
 }

+ 9 - 9
app/Http/Controllers/api/thirdPart/flux/WaybillController.php

@@ -39,14 +39,14 @@ class WaybillController extends Controller
                     ->setEncodingOptions(JSON_UNESCAPED_UNICODE);
             }
             if(isset($receiveInputting['order_list'])&&$receiveInputting['order_list']){
+                $warehouseVolume=0;
                 $warehouseWeight=0;
-                $warehouseWeightOther=0;
                 $sign=false;
                 foreach ($receiveInputting['order_list'] as $orderInputting){
-                    if ($orderInputting['Cubic'])$warehouseWeight += $orderInputting['Cubic'];
+                    if ($orderInputting['Cubic'])$warehouseVolume += $orderInputting['Cubic'];
                     if ($orderInputting['Cubic']==0)$sign=true;
-                    if ($orderInputting['GrossWeight'])$warehouseWeightOther +=$orderInputting['GrossWeight'];
-                    if (!$orderInputting['GrossWeight'] && $orderInputting['NetWeight']) $warehouseWeightOther +=$orderInputting['NetWeight'];
+                    if ($orderInputting['GrossWeight'])$warehouseWeight +=$orderInputting['GrossWeight'];
+                    if (!$orderInputting['GrossWeight'] && $orderInputting['NetWeight']) $warehouseWeight +=$orderInputting['NetWeight'];
                     $orderInputting['OrderNo']=$receiveInputting['OrderNo'];
                     if(!WMSWaybillOrder::create($orderInputting)){
                         Controller::logS(__METHOD__,'error_'.__FUNCTION__,'运单订单行WMS写入错误'.'|'.json_encode($orderInputting));
@@ -55,7 +55,7 @@ class WaybillController extends Controller
                             ->setEncodingOptions(JSON_UNESCAPED_UNICODE);
                     }
                 }
-                if ($sign)$warehouseWeight=0;
+                if ($sign)$warehouseVolume=0;
             }
             $owner=Owner::where('code',$receiveInputting['CustomerID'])->first();
             if (!$owner){$owner=new Owner(['name'=>$receiveInputting['CustomerID'],'code'=>$receiveInputting['CustomerID']]);$owner->save();}
@@ -84,13 +84,13 @@ class WaybillController extends Controller
             ]);
             $dflist=config('merchantsInfo.waybill.DFList');
             if (isset($dflist[$receiveInputting['CarrierID']]) && $dflist[$receiveInputting['CarrierID']])$waybill->collect_fee=0;
-            if (isset($warehouseWeight)&&$warehouseWeight){
-                $waybill->warehouse_weight=$warehouseWeight;
+            if (isset($warehouseVolume)&&$warehouseVolume){
+                $waybill->warehouse_weight=$warehouseVolume;
                 $unit=Unit::where('name','m³')->first();
                 if ($unit)$waybill->warehouse_weight_unit_id=$unit->id;
             }
-            if (isset($warehouseWeightOther)){
-                $waybill->warehouse_weight_other=$warehouseWeightOther;
+            if (isset($warehouseWeight)){
+                $waybill->warehouse_weight_other=$warehouseWeight;
                 $unit=Unit::where('name','kg')->first();
                 if ($unit)$waybill->warehouse_weight_unit_id_other=$unit->id;
             }

+ 8 - 8
app/Services/LaborReportService.php

@@ -137,14 +137,14 @@ class LaborReportService
     public function changeGroupAndMakeLaborReport($user_id,$userWorkgroupID){
         $laborReportBefore=LaborReport::where('user_id',$user_id)->orderby('id','desc')->first();
         if ($laborReportBefore&&$laborReportBefore['status']!='已退场')$userDutyCheck=$laborReportBefore->userDutyCheck;
-//        if ($laborReportBefore&&!$laborReportBefore['group_user_id']){
-//            if ($laborReportBefore['user_workgroup_id']!=$userWorkgroupID){
-//                $laborReportBefore['user_workgroup_id']=$userWorkgroupID;
-//                $laborReportBefore['check_in_at']=Carbon::now()->format('Y-m-d H:i:s');
-//                $laborReportBefore->update();
-//                return $laborReportBefore;
-//            }
-//        }
+        if ($laborReportBefore&&!$laborReportBefore['group_user_id']){
+            if ($laborReportBefore['user_workgroup_id']!=$userWorkgroupID){
+                $laborReportBefore['user_workgroup_id']=$userWorkgroupID;
+                $laborReportBefore['check_in_at']=Carbon::now()->format('Y-m-d H:i:s');
+                $laborReportBefore->update();
+                return $laborReportBefore;
+            }
+        }
         $userDetail=UserDetail::find($user_id);
         $name=$userDetail['full_name'];
         $mobile_phone=$userDetail['mobile_phone'];

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 308 - 579
public/js/app.js


+ 1 - 1
resources/views/order/index/delivering.blade.php

@@ -128,7 +128,7 @@
                                     <td><div style="width: 180px;overflow: hidden">@{{ oracleDOCOrderDetail.checktime }}</div></td>
                                 </tr>
                                 <tr v-if="isBtn[order.orderno]">
-                                    <td colspan="5">
+                                    <td colspan="6">
                                         <b style="cursor:pointer;color: #4aa0e6;" @click="isBtn[order.orderno]=false;">点击收起明细</b>
                                     </td>
                                 </tr>

+ 40 - 1
resources/views/waybill/index.blade.php

@@ -181,7 +181,16 @@
                             <span v-if="waybill.carType">@{{ waybill.carType.name }}<i v-if="waybill.carType.length">(@{{waybill.carType.length}}米)</i></span></span></td>
                     <td class="td-cool"><span v-if="waybill.warehouse_weight">@{{waybill.warehouse_weight|filterZero}}  @{{waybill.warehouse_weight_unit}}</span></td>
                     <td class="td-cool"><span v-if="waybill.carrier_weight">@{{waybill.carrier_weight|filterZero}}  @{{waybill.carrier_weight_unit}}</span></td>
-                    <td class="td-cool"><span v-if="waybill.warehouse_weight_other">@{{waybill.warehouse_weight_other|filterZero}}  @{{waybill.warehouse_weight_unit_other}}</span></td>
+                    <td class="td-cool" style="position: relative" @mouseenter="btnRefreshWeightZoomOut(waybill)" @mouseleave="btnRefreshWeightZoomIn(waybill)">
+                        <span v-if="waybill.warehouse_weight_other&&waybill.btn_refresh_weight=='zoomIn'"> @{{waybill.warehouse_weight_other}}  @{{waybill.warehouse_weight_unit_other}}</span>
+                        <button type="button" class="btn btn-sm btn-outline-info" @click="refreshWaveHouseWeight(waybill.wms_bill_number)"
+                                :style="[
+                                {position:waybill.btn_refresh_weight&&waybill.btn_refresh_weight=='zoomIn'?'absolute':'static'},
+                                {transform:waybill.btn_refresh_weight&&waybill.btn_refresh_weight=='zoomIn'?'scale(0.55)':'scale(1)'},
+                                {right:waybill.btn_refresh_weight&&waybill.btn_refresh_weight=='zoomIn'?'-10px':'auto'},
+                                {bottom:waybill.btn_refresh_weight&&waybill.btn_refresh_weight=='zoomIn'?'-6px':'auto'},
+                                ]">刷新</button>
+                    </td>
                     <td class="td-cool"><span v-if="waybill.carrier_weight_other">@{{waybill.carrier_weight_other|filterZero}}  @{{waybill.carrier_weight_unit_other}}</span></td>
                     <td class="td-cool"><span v-if="waybill.amount">@{{waybill.amount}} @{{waybill.amount_unit_name }}</span></td>
                     <td class="td-cool">@{{waybill.mileage|km}} </td>
@@ -389,6 +398,7 @@
                         pick_up_fee:'{{$waybill->pick_up_fee}}',other_fee:'{{$waybill->other_fee}}',
                         collect_fee:'{{$waybill->collect_fee}}', @endcan deliver_at:'{{$waybill->deliver_at}}',dispatch_remark:'{{$waybill->dispatch_remark}}',isBtn:false,
                         waybillAuditLogs:{!! $waybill->waybillAuditLogs !!},
+                        btn_refresh_weight:'zoomIn',
                         @if($waybill->remark)remark:'{{$waybill->remark}}', @else remark:'', @endif
                     },
                     @endforeach
@@ -470,6 +480,12 @@
                 this.form.init();
             },
             methods:{
+                btnRefreshWeightZoomIn(waybill){
+                    waybill.btn_refresh_weight='zoomIn'
+                },
+                btnRefreshWeightZoomOut(waybill){
+                    waybill.btn_refresh_weight='zoomOut'
+                },
                 lazy(){
                     //可视区域高度
                     let height=window.innerHeight;
@@ -912,6 +928,29 @@
                     let tip = target.parent().find('.toptd');
                     top.show();
                     tip.tooltip('hide');
+                },
+                refreshWaveHouseWeight(wms_bill_number) {
+                    let _this=this;
+                    let url='{{url('waybill/refreshWaveHouseWeight')}}';
+                    axios.post(url,{'wms_bill_number':wms_bill_number}).then(function (response) {
+                        if(response.data.success){
+                            _this.waybills.every(function (waybill) {
+                                if (waybill.wms_bill_number==wms_bill_number){
+                                    waybill.warehouse_weight_other=response.data.warehouseWeight;
+                                    return false;
+                                }
+                                return true;
+                            });
+                            tempTip.setDuration(3000);
+                            tempTip.showSuccess('刷新计重成功');
+                        }else{
+                            tempTip.setDuration(3000);
+                            tempTip.show('刷新计重失败!'+response.data.fail_info);
+                        }
+                    }).catch(function (err) {
+                        tempTip.setDuration(3000);
+                        tempTip.show('刷新计重失败,网络连接错误!'+err);
+                    });
                 }
             },
             filters:{

+ 2 - 0
routes/web.php

@@ -81,6 +81,8 @@ Route::get('waybill/recycle', 'WaybillController@recycle');   //回收站
 Route::any('waybill/ontop/top','WaybillController@waybillOnTop');
 Route::any('waybill/ontop/cancel','WaybillController@cancelOnTop');
 
+Route::post('waybill/refreshWaveHouseWeight','WaybillController@refreshWaveHouseWeight');
+
 Route::get('waybill/index','WaybillController@index');
 Route::get('waybill/delivering','WaybillController@delivering');
 Route::post('waybill/storeCarrierBill','WaybillController@storeCarrierBill');

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.