修改销售单发货逻辑
This commit is contained in:
parent
5ec1668057
commit
ce1efee9b1
|
@ -20,13 +20,25 @@ class WmsStrategy
|
|||
}
|
||||
|
||||
public function saleOrderCreate($params) {
|
||||
//计算商品重量
|
||||
$skuTotalWeight = $this->getSkuTotalWeight($params['order_goods']);
|
||||
$logistics = $this->chooseLogisticsCompany($params['order_address']['receive_province'], $skuTotalWeight);
|
||||
$params['order_sender_info']['logistics_code'] = $logistics['code'];
|
||||
$params['order_sender_info']['logistics_name'] = $logistics['name'];
|
||||
$orderLogisticsType = '';
|
||||
if ($params['delivery_type'] == 1) {
|
||||
$orderLogisticsType = 'toC';
|
||||
} else if ($params['delivery_type'] == 2) {
|
||||
$orderLogisticsType = 'toB';
|
||||
}
|
||||
|
||||
if ($logistics['type'] == 'toC') {
|
||||
if (!$orderLogisticsType || !$params['express_code']) {
|
||||
//计算商品重量
|
||||
$skuTotalWeight = $this->getSkuTotalWeight($params['order_goods']);
|
||||
$logistics = $this->chooseLogisticsCompany($params['order_address']['receive_province'], $skuTotalWeight);
|
||||
$params['order_sender_info']['logistics_code'] = $logistics['code'];
|
||||
$params['order_sender_info']['logistics_name'] = $logistics['name'];
|
||||
} else {
|
||||
$params['order_sender_info']['logistics_code'] = $params['express_code'];
|
||||
$params['order_sender_info']['logistics_name'] = self::getExpressNameByExpressCode($params['express_code']);
|
||||
}
|
||||
|
||||
if ($orderLogisticsType == 'toC') {
|
||||
// 2C订单发货
|
||||
$res = $this->deliveryOrderCreate($params);
|
||||
$type = 1;
|
||||
|
@ -175,4 +187,18 @@ class WmsStrategy
|
|||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据物流码获取物流名称
|
||||
*/
|
||||
static public function getExpressNameByExpressCode($expressCode)
|
||||
{
|
||||
$expressChooseConf = require(dirname(dirname(__FILE__)) . '/config/express_choose.php');
|
||||
$logistics = collect([$expressChooseConf['logistics']['toC'], $expressChooseConf['logistics']['toB']])
|
||||
->collapse()
|
||||
->keyBy('code')
|
||||
->all();
|
||||
$expressName = $logistics[$expressCode] ? $logistics[$expressCode]['name'] : '';
|
||||
return $expressName;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user