|
|
@@ -45,15 +45,16 @@ use App\Services\BatchService;
|
|
|
use App\Services\CacheShelfService;
|
|
|
use App\Services\ForeignHaiRoboticsService;
|
|
|
use App\Services\OrderPackageReceivedSyncService;
|
|
|
+use App\Services\OrderPackageService;
|
|
|
use App\Services\OrderService;
|
|
|
use App\Services\OwnerFeeTotalService;
|
|
|
use App\Services\OwnerLogisticFeeReportService;
|
|
|
use App\Services\OwnerPriceOperationService;
|
|
|
use App\Services\OwnerStoreFeeReportService;
|
|
|
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;
|
|
|
@@ -104,73 +105,10 @@ class TestController extends Controller
|
|
|
return call_user_func([$this, $method], $request);
|
|
|
}
|
|
|
|
|
|
- private function valFormat($val):?string
|
|
|
+ public function test()
|
|
|
{
|
|
|
- if ($val!==null){
|
|
|
- $ret = date("Y-m-d H:i:s",strtotime($val))===(string)$val;
|
|
|
- if ($ret)$val = "to_date('".$val."','yyyy-mm-dd hh24:mi:ss')";
|
|
|
- else $val = "'".$val."'";
|
|
|
- }else $val = "null";
|
|
|
- return $val;
|
|
|
- }
|
|
|
|
|
|
- public function test1($task,$amount){
|
|
|
- DB::connection("oracle")->beginTransaction();
|
|
|
- try {
|
|
|
- $columns = '';
|
|
|
- $values = '';
|
|
|
- foreach ($task as $key => $val) {
|
|
|
- if (Str::upper($key) == 'TASKID_SEQUENCE') {
|
|
|
- $taskMax = DB::connection("oracle")->selectOne(DB::raw("select MAX(TASKID_SEQUENCE) maxseq from TSK_TASKLISTS where taskid = ?"), [$task->taskid]);
|
|
|
- $val = $taskMax->maxseq + 1;
|
|
|
- }
|
|
|
- if (Str::upper($key) == 'FMQTY' || Str::upper($key) == 'FMQTY_EACH'
|
|
|
- || Str::upper($key) == 'PLANTOQTY' || Str::upper($key) == 'PLANTOQTY_EACH') {
|
|
|
- $val -= $amount;
|
|
|
- $task->$key = $amount;
|
|
|
- }
|
|
|
- $columns .= $key . ",";
|
|
|
- $values .= $this->valFormat($val) . ",";
|
|
|
- }
|
|
|
- $columns = mb_substr($columns, 0, -1);
|
|
|
- $values = mb_substr($values, 0, -1);
|
|
|
- $sql = <<<sql
|
|
|
- INSERT INTO TSK_TASKLISTS({$columns}) VALUES({$values})
|
|
|
-sql;
|
|
|
- dd($sql);
|
|
|
- } catch (\Exception $e) {
|
|
|
- dd($e);
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- public function test()
|
|
|
- {
|
|
|
- $a = "2021-09-13 00:00:00";
|
|
|
- dd(mb_substr($a,0,10));
|
|
|
- $models = app("MaterialBoxModelService")->getModelSortedByOwner(null);
|
|
|
- foreach ($models as $model){
|
|
|
- $box = app("MaterialBoxService")->getAnEmptyBox($model,[],2);
|
|
|
- dd($box);
|
|
|
- if ($box)return $box;
|
|
|
- }
|
|
|
- dd();
|
|
|
- TaskTransaction::query()->where("id",">=",280)->delete();
|
|
|
- /*$a= new StorageService();
|
|
|
- $a->clearTask(["HAIB1-01-01"]);
|
|
|
- $task = StationTaskMaterialBox::query()->find(90233);
|
|
|
- $station = Station::query()->find(11);
|
|
|
- $foreignHaiRoboticsService = new ForeignHaiRoboticsService();
|
|
|
- $foreignHaiRoboticsService->putBinToStore_fromCacheShelf($task, $station);
|
|
|
- dd(1);*/
|
|
|
- /*$batchService = new BatchService();
|
|
|
- $batches = Batch::query()->where("id",171829)->get();
|
|
|
- $batchService->assignTasks($batches);
|
|
|
- dd();*/
|
|
|
- /*TaskTransaction::query()->where("id",">=",277)->delete();
|
|
|
- StationTaskMaterialBox::query()->whereIn("id",[89685,89686,89687])->delete();
|
|
|
- app("CacheShelfService")->_stationCacheLightOff("HAIB1-01-01");//灭灯
|
|
|
- app("CacheShelfService")->_stationCacheLightOff("HAIB1-02-01");//灭灯
|
|
|
- dd(1);*/
|
|
|
Station::query()->where("station_type_id", 5)->update(["status" => 1]);
|
|
|
Cache::forget("CACHE_SHELF_AVAILABLE");
|
|
|
$station = ["HAIB1-01-01", "HAIB1-02-01"];
|
|
|
@@ -365,25 +303,26 @@ sql;
|
|
|
]);
|
|
|
}
|
|
|
|
|
|
- public function syncOrderPackage(){
|
|
|
- ini_set('memory_limit','500M');
|
|
|
+ public function syncOrderPackage()
|
|
|
+ {
|
|
|
+ ini_set('memory_limit', '500M');
|
|
|
ini_set('max_execution_time', 0);
|
|
|
$orderPackingSummary = OracleDocOrderPackingSummary::query()
|
|
|
- ->where('editTime','>=','2021-09-11 12:00:00')
|
|
|
- ->where('editTime','<=','2021-09-12 12:40:00')
|
|
|
+ ->where('editTime', '>=', '2021-09-11 12:00:00')
|
|
|
+ ->where('editTime', '<=', '2021-09-12 12:40:00')
|
|
|
->get();
|
|
|
|
|
|
$orderPackingSummary_chunk = $orderPackingSummary->chunk(200);
|
|
|
foreach ($orderPackingSummary_chunk as $orderPackingSummarys) {
|
|
|
foreach ($orderPackingSummarys as $orderPackingSummary) {
|
|
|
- $orderPackage = OrderPackage::query()->where('logistic_number',$orderPackingSummary->traceid)->first();
|
|
|
+ $orderPackage = OrderPackage::query()->where('logistic_number', $orderPackingSummary->traceid)->first();
|
|
|
$orderPackage->update([
|
|
|
- 'uploaded_to_wms'=> true,
|
|
|
- 'weight'=>$orderPackingSummary->grossweight,
|
|
|
- 'length'=>$orderPackingSummary->length,
|
|
|
- 'width'=>$orderPackingSummary->width,
|
|
|
- 'height'=>$orderPackingSummary->height,
|
|
|
- 'weighed_at'=>$orderPackingSummary->edittime
|
|
|
+ 'uploaded_to_wms' => true,
|
|
|
+ 'weight' => $orderPackingSummary->grossweight,
|
|
|
+ 'length' => $orderPackingSummary->length,
|
|
|
+ 'width' => $orderPackingSummary->width,
|
|
|
+ 'height' => $orderPackingSummary->height,
|
|
|
+ 'weighed_at' => $orderPackingSummary->edittime
|
|
|
]);
|
|
|
dispatch(new WeightUpdateInstantBill($orderPackage));
|
|
|
}
|
|
|
@@ -391,22 +330,38 @@ sql;
|
|
|
return ['success' => true];
|
|
|
}
|
|
|
|
|
|
- public function testChangeLabor()
|
|
|
+ public function collectUpload()
|
|
|
{
|
|
|
- $laborReports=LaborReport::query()
|
|
|
- ->where('created_at','like','2021-09-13%')
|
|
|
- ->where('user_workgroup_id',4)
|
|
|
- ->where('online_duration','>',13)
|
|
|
- ->get();
|
|
|
- foreach ($laborReports as $laborReport){
|
|
|
- LaborReport::query()->find($laborReport->id)
|
|
|
- ->update([
|
|
|
- 'online_duration'=>round(Carbon::parse($laborReport->check_out_at)->diffInSeconds(Carbon::parse($laborReport->check_in_at))/3600,2),
|
|
|
- 'working_duration'=>(round(Carbon::parse($laborReport->check_out_at)->diffInSeconds(Carbon::parse($laborReport->check_in_at))/3600,2)-1),
|
|
|
- ]);
|
|
|
- LaborReportStatus::query()->where('labor_report_id',$laborReport->id)
|
|
|
- ->where('status','已退场')
|
|
|
- ->update(['created_at'=>$laborReport->check_out_at]);
|
|
|
- }
|
|
|
+ /** @var OrderPackageService $service */
|
|
|
+ $service = app('OrderPackageService');
|
|
|
+ return $service->collectUpload([
|
|
|
+ '75803656098638',
|
|
|
+ '75803656098612'
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function init_在途异常()
|
|
|
+ {
|
|
|
+ $logistic_numbers = OrderPackage::query()
|
|
|
+ ->select('logistic_number')
|
|
|
+ ->where('exception_status', 5)
|
|
|
+ ->where('created_at', '>=', now()->subDays(20)->toDateTimeString())
|
|
|
+ ->pluck('logistic_number');
|
|
|
+ /** @var OrderPackageReceivedSyncService $service */
|
|
|
+ $service = app('OrderPackageReceivedSyncService');
|
|
|
+ $service->syncLogisticRoute(false, $logistic_numbers);
|
|
|
+
|
|
|
+
|
|
|
+// $logistic_numbers = OrderPackage::query()
|
|
|
+// ->select(['logistic_number', 'order_id', 'id'])
|
|
|
+// ->whereIn('order_id', function ($query) {
|
|
|
+// $query->from('orders')->selectRaw('id')->whereIn('logistic_id', function ($builder) {
|
|
|
+// $builder->from('logistics')->selectRaw('id')->where('type', '=', '快递')->whereNotIn('belong_company', ['顺丰', '中通', '韵达', '圆通', '京东']);
|
|
|
+// });
|
|
|
+// })
|
|
|
+// ->where('exception_status', 5)
|
|
|
+// ->where('created_at', '>=', now()->subDays(20)->toDateTimeString())
|
|
|
+// ->pluck('logistic_number');
|
|
|
+// $service->syncLogisticRouteByAliJiSu($logistic_numbers);
|
|
|
}
|
|
|
}
|