| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- namespace App\Http\Controllers\api\thirdPart\haiq;
- use App\Services\LogService;
- use Illuminate\Support\Facades\Http;
- use Illuminate\Support\Facades\Request;
- class StorageController
- {
- protected $request;
- public function __construct()
- {
- $stockInfo = [
- "skuCode" => "TEST-BSSKU",//商品编码 sku
- "qty" => 9,//数量
- ];
- $bin = [
- "taskCode" => "TEST-BS2010100001",//任务编号 全局唯一
- "binCode" => "TEST-BIN01",//料箱编码
- //"toWorkStation" => "TEST-HQ01",//出库工作站
- //"fromWorkStation" => "TEST-HQ01",//回库工作站
- "fromLocCode" => "HAIB1-02-01",//源库位编码
- "toLocCode" => "HAIB1-02-01",//目标库位编码 出库填多个,表示这些库位都可以支持
- "sequence" => -1,//出库顺序 -1表示没有顺序,只有移库出库时需要指定顺序,其他可为-1
- "stockInfo" => [$stockInfo],//商品信息
- ];
- $this->request = [[
- "groupCode" => 1,//组号/波次号 一组任务需要一起完成,再开始下一组任务;没有组任务的限制默认传-1或空
- "taskMode" => 3,//任务模式 值 1 (输送线入库)值 2 (输送线出库)值 3(货架到缓存货架)值4(货架到流利货架)
- "priority" => 99,//优先级 1-2147483647 1最低
- "sequenceFlag" => -1,//是否需要有序 1:需要有序 0:不需要有序
- "bins" => [$bin],//可执行货箱任务
- ]];
- }
- public function relocate(Request $request){
- $req = [[
- "groupCode"=> "test_code2",
- "priority"=> 1,
- "taskMode"=> 1,
- "bins"=> [[
- "binCode"=> "test_bin_1",
- "fromLocCode"=> "HAIB1-02-01"
- ]],
- ]];
- $response = Http::post(config('api.haiq.storage.relocate'),$req);
- if (($response["code"] ?? false) && $response["code"] != 200){
- LogService::log(__METHOD__,"haiq-料箱出库失败","REQUEST:".json_encode($this->request)." | RESPONSE:".$response);
- return ['success'=>false,"data"=>$response["errMsg"]];
- }
- if (($response["status"] ?? false) && $response["status"] == 500){
- LogService::log(__METHOD__,"haiq-料箱出库失败","REQUEST:".json_encode($this->request)." | RESPONSE:".$response);
- return ['success'=>false,"data"=>$response["msg"]];
- }
- LogService::log(__METHOD__,"haiq-料箱出库成功","REQUEST:".json_encode($this->request)." | RESPONSE:".$response);
- return ["success"=>true];
- }
- }
|