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

60 lines
1.5 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_receive_purchase extends console_event_response{
/**
*
* 采购入库事件处理
* @param array $datainStorage
*/
public function inStorage($data){
$purchaseObj = kernel::single('console_receipt_purchase');
if ($data['io_source'] == 'selfwms'){#自有仓储不作处理
return $this->send_succ();
}
$io_status = $data['io_status'];
//验证采购单当前状态是否有效
$msg = '';
$purchase = $purchaseObj->checkValid($data['io_bn'],$io_status,$msg);
if (!$purchase){
return $this->send_error($msg);
}
switch($io_status){
case 'PARTIN':
case 'FINISH':
//参数转换
$result = $purchaseObj->update($data,$msg);
break;
case 'FAILED':
case 'CANCEL':
case 'CLOSE':
$result = $purchaseObj->cancel($data['io_bn']);
break;
default:
return $this->send_succ('无法识别的操作指令');
break;
}
if ($result){
return $this->send_succ('采购入库操作成功');
}else{
$msg = $msg!='' ? $msg :'更新失败';
return $this->send_error($msg);
}
}
}