| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- <?php
- namespace App\Http\Controllers;
- use App\Authority;
- use App\Commodity;
- use App\CommodityMaterialBoxModel;
- use App\Components\AsyncResponse;
- use App\Components\ErrorPush;
- use App\ErrorTemp;
- use App\Feature;
- use App\Http\ApiControllers\LoginController;
- use App\Http\Requests\OrderDelivering;
- use App\Jobs\CacheShelfTaskJob;
- use App\Jobs\OrderCreateInstantBill;
- use App\Jobs\OrderCreateWaybill;
- use App\Jobs\SettlementBillReportTask;
- use App\Jobs\StoreCreateInstantBill;
- use App\Jobs\WeightUpdateInstantBill;
- use App\MaterialBox;
- use App\MaterialBoxModel;
- use App\Order;
- use App\OrderPackage;
- use App\Owner;
- use App\OwnerFeeDetail;
- use App\OwnerFeeDetailLogistic;
- use App\OwnerFeeExpress;
- use App\OwnerFeeLogistic;
- use App\OwnerFeeOperation;
- use App\OwnerFeeOperationDetail;
- use App\OwnerFeeStorage;
- use App\OwnerPriceOperation;
- use App\OrderPackageCountingRecord;
- use App\RejectedBill;
- use App\Services\CacheShelfService;
- use App\Services\ForeignHaiRoboticsService;
- use App\Services\OrderPackageReceivedSyncService;
- 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\StationService;
- use App\Services\StorageService;
- use App\Station;
- use App\StationTask;
- use App\StationTaskMaterialBox;
- use App\Store;
- use App\TaskTransaction;
- use App\Unit;
- use App\User;
- use App\UserDetail;
- use App\UserDutyCheck;
- use App\ValueStore;
- use App\Waybill;
- use Carbon\Carbon;
- use Carbon\CarbonPeriod;
- use Firebase\JWT\JWT;
- use Illuminate\Database\Eloquent\Collection;
- use Illuminate\Foundation\Http\FormRequest;
- use Illuminate\Http\Request;
- use Illuminate\Support\Facades\Cache;
- use Illuminate\Support\Facades\Auth;
- use Illuminate\Support\Facades\Cookie;
- use Illuminate\Support\Facades\DB;
- use Illuminate\Support\Facades\Http;
- use Illuminate\Support\Facades\URL;
- use Illuminate\Support\Facades\Validator;
- use Laravel\Horizon\Events\JobFailed;
- use PhpOffice\PhpSpreadsheet\Calculation\Web\Service;
- class TestController extends Controller
- {
- use AsyncResponse, ErrorPush;
- const ASNREFERENCE_2 = 'ASNREFERENCE2';
- public function __construct()
- {
- $this->data["active_test"] = "active";
- }
- public function method(Request $request, $method)
- {
- return call_user_func([$this, $method], $request);
- }
- public function test2(){
- /* Station::query()
- ->where("id",11)->update(["status"=>0]);
- $a = new CacheShelfService();
- $a->_stationCacheLightOff("HAIB1-01-01");
- dd(1);*/
- StationTaskMaterialBox::query()->get();
- $task1 = StationTaskMaterialBox::query()->find(85010);
- $foreignHaiRoboticsService = new ForeignHaiRoboticsService();
- $toLocation = collect(["HAIB1-01-01"]);
- $taskMaterialBoxes = collect([$task1]);
- $foreignHaiRoboticsService->
- fetchGroup_multiLocation($toLocation, $taskMaterialBoxes, '', '立架出至缓存架',20);
- foreach ($toLocation as $value){
- app("CacheShelfService")->lightUp($value,'3','0',["title"=>"机器人取箱中,禁止操作"]);
- Cache::forever("CACHE_SHELF_OCCUPANCY_11",true);
- }
- app("StationService")->locationOccupyMulti($toLocation->toArray());
- dd("OK");
- }
- public function test()
- {
- $code1 = "IDE0000224";
- $code2 = "IDE0000176";
- Station::query()->where("station_type_id",5)->whereNotNull("parent_id")
- ->where("id","!=",11)->update(["status"=>1]);
- Cache::forget("CACHE_SHELF_AVAILABLE");
- Cache::forget("CACHE_SHELF_MAPPING");
- $dateTime = date("Y-m-d H:i:s");
- $materialBox1 = MaterialBox::query()->where("code",$code1)->first();
- $materialBox2 = MaterialBox::query()->where("code",$code2)->first();
- $task1 = StationTaskMaterialBox::query()->create([
- 'station_id'=>11,
- 'material_box_id'=>$materialBox1->id,
- 'station_task_batch_id'=>1,
- 'status'=>'待处理'
- ]);
- $task2=StationTaskMaterialBox::query()->create([
- 'station_id'=>6,
- 'material_box_id'=>$materialBox2->id,
- 'station_task_batch_id'=>1,
- 'status'=>'待处理'
- ]);
- TaskTransaction::query()->insert([[
- "doc_code" => "test",
- "bar_code" => "test",
- "to_station_id" => 11,
- "material_box_id" => $materialBox1->id,
- "task_id" => $task1->id,
- "commodity_id" => 505012,//XUNI03
- "amount" => 1,
- "type" => "出库",
- "status" => 0,
- "mark" => 2,
- "bin_number"=>1,
- "created_at"=>$dateTime,
- "updated_at"=>$dateTime,
- ],[
- "doc_code" => "test",
- "bar_code" => "test",
- "to_station_id" => 6,
- "material_box_id" => $materialBox2->id,
- "task_id" => $task2->id,
- "commodity_id" => 505012,//XUNI03
- "amount" => 1,
- "type" => "出库",
- "status" => 3,
- "mark" => 2,
- "bin_number"=>1,
- "created_at"=>$dateTime,
- "updated_at"=>$dateTime,
- ]]);
- $foreignHaiRoboticsService = new ForeignHaiRoboticsService();
- $toLocation = collect(["HAIB1-01-01"]);
- $taskMaterialBoxes = collect([$task1]);
- $foreignHaiRoboticsService->
- fetchGroup_multiLocation($toLocation, $taskMaterialBoxes, '', '立架出至缓存架',20);
- foreach ($toLocation as $value){
- app("CacheShelfService")->lightUp($value,'3','0',["title"=>"机器人取箱中,禁止操作"]);
- Cache::forever("CACHE_SHELF_OCCUPANCY_11",true);
- }
- app("StationService")->locationOccupyMulti($toLocation->toArray());
- }
- public function _stationCacheLightOff($locCode)
- {
- if (!$locCode) return null;
- $params = [
- "areaCode" => "1004",
- 'locCode' => $locCode,
- 'PTLAction' => 0,
- ];
- $response = Http::post(config('api.haiq.storage.light'), $params);
- return json_decode($response->body());
- }
- }
|