| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?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" => "TEST-J04-058-3",//源库位编码
- "toLocCode" => "TEST-J24-128-7",//目标库位编码 出库填多个,表示这些库位都可以支持
- "sequence" => -1,//出库顺序 -1表示没有顺序,只有移库出库时需要指定顺序,其他可为-1
- "stockInfo" => [$stockInfo],//商品信息
- ];
- $this->request = [[
- "groupCode" => 1,//组号/波次号 一组任务需要一起完成,再开始下一组任务;没有组任务的限制默认传-1或空
- "taskMode" => 1,//任务模式 值 1 (输送线入库)值 2 (输送线出库)值 3(货架到缓存货架)值4(货架到流利货架)
- "priority" => 99,//优先级 1-2147483647 1最低
- "sequenceFlag" => -1,//是否需要有序 1:需要有序 0:不需要有序
- "bins" => [$bin],//可执行货箱任务
- ]];
- }
- public function out(Request $request){
- $bin = [
- "taskCode" => "TEST-BS2010100001",//任务编号
- "binCode" => "TEST-BIN01",//料箱编码
- "sequence" => -1,//出库顺序 -1表示没有顺序,只有移库出库时需要指定顺序,其他可为-1
- "fromLocCode" => "TEST-J04-058-3",//源库位编码
- "toLocCode" => "TEST-J24-128-7",//目标库位编码 出库填多个,表示这些库位都可以支持
- ];
- $req = [[
- "groupCode" => 1,//组号/波次号 决定了出库的顺序,越大优先级越高
- "priority" => 99,//优先级 1-100 1最低
- "taskMode" => 1,//任务模式 1(拣货出库) 2(入库指定料箱出库) 3(盘点出库) 4(移库出库) 5(入库不指定料箱出库)
- "emptyBinQty" => -1,//需求空料箱数量 taskMode 为 3 时必填, 其他时候可以传-1
- "toWorkStations" => ["TEST-HQ01","TEST-HQ02",],//出库工作站 不指定具体一个,指定多个
- "bins" => [$bin],//可执行货箱任务
- ]];
- $response = Http::post(config('api.haiq.storage.out'),$this->request);
- return $response;
- if ($response["code"] != 200){
- LogService::log(__METHOD__,"haiq-料箱出库失败","REQUEST:".json_encode($req)." | RESPONSE:".$response);
- return ['success'=>false,"data"=>$response["errMsg"]];
- }
- LogService::log(__METHOD__,"haiq-料箱出库成功","REQUEST:".json_encode($req)." | RESPONSE:".$response);
- return ["success"=>true];
- }
- public function in(Request $request){
- $stockInfo = [
- "skuCode" => "TEST-BSSKU",//商品编码 sku
- "qty" => 9,//数量
- ];
- $req = [[
- "taskCode" => "TEST-BSSTIN2010100001",//任务编号
- "taskMode" => 1,//任务类型 1(出库回库) 2(入库回库) 3(盘点回库) 4(移库回库)
- "binCode" => "TEST-BIN01",//料箱编号
- "fromWorkStation" => "TEST-HQ01",//回库工作站
- "fromLocCode" => "TEST-JH-0025",//源库位编码
- "toLocCode" => "TEST-JH-001",//目标库位编码
- "isEmpty" => 1,//料箱是否为空 0(为空) 1(不为空)
- "stockInfo" => [$stockInfo],//商品信息
- ]];
- $response = Http::post(config('api.haiq.storage.in'),$this->request);
- return $response;
- if ($response["code"] != 200){
- LogService::log(__METHOD__,"haiq-料箱回库失败","REQUEST:".json_encode($req)." | RESPONSE:".$response);
- return ['success'=>false,'data'=>$response["errMsg"]];
- }
- LogService::log(__METHOD__,"haiq-料箱回库成功","REQUEST:".json_encode($req)." | RESPONSE:".$response);
- return ["success"=>true];
- }
- }
|