php-wms-client/src/WmsStrategy.php

62 lines
1.7 KiB
PHP
Raw Normal View History

2020-03-19 09:05:29 +00:00
<?php
namespace PdWms;
class WmsStrategy
{
public $wmsClient;
public function __construct($warehouseId)
{
2020-03-25 06:16:20 +00:00
$config = require(dirname(dirname(__FILE__)) . '/config/wms.php');
2020-03-19 09:05:29 +00:00
switch ($warehouseId)
{
2020-03-25 06:16:20 +00:00
case $config['xinyi']['warehouse_id']:
$this->wmsClient = new XinyiWms($config['xinyi']);
2020-03-19 09:05:29 +00:00
break;
2020-03-25 06:16:20 +00:00
case $config['gwall']['warehouse_id']:
$this->wmsClient = new GwallWms($config['gwall']);
2020-03-19 09:05:29 +00:00
break;
default:
throw new \Exception('仓库不存在');
}
}
public function saleOrderCreate($params) {
return $this->wmsClient->saleOrderCreate($params);
}
public function goodsStockInfoSingle($wmsCode, $inventoryType = 'ZP') {
return $this->wmsClient->goodsStockInfoSingle($wmsCode, $inventoryType);
}
public function goodsStockInfo($params, $inventoryType = 'ZP') {
return $this->wmsClient->goodsStockInfo($params, $inventoryType);
}
public function goodsSync($params) {
return $this->wmsClient->goodsSync($params);
}
public function orderCancel($params) {
return $this->wmsClient->orderCancel($params);
}
public function saleReturnOrderCreate($params) {
return $this->wmsClient->saleReturnOrderCreate($params);
}
public function stockInCreate($params, $type = 0) {
return $this->wmsClient->stockInCreate($params, $type);
}
public function stockOutCreate($params) {
return $this->wmsClient->stockOutCreate($params);
}
2020-03-20 10:15:53 +00:00
public static function callback($params) {
$client = new XinyiWms();
return $client->callback($params);
}
2020-03-19 09:05:29 +00:00
}