Просмотр исходного кода

Merge branch 'master' into yang

ANG YU 4 лет назад
Родитель
Сommit
b077162bbd

+ 0 - 1
app/Console/Commands/AccordingToOwnersManualBack.php

@@ -54,7 +54,6 @@ class AccordingToOwnersManualBack extends Command
         } catch (\Exception $e) {
             app('LogService')->log(__METHOD__, __FUNCTION__, "自动回传失败" . $last_order_manual_back_at . ' || '
                 .$now. ' || ' . json_encode($ownerCodes).' || ' . json_encode($e->getMessage()));
-            dd($e->getMessage());
         }
         $this->setOrderManualBackAt();//回传结束时间标记
     }

+ 9 - 0
app/Exceptions/Handler.php

@@ -2,11 +2,13 @@
 
 namespace App\Exceptions;
 
+use App\Log;
 use App\Services\LogService;
 use Exception;
 use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Validation\ValidationException;
+use Symfony\Component\ErrorHandler\Error\FatalError;
 use Throwable;
 
 class Handler extends ExceptionHandler
@@ -47,6 +49,13 @@ class Handler extends ExceptionHandler
     {
         $errMsg='';
         try{
+            if (substr($exception->getFile(),-(strlen("FatalError.php")))==='FatalError.php'){
+                \Illuminate\Support\Facades\Log::emergency("FPM内存耗尽",["user"=>Auth::id(),"param"=>$request->all()]);
+                return response()->view('exception.default',[
+                    'code'=> "500",
+                    'message'=>"网站负载过大,联系管理员处理",
+                ]);
+            }
             $type = $exception->type ?? 'error';
             $errMsg=(function()use($request,$exception){
                 return $errMsg=

+ 14 - 0
app/Http/Controllers/OrderController.php

@@ -368,6 +368,20 @@ sql;
         $orderNos=$request->input('ordernos');
         $failNo=array();
         $successNo=array();
+        $docOrders=OracleDOCOrderHeader::query()
+            ->whereIn('orderno',$orderNos)
+            ->get();
+        /** @var OrderService $service */
+        $service=app("OrderService");
+        foreach ($docOrders as $order){
+            if ($order->sostatus=='00' || $order->sostatus=='10' || $order->sostatus=='20'){
+                $res = $service->allocation($order->orderno,$order->warehouseid);
+                if (mb_substr($res,0,3)!='000') {
+                    array_push($failNo,$order->orderno);
+                    app('LogService')->log(__METHOD__,'手动回传分配失败'.__FUNCTION__,json_encode($order->orderno),Auth::user()['id']);
+                }
+            }
+        }
         foreach ($orderNos as $no){
             $res=$orderService->manualBack($no);
             if (!$res){

+ 14 - 5
app/Http/Controllers/ProcessController.php

@@ -28,6 +28,7 @@ use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Gate;
+use Illuminate\Support\Facades\Log;
 use Illuminate\Support\Facades\Validator;
 use Illuminate\View\View;
 use Oursdreams\Export\Export;
@@ -298,6 +299,10 @@ class ProcessController extends Controller
         //同步二次加工单统计
         $processDailiesStatistic=$processDailies->where('output','>',0);
         $processStatistic=ProcessStatistic::find($processDaily->process_id);    //如非录入渠道建单不生成统计单,报错
+        if(!$processStatistic){
+            Log::warning("二次加工统单不存在",["user"=>Auth::id(),"param"=>$processDaily->process_id]);
+            return ["processDailies"=>$processDailies];
+        }
         $processStatistic->top_capacity=$processDailiesStatistic->max('output');
         $processStatistic->bottom_capacity=$processDailiesStatistic->min('output');
         $processStatistic->average_capacity=$processDailiesStatistic->avg('output');
@@ -343,7 +348,7 @@ class ProcessController extends Controller
         $userLabor=UserLabor::find($user_id);
         $processDaily=processDaily::find($daily_id);
         if ($userLabor->isOccupiedAt($processDaily->date,$ended_at)){
-            ['status'=>"warning",'data'=>'该临时工此时间段已存在工作记录!'];
+            return ['status'=>"warning",'data'=>'该临时工此时间段已存在工作记录!'];
         };
         $processDailyParticipant=new ProcessDailyParticipant([
             'process_daily_id'=>$daily_id,
@@ -381,10 +386,14 @@ class ProcessController extends Controller
             $process->update();
             $result['process']=$processDaily->process_id;
             $processStatistic=ProcessStatistic::find($processDaily->process_id);
-            //$processStatistic->started_at=date('Y-m-d H:i:s');
-            $processStatistic->started_at=$processDaily->date.' '.$started_at;
-            $processStatistic->update();
-            app('LogService')->log(__METHOD__,"二次加工单加工中".__FUNCTION__,json_encode($process)." || ".json_encode($processStatistic),Auth::user()['id']);
+            if (!$processStatistic){
+                Log::warning("二次加工统单不存在2",["user"=>Auth::id(),"param"=>$processDaily->process_id]);
+            }else {
+                //$processStatistic->started_at=date('Y-m-d H:i:s');
+                $processStatistic->started_at=$processDaily->date.' '.$started_at;
+                $processStatistic->update();
+                app('LogService')->log(__METHOD__,"二次加工单加工中".__FUNCTION__,json_encode($process)." || ".json_encode($processStatistic),Auth::user()['id']);
+            }
         }
         $result['status']="success";
         $result['data']=$processDailyParticipant;

+ 40 - 2
app/Http/Controllers/TestController.php

@@ -33,6 +33,7 @@ use App\OrderIssue;
 use App\OrderIssueProcessLog;
 use App\OrderPackage;
 use App\Owner;
+use App\OwnerAreaReport;
 use App\OwnerFeeDetail;
 use App\OwnerFeeDetailLogistic;
 use App\OwnerFeeExpress;
@@ -60,6 +61,7 @@ use App\Services\OwnerStoreOutFeeReportService;
 use App\Services\ReviewService;
 use App\Services\StationService;
 use App\Services\StorageService;
+use App\Services\StoreService;
 use App\Station;
 use App\StationTask;
 use App\StationTaskMaterialBox;
@@ -96,6 +98,7 @@ use Laravel\Horizon\Events\JobFailed;
 use Monolog\Handler\IFTTTHandler;
 use phpDocumentor\Reflection\Types\Resource_;
 use PhpOffice\PhpSpreadsheet\Calculation\Web\Service;
+use Symfony\Component\ErrorHandler\Error\FatalError;
 
 class TestController extends Controller
 {
@@ -110,12 +113,47 @@ class TestController extends Controller
 
     public function method(Request $request, $method)
     {
-        return call_user_func([$this, $method], $request);
+        try {
+            return call_user_func([$this, $method], $request);
+        }catch (\BadMethodCallException $e){
+            dd("方法不存在");
+        }
+    }
+    public function test1()
+    {
+        try {
+            $b = DB::connection("oracle")->select("SELECT * FROM DOC_ORDER_HEADER");
+            dump(count($b));
+        }catch (\Exception $e){
+            dd($e);
+        }catch (\Error $e1){
+            dd($e1);
+        }
+        dd(round(memory_get_peak_usage() / 1024 / 1024, 2));
     }
-
 
     public function test()
     {
+        $b = [];
+        for ($i=0;$i<100000;$i++){
+            $b[] = $i;
+        }
+        dd(round(memory_get_peak_usage() / 1024 / 1024, 2));
+        $area = OwnerAreaReport::query()->find(398);
+        if (!$area->ownerStoragePriceModel)dd("error");
+        //信息提取模板
+        $GLOBALS["FEE_INFO"] = [
+            "area_id"           =>$area->id,
+            "counting_type"     =>$area->ownerStoragePriceModel->counting_type,
+            "using_type"        =>$area->ownerStoragePriceModel->using_type,
+            "fee_description"   =>"",
+            "total_fee"         =>0,
+            "tax_rate"          =>0,
+        ];
+        list($money,$taxFee) = app('OwnerStoragePriceModelService')
+            ->calculationAmount($area->ownerStoragePriceModel,$area->accounting_area,$area->owner_id,$area->counting_month);
+        dd($money,$taxFee);
+
         dd(Notification::send(User::query()->where("name","zhouzhendong")->get(),new RoutineNotification(SeeLog::query()->first()->toArray())));
         $user = Auth::user();
         $remark = "zengjunlj";

+ 1 - 0
app/Jobs/HandlePastBill.php

@@ -34,6 +34,7 @@ class HandlePastBill implements ShouldQueue
      */
     public function handle(OwnerPriceOperationService $service)
     {
+        ini_set('max_execution_time', 2500);
         list($rule,$owner,$discountIndex,$pivot) = $this->arr;
         $service->handlePastBill($rule,$owner,$discountIndex,$pivot);
     }

+ 1 - 1
app/Providers/BroadcastServiceProvider.php

@@ -14,7 +14,7 @@ class BroadcastServiceProvider extends ServiceProvider
      */
     public function boot()
     {
-        Broadcast::routes();
+        Broadcast::routes(["auth"]);
 
         require base_path('routes/channels.php');
     }

+ 3 - 1
app/Services/HandInStorageService.php

@@ -575,6 +575,7 @@ sql;
 
             // 3:flux 创建状态为创建的入库事务
             $actTransactionLog = $this->setFluxActTransactionLog($info, $lotNum, $who, $time,$asnHeader,$asnDetail);
+
             if (count($actTransactionLog) == 0){$db->rollBack();return false;}
 
             // 4:flux 新增一条上架任务记录
@@ -592,6 +593,7 @@ sql;
             return true;
         } catch (\Exception $e) {
             $db->rollBack();
+            app('LogService')->log(__METHOD__,__FUNCTION__,'收货异常'.json_encode($info).'|catch:'.$e->getMessage());
             return false;
         }
 
@@ -777,7 +779,7 @@ sql;
             $actTransactionLog['trackid'], $actTransactionLog['lotNum'], $actTransactionLog['packid'], 'EA', $info['amount'], $info['amount'],
             $info['location'], $info['location'], $actTransactionLog['trackid'], '00', 'Putaway Task', '3', $invlotatt['lotatt01'], $invlotatt['lotatt02'], $invlotatt['lotatt03'], $invlotatt['lotatt04'],
             $invlotatt['lotatt05'], $invlotatt['lotatt06'], $invlotatt['lotatt07'], $invlotatt['lotatt08'], $actTransactionLog['trid'], $who, $time, null, null, null, null,
-            $actTransactionLog['userdefine1'], $actTransactionLog['userdefine2'], $actTransactionLog['userdefine3'], $actTransactionLog['warehouseid']
+            SUBSTR($actTransactionLog['userdefine1'],1,40), $actTransactionLog['userdefine2'], $actTransactionLog['userdefine3'], $actTransactionLog['warehouseid']
         ]);
     }
 

+ 8 - 5
app/Services/OwnerStoragePriceModelService.php

@@ -117,6 +117,13 @@ class OwnerStoragePriceModelService
         ];
         $GLOBALS["FEE_INFO"]["fee_description"] .= "起租面积:".$model->minimum_area;
 
+        $days = 1;
+        switch ($model->timeUnit->name){
+            case "日":
+                $days = date('t', strtotime($month."-01"));
+                $area *= $days;
+                break;
+        }
         switch ($model->discount_type){
             case "按单减免":
                 $GLOBALS["FEE_INFO"]["fee_description"] .= ",按单减免";
@@ -148,11 +155,7 @@ class OwnerStoragePriceModelService
                 $GLOBALS["FEE_INFO"]["fee_description"] .= ",固定减免:每".$model->timeUnit->name."减免".$model->discount_value.($model->unit->name ?? 'm²');
                 if ($model->timeUnit->name == '月'){
                     $area -= $model->discount_value;
-                }else{
-                    $days = date('t', strtotime($month."-01"));
-                    $area *= $days;
-                    $area -= $days*$model->discount_value;
-                }
+                }else $area -= $days*$model->discount_value;
                 break;
         }
         $index = 0;

+ 1 - 1
laravel-echo-server.json

@@ -29,4 +29,4 @@
 		"allowMethods": "",
 		"allowHeaders": ""
 	}
-}
+}

