Ver código fonte

Merge remote-tracking branch 'origin/master'

loustwo 4 anos atrás
pai
commit
837c6ee019

+ 0 - 3
app/Console/Commands/SyncWMSOrderTask.php

@@ -9,7 +9,6 @@ use App\ValueStore;
 use Carbon\Carbon;
 use Illuminate\Console\Command;
 use Illuminate\Support\Facades\Cache;
-use Illuminate\Support\Facades\Log;
 
 class SyncWMSOrderTask extends Command
 {
@@ -62,13 +61,11 @@ class SyncWMSOrderTask extends Command
         $start = (string)$start;
         Cache::put($this->last_start_key,$start);
         ValueStore::query()->where('name',$this->last_start_key)->update(['value'=>$start]);
-        Log::info("订单同步开始时间",['date' => $start]);
         $this->syncCreatedOrder();
         $this->syncUpdatedOrder();
         $end = (string)Carbon::now();
         Cache::put($this->last_end_key,$end);
         ValueStore::query()->where('name',$this->last_end_key)->update(['value'=>$end]);
-        Log::info("订单同步结束时间",['date' => $end]);
     }
 
     public function syncCreatedOrder()

+ 1 - 1
app/Http/Controllers/StorageController.php

@@ -287,7 +287,7 @@ SQL;
                     $modelMap[$model->id] = $model->commodity->maximum;
                 }
                 $orderBy.= " END";
-                $boxes = MaterialBox::query()->whereIn("code",$codes)->orderByRaw($orderBy)->lockForUpdate()->get();
+                $boxes = MaterialBox::query()->whereIn("code",$codes)->orderByRaw($orderBy)->get();
                 //筛选下海柔可用箱
                 list($codes,$notCodes) = app("MaterialBoxService")->checkHaiQ(array_column($boxes->toArray(),"code"));
                 if (!$codes)$boxes = new \Illuminate\Database\Eloquent\Collection();

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

@@ -179,22 +179,41 @@ class TestController extends Controller
     public function test1(\Closure $c,string $a){
         dd($c($a));
     }
-    public function test(Request $request)
+    private function paramDefault(&$waybill):array
     {
-        foreach (Batch::query()->where("created_at",">=","2021-12-18 00:00:00")->get() as $bat){
-            $this->assignBatch($bat->code);
+        $update = [];
+        if (!$waybill->order_type){
+            $update["order_type"] = $waybill->order_type = Waybill::ORDER_TYPE_DEFAULT;
         }
-        dd("OK");
-        $user = User::query()->where("name","yanyuanmin")->first();
-        dd($user->id);
-        dd($codes = app('OwnerService')->getQuery($user->id)->select("code")->pluck("code"));
-
-
-        $ownerIds=app('UserService')->getPermittingOwnerIds($user);
-        $owners =  Owner::query()->select("id","name","code")->whereIn('id', $ownerIds)->whereNull('deleted_at')->get();
-        $codes = array_column($owners->toArray(), 'code');
-        dd($codes);
-        dd(Order::class);
+        if (!$waybill->transport_type){
+            $update["transport_type"] = $waybill->transport_type = "JZKH";
+        }
+        if (!$waybill->cargo_name){
+            $update["cargo_name"] = $waybill->cargo_name = "补货";
+        }
+        if (!$waybill->total_number){
+            $update["total_number"] = $waybill->total_number = 1;
+        }
+        if (!$waybill->total_weight){
+            $update["total_weight"] = $waybill->total_weight = 1;
+        }
+        if (!$waybill->package_service){
+            $update["package_service"] = $waybill->package_service = '托膜';
+        }
+        if (!$waybill->deliveryType){
+            $update["deliveryType_id"] = $waybill->deliveryType_id = 3;
+        }
+        if (!$waybill->pay_type){
+            $update["pay_type"] = $waybill->pay_type = Waybill::PAY_TYPE_DEFAULT;
+        }
+        if (!$waybill->back_sign_bill){
+            $update["back_sign_bill"] = $waybill->back_sign_bill = Waybill::BACK_SIGN_BILL_DEFAULT;
+        }
+        return $update;
+    }
+    public function test(Request $request)
+    {
+        dd(1);
         $c = "test";
         $a = function ($b)use($c){
             return $b.$c;
@@ -239,31 +258,6 @@ class TestController extends Controller
         $service->syncWorkOrder($rejected_bill);
     }
 
-    public function changeWorkOrder(){
-        $type = OrderIssueType::query()->where('name' ,'拦截')->first();
-
-        WorkOrder::query()->where('order_issue_type_id',$type->id)
-            ->where('status',[4,5])
-            ->where('process_progress','拦截成功')
-            ->update(['process_progress' => '成功已退回,不赔偿']);
-
-        WorkOrder::query()->where('order_issue_type_id',$type->id)
-            ->whereIn('status',[4,5])
-            ->where('process_progress','拦截失败')
-            ->update(['process_progress' => '无法拦截']);
-
-
-        WorkOrderDetail::query()->where('order_issue_type_id',$type->id)
-            ->where('status',[4,5])
-            ->where('process_progress','拦截成功')
-            ->update(['process_progress' => '成功已退回,不赔偿']);
-
-        WorkOrderDetail::query()->where('order_issue_type_id',$type->id)
-            ->whereIn('status',[4,5])
-            ->where('process_progress','拦截失败')
-            ->update(['process_progress' => '无法拦截']);
-    }
-
 
     public function assignBatch($code)
     {
@@ -309,45 +303,6 @@ class TestController extends Controller
         app("BatchService")->assignTasks($batches);
     }
 
-    public function inventory()
-    {
-        $location='B15-01-01';
-        $taskId=950;
-        $barcode='Fxdsc';
-        $start=microtime(true);
-//        $inventoryAccountMission=InventoryAccountMission::with(['commodity.barcodes','stockInventoryPersons'])
-//            ->whereHas('commodity',function($query)use($barcode){
-//            $query->whereHas('barcodes',function($sql)use($barcode){
-//                $sql->where('code','=',$barcode);
-//            });
-//        })->where('location',$location)->where('inventory_account_id',$taskId)->first();
-//
-
-//        $inventoryAccountMission=InventoryAccountMission::with(['commodity.barcodes','stockInventoryPersons'])
-//            ->whereIn('commodity_id',function($query)use($barcode){
-//                $query->from('commodity_barcodes')->select('commodity_id')->where('code',$barcode);
-//            })->where('location',$location)
-//            ->where('inventory_account_id',$taskId)
-//            ->where('checked','否')
-//            ->first();
-        $stock_status=InventoryAccount::query()->where('id',$taskId)->value('status');
-        $end=microtime(true);
-        dump(round($end-$start,3),$stock_status);
-    }
-
-    public function testZC()
-    {
-//        $batches=Batch::query()->where('id',1)->get();
-//        BroadcastBatchToZhengCangJob::dispatch($batches);    //在这里为波次注册队列任务!
-        $taskId=792;
-        $location='H05-35-04';
-        $barcode='6931481255587';
-        /** @var AndroidInventoryService $service */
-        $service=app('AndroidInventoryService');
-        $inventoryAccountMission=$service->getInventoryDetail($taskId,$location,$barcode);
-        dd($inventoryAccountMission->stockInventoryPersons);
-    }
-
 
 
 }

+ 0 - 1
app/Jobs/LaborApplyRecordJob.php

@@ -38,7 +38,6 @@ class LaborApplyRecordJob implements ShouldQueue
      */
     public function handle()
     {
-        Log::debug("LaborApplyRecordJob isAppend = " . ($this->isAppend + 1) . "");
         $response = $this->service->allocationLaborToLaborCompany($this->isAppend);
         if (!$response['success']) throw new WarningException($response['error_message']);
     }

+ 9 - 7
app/Observers/WaybillObserver.php

@@ -24,17 +24,19 @@ class WaybillObserver
                 return;
             }
             $update = $this->paramDefault($waybill);
