Files
OMS/app/taoguaninventory/model/encoded/state.php
2025-12-28 23:13:25 +08:00

32 lines
889 B
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 taoguaninventory_mdl_encoded_state extends dbeav_model {
/**
* 获取编码状态信息
*/
function get_state($name){
$state = $this->dump(array('name'=>$name),'head,bhlen,currentno,eid');
if($state){
$currentno = $state['currentno'];
$maxcurrentno = str_pad(9,$state['bhlen'],9,STR_PAD_LEFT);
if($maxcurrentno==$currentno){
$currentno=0;
}
$currentno++;
$state_bn = $state['head'].date('ymd').str_pad($currentno,$state['bhlen'],'0',STR_PAD_LEFT);
$state['currentno'] = $currentno;
$state['state_bn'] = $state_bn;
return $state;
}else{
return false;
}
}
}
?>