mirror of
https://gitee.com/ShopeX/OMS
synced 2026-03-23 02:45:33 +08:00
86 lines
2.7 KiB
PHP
86 lines
2.7 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.
|
|
*/
|
|
|
|
class erpapi_store_response_waybill extends erpapi_store_response_abstract
|
|
{
|
|
|
|
/**
|
|
* 获取
|
|
* @param mixed $params 参数
|
|
* @return mixed 返回结果
|
|
*/
|
|
public function get($params){
|
|
|
|
if (!$params['logi_code']) {
|
|
$this->__apilog['result']['msg'] = '缺少物流编码';
|
|
|
|
return false;
|
|
}
|
|
|
|
$corp = app::get('ome')->model('dly_corp')->db_dump(array('type' => $params['logi_code'],'tmpl_type'=>'electron'), 'corp_id,name,tmpl_type,channel_id,type');
|
|
if (!$corp) {
|
|
$this->__apilog['result']['msg'] = '配货失败:物流公司编码不存在';
|
|
|
|
return false;
|
|
}
|
|
$data = array(
|
|
|
|
'package_id' => $params['package_id'],
|
|
'package_type' => $params['package_type'],
|
|
'logi_code' => $params['logi_code'],
|
|
'logi_name' => $params['logi_name'],
|
|
'corp' => $corp,
|
|
|
|
);
|
|
|
|
$package_type = $params['package_type'];
|
|
|
|
if (!in_array($package_type,array('delivery','iostock'))){
|
|
$this->__apilog['result']['msg'] = '业务类型'.$package_type.',无法识别';
|
|
return false;
|
|
}
|
|
if ($package_type == 'delivery'){
|
|
|
|
$deliveryMdl = app::get('ome')->model('delivery');
|
|
$delivery = $deliveryMdl->dump(array('delivery_bn'=>$params['package_id'],'parent_id'=>0,'status'=>array('ready','progress')));
|
|
|
|
if(!$delivery){
|
|
$this->__apilog['result']['msg'] = sprintf('[%s]不存在', $params['package_id']);
|
|
|
|
return false;
|
|
}
|
|
|
|
$data['delivery_bn'] = $params['package_id'];
|
|
}
|
|
if ($package_type == 'iostock'){
|
|
$isoMdl = app::get('taoguaniostockorder')->model('iso');
|
|
|
|
$iso = $isoMdl->db_dump(array('iso_bn' => $params['package_id']), 'iso_id,iso_bn,check_status,iso_status,type_id');
|
|
|
|
if (!$iso) {
|
|
$this->__apilog['result']['msg'] = sprintf('[%s]不存在', $params['package_id']);
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return $data;
|
|
}
|
|
|
|
}
|
|
|
|
?>
|