Files
OMS/app/console/lib/event/trigger/reship.php
2025-12-28 23:13:25 +08:00

104 lines
3.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* Copyright © ShopeX http://www.shopex.cn. All rights reserved.
* See LICENSE file for license details.
*/
class console_event_trigger_reship{
/**
*
* 退货单通知创建发起方法
* @param string $wms_id 仓库类型ID
* @param array $data 商品同步数据信息
* @param string $sync 是否同步请求true为同步false异步默认异步
*/
public function create($wms_id, &$data, $sync = false){
// $result = kernel::single('middleware_wms_request', $wms_id)->reship_create($data, $sync);
$result = kernel::single('erpapi_router_request')->set('wms',$wms_id)->reship_create($data);
if ($result['rsp'] == 'success' && $result['data']['wms_order_code']) {
$this->update_out_bn($data['reship_bn'],$result['data']['wms_order_code']);
}
}
/**
*
* 采购通知创建发起的响应接收方法
* @param array $data
*/
public function create_callback($res){
}
/**
*
* 退货单通知更新发起方法
* @param string $wms_id 仓库类型ID
* @param array $data 商品同步数据信息
* @param string $sync 是否同步请求true为同步false异步默认异步
*/
public function cancel($wms_id, &$data, $sync = false){
// $result = kernel::single('middleware_wms_request', $wms_id)->reship_cancel($data, $sync);
$store_id = kernel::single('ome_branch')->isStoreBranch($data['branch_id']);
if($store_id){
$channel_type = 'store';
$channel_id = $store_id;
$result = kernel::single('erpapi_router_request')->set($channel_type,$channel_id)->reship_cancel($data);
}else{
$result = kernel::single('erpapi_router_request')->set('wms',$wms_id)->reship_cancel($data);
if($result['rsp']!='succ'){
$reship_id = $data['reship_id'];
$db = kernel::database();
$db->exec("UPDATE sdb_ome_reship set sync_status='4' where reship_id=".$reship_id."");
}
}
return $result;
}
/**
*
* 采购通知更新发起的响应接收方法
* @param array $data
*/
public function cancel_callback($res){
}
/**
* 退货单查询
* @param
* @return
* @access public
* @author sunjing@shopex.cn
*/
function search($wms_id,&$data, $sync = false)
{
//$result = kernel::single('middleware_wms_request', $wms_id)->reship_search($data, $sync);
$result = kernel::single('erpapi_router_request')->set('wms',$wms_id)->reship_search($data);
}
/**
* 更新退货单外部编号
* @param
* @return
* @access protected
* @author sunjing@shopex.cn
*/
protected function update_out_bn($reship_bn,$out_iso_bn)
{
$oReship = app::get('ome')->model('reship');
$data = array(
'out_iso_bn'=>$out_iso_bn,
);
$oReship->update($data,array('reship_bn'=>$reship_bn));
}
}