+            $waybill->update($update);
             $bill = app('DbOpenService')->getDbOrderNo($waybill);
             if (!$bill || $bill["result"]=="false"){
-                Log::error("德邦单号获取失败",["no"=>$waybill->waybill_number,"info"=>$bill]);
+                Log::error("德邦单号获取失败",["no"=>$waybill->toArray(),"info"=>$bill]);
                 return;
             }
-            $update["carrier_bill"] = $bill['mailNo'];
-            $update["waybill_number"] = $bill['mailNo'];
-            $update["station_no"] = $bill['stationNo'];
-            $update["arrived_org_simple_name"] = $bill['arrivedOrgSimpleName'];
-            $update["much_higher_delivery"] = $bill['muchHigherDelivery'];
-            $waybill->update($update);
+            $waybill->update([
+                "carrier_bill"=>$bill['mailNo'],
+                "waybill_number"=>$bill['mailNo'],
+                "station_no"=>$bill['stationNo'],
+                "arrived_org_simple_name"=>$bill['arrivedOrgSimpleName'],
+                "much_higher_delivery"=>$bill['muchHigherDelivery'],
+            ]);
             if (!app("WaybillService")->notifyFlux($waybill)){
                 Log::error("德邦单号回传FLUX失败",["no"=>$waybill->waybill_number,"info"=>$bill]);
                 return;

+ 0 - 1
app/Services/DbOpenService.php

@@ -5,7 +5,6 @@ namespace App\Services;
 use App\Components\ErrorPush;
 use App\Traits\ServiceAppAop;
 use Illuminate\Database\Eloquent\Model;
-use Illuminate\Support\Facades\Log;
 
 
 class DbOpenService

+ 1 - 1
app/Services/OwnerAreaReportService.php

@@ -60,7 +60,7 @@ class OwnerAreaReportService
         $area = $this->query(OwnerAreaReport::query(),$params)->with("ownerStoragePriceModel")->lockForUpdate()->first();
         try{
             if ($values["accounting_area"] ?? null && $area->accounting_area != $values["accounting_area"]){
-                $report = OwnerBillReport::query()->lockForUpdate()->where("owner_id",$area->owner_id)
+                $report = OwnerBillReport::query()->where("owner_id",$area->owner_id)
                     ->where("counting_month",'like',$area->counting_month."%")->first();
                 if ($report){
                     if (!$area->ownerStoragePriceModel)return false;

+ 1 - 1
app/Services/OwnerPriceOperationService.php

@@ -259,7 +259,7 @@ class OwnerPriceOperationService
             DB::beginTransaction();
             //此处暂时未使用cache的互斥锁 使用sql行锁代替下 防止缓存击穿
             $pivot = app(CacheService::class)->getOrExecute($key,function ()use($key,$targetValue,&$sign,$rule,$owner){
-                return DB::selectOne(DB::raw("SELECT * FROM owner_price_operation_owner WHERE owner_price_operation_id = ? AND owner_id = ? for update"),[$rule->id,$owner]);
+                return DB::selectOne(DB::raw("SELECT * FROM owner_price_operation_owner WHERE owner_price_operation_id = ? AND owner_id = ? "),[$rule->id,$owner]);
             },1000);
             if ($pivot && (!$pivot->discount_date || substr($pivot->discount_date,0,7)!=$month || $pivot->target_value < $targetValue)){
                 //未被标记过处理时间或处理时间不为本月,或上次处理值过期,处理历史即时账单