StorageController.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace App\Http\Controllers\api\thirdPart\haiq;
  3. use App\Services\LogService;
  4. use Illuminate\Support\Facades\Http;
  5. use Illuminate\Support\Facades\Request;
  6. class StorageController
  7. {
  8. public function out(Request $request){
  9. $bin = [
  10. "taskCode" => "TEST-BS2010100001",//任务编号
  11. "binCode" => "TEST-BIN01",//料箱编码
  12. "sequence" => -1,//出库顺序 -1表示没有顺序,只有移库出库时需要指定顺序,其他可为-1
  13. "fromLocCode" => "TEST-J04-058-3",//源库位编码
  14. "toLocCode" => "TEST-J24-128-7",//目标库位编码 出库填多个,表示这些库位都可以支持
  15. ];
  16. $req = [[
  17. "groupCode" => 1,//组号/波次号 决定了出库的顺序,越大优先级越高
  18. "priority" => 99,//优先级 1-100 1最低
  19. "taskMode" => 1,//任务模式 1(拣货出库) 2(入库指定料箱出库) 3(盘点出库) 4(移库出库) 5(入库不指定料箱出库)
  20. "emptyBinQty" => -1,//需求空料箱数量 taskMode 为 3 时必填, 其他时候可以传-1
  21. "toWorkStations" => ["TEST-HQ01","TEST-HQ02",],//出库工作站 不指定具体一个,指定多个
  22. "bins" => [$bin],//可执行货箱任务
  23. ]];
  24. $response = Http::post(config('api.haiq.storage.out'),$req);
  25. return $response;
  26. if ($response["code"] != 200){
  27. LogService::log(__METHOD__,"haiq-料箱出库失败","REQUEST:".json_encode($req)." | RESPONSE:".$response);
  28. return ['success'=>false,"data"=>$response["errMsg"]];
  29. }
  30. LogService::log(__METHOD__,"haiq-料箱出库成功","REQUEST:".json_encode($req)." | RESPONSE:".$response);
  31. return ["success"=>true];
  32. }
  33. public function in(Request $request){
  34. $stockInfo = [
  35. "skuCode" => "TEST-BSSKU",//商品编码 sku
  36. "qty" => 9,//数量
  37. ];
  38. $req = [[
  39. "taskCode" => "TEST-BSSTIN2010100001",//任务编号
  40. "taskMode" => 1,//任务类型 1(出库回库) 2(入库回库) 3(盘点回库) 4(移库回库)
  41. "binCode" => "TEST-BIN01",//料箱编号
  42. "fromWorkStation" => "TEST-HQ01",//回库工作站
  43. "fromLocCode" => "TEST-JH-0025",//源库位编码
  44. "toLocCode" => "TEST-JH-001",//目标库位编码
  45. "isEmpty" => 1,//料箱是否为空 0(为空) 1(不为空)
  46. "stockInfo" => [$stockInfo],//商品信息
  47. ]];
  48. $response = Http::post(config('api.haiq.storage.in'),$req);
  49. return $response;
  50. if ($response["code"] != 200){
  51. LogService::log(__METHOD__,"haiq-料箱回库失败","REQUEST:".json_encode($req)." | RESPONSE:".$response);
  52. return ['success'=>false,'data'=>$response["errMsg"]];
  53. }
  54. LogService::log(__METHOD__,"haiq-料箱回库成功","REQUEST:".json_encode($req)." | RESPONSE:".$response);
  55. return ["success"=>true];
  56. }
  57. }