Files
OMS/app/erpapi/lib/wms/ftp/request/delivery.php
2026-01-04 19:08:31 +08:00

130 lines
4.6 KiB
PHP

<?php
/**
* Copyright 2012-2026 ShopeX (https://www.shopex.cn)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* 发货单推送
*
* @category
* @package
* @author chenping<chenping@shopex.cn>
* @version $Id: Z
*/
class erpapi_wms_ftp_request_delivery extends erpapi_wms_request_delivery
{
/**
* 发货单创建
*
* @return
* @author
**/
public function delivery_create($sdf){
// 发货作业单
$delivery_bn = $sdf['outer_delivery_bn'];
$iscancel = kernel::single('ome_interface_delivery')->iscancel($delivery_bn);
if ($iscancel) {
return $this->succ('发货单已取消,终止同步');
}
// 发货明细
$items = array();
foreach ((array) $sdf['delivery_items'] as $v){
$barcode = kernel::single('material_codebase')->getBarcodeBybn($v['bn']); // TODO:伊腾忠用条形码作唯一标识
$items[] = array(
'item_bn' => $barcode,
'price' => $v['price'],
'item_sale_price' => $v['sale_price'],
'num' => $v['number'],
);
}
$title = $this->__channelObj->wms['channel_name'] . '发货单添加';
$shop_code = kernel::single('wmsmgr_func')->getWmsShopCode($this->__channelObj->wms['channel_id'],$sdf['shop_code']);
$logistics_code = kernel::single('wmsmgr_func')->getWmslogiCode($this->__channelObj->wms['channel_id'],$sdf['logi_code']);
$params = array(
'order_type' => $sdf['shop_type'],
'order_bn' => $delivery_bn,
'outer_order_bn' => $sdf['outer_order_bn'],
'original_order_bn' => $sdf['order_bn'],
'warehouse' => $sdf['branch_bn'],
'logistics' => $logistics_code ? $logistics_code : $sdf['logi_code'],
'member_name' => $sdf['member_name'],
'ship_name' => $sdf['consignee']['name'],
'zip' => $sdf['consignee']['zip'],
'phone' => $sdf['consignee']['telephone'],
'mobile' => $sdf['consignee']['mobile'],
'province' => $sdf['consignee']['province'],
'city' => $sdf['consignee']['city'],
'district' => $sdf['consignee']['district'] ? $sdf['consignee']['district'] : '其他',
'addr' => $sdf['consignee']['addr'],
'cost_item' => $sdf['total_amount'],
'cost_freight' => $sdf['logistics_costs'],
'is_cod' => $sdf['is_cod'],
'cod_fee' => $sdf['cod_fee'],
'shop_code' => $shop_code,#售达方编号
'delivery_center' => $sdf['print_remark']['pszx_name'],#配送中心名称
'memo' => $sdf['memo'],
'items' => json_encode($items),
);
$config = $this->__channelObj->wms['adapter']['config'];
$url = $config['url'] ? $config['url'] : app::get('wmsmgr')->getConf('api_url'.$this->__channelObj->wms['node_id']);
// 御城河
/*
$tradeIds = explode('|',$sdf['order_bn']);
kernel::single('base_hchsafe')->order_send_log($tradeIds,$this->__channelObj->wms['node_id'],$url);
*/
return $this->__caller->call(WMS_SALEORDER_CREATE, $params, null, $title,10,$delivery_bn);
}
/**
* 发货单暂停
*
* @return void
* @author
**/
public function delivery_pause($sdf){
return $this->error('接口方法不存在','w402');
}
/**
* 发货单暂停恢复
*
* @return void
* @author
**/
public function delivery_renew($sdf){
return $this->error('接口方法不存在','w402');
}
/**
* 发货单取消
*
* @return void
* @author
**/
public function delivery_cancel($sdf){
return $this->error('接口方法不存在','w402');
}
public function delivery_search($sdf)
{
return $this->error('接口方法不存在','w402');
}
}