+ 11 - 2
resources/views/layouts/notification.blade.php

@@ -137,6 +137,7 @@
             mounted(){
                 if(this.infos.length===15)this.bindListen();
                 $(document.body).append($('<audio id="audio" src="" autoplay></audio>'));
+                if (Notification.permission!=='granted')Notification.requestPermission();
                 this.initBroadcast();
             },
             methods: {
@@ -153,13 +154,21 @@
                 },
                 initBroadcast() {
                     initEcho();
-                    Echo.private('App.User.' + {{\Illuminate\Support\Facades\Auth::id()}})
+                    Echo.private('App.User.' + "{{\Illuminate\Support\Facades\Auth::id()}}")
                         .notification((notification) => {
                             this.count++;
                             this.infos.unshift(notification);
-                            if (notification.mark==0)this.playAudio(notification.mark);
+                            if (notification.mark==0)this._handleWorkOrder(notification);
                         });
                 },
+                _handleWorkOrder(notification){
+                    this.playAudio(notification.mark);
+                    if(window.Notification ) {
+                        Notification.requestPermission(function(status) {
+                            new Notification('通知面板', { body: '有新工单' });
+                        });
+                    }
+                },
                 playAudio(mark){
                     if (!audioPlay)return;
                     let audio = document.getElementById('audio');

+ 14 - 3
resources/views/order/index/delivering.blade.php

@@ -1103,10 +1103,14 @@
                                 if (order.soreference5 //存在快递单号
                                     && order.releasestatus!='H' //订单未冻结
                                     && order.manualflag=='N' //订单未回传
-                                    && (order.sostatus=='40' ||
+                                    && (order.sostatus=='00' ||
+                                        order.sostatus=='10' ||
+                                        order.sostatus=='20' ||
+                                        order.sostatus=='40' ||
                                         order.sostatus=='50' ||
                                         order.sostatus=='60' ||
-                                        order.sostatus=='61')) //订单状态为 分配完成,部分拣货,拣货完成,或播种完成
+                                        order.sostatus=='61')//订单状态为 创建订单,部分预配,预配完成,分配完成,部分拣货,拣货完成,或播种完成
+                                )
                                 {orders.push(order.orderno);}else {fail.push(order.orderno)}
                             }
                         });
@@ -1126,7 +1130,14 @@
                             if (res.data.success) {
                                 _this.orders.forEach(function (order){
                                     res.data.successNo.forEach(function (success_item){
-                                        if (order.orderno==success_item)order.manualflag='Y';
+                                        if (order.orderno==success_item){
+                                            if (order.sostatus=='00'
+                                                ||order.sostatus=='10'
+                                                ||order.sostatus=='20'){
+                                                order.ordercodename='分配完成';
+                                            }
+                                            order.manualflag='Y';
+                                        }
                                     })
                                 })
                                 res.data.failNo.forEach(function (item){

+ 2 - 0
resources/views/store/handInStorage/putaway.blade.php

@@ -330,6 +330,8 @@
                                         return;
                                     }
                                     this.tasks=[];
+                                    this.info.barCode='';
+                                    document.getElementById("barCode").focus();
                                     window.tempTip.setDuration(3000);
                                     window.tempTip.show(res.data.data);
                                     window.tempTip.showErrorAudio();

+ 1 - 0
resources/views/store/handInStorage/receiveDetailPage.blade.php

@@ -208,6 +208,7 @@
                                 this.$forceUpdate()
                             }else {
                                 this.clearInfo();
+                                document.getElementById("sku").focus();
                                 window.tempTip.setDuration(2000);
                                 window.tempTip.show(res.data.data);
                                 window.tempTip.showErrorAudio();