Files
OMS/app/wms/lib/delivery/cfg.php
2025-12-28 23:13:25 +08:00

172 lines
4.4 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.
*/
/**
* 发货配置处理文件
*
* @author chenping<chenping@shopex.cn>
* @version 2012-5-10 14:03
* @package delivery
*
*/
class wms_delivery_cfg {
/**
* undocumented function
*
* @return void
* @author
**/
public function __construct(&$app)
{
$this->deliveryCfg = app::get('wms')->getConf('wms.delivery.status.cfg');
}
/**
* 分析打印按钮状态
*
* @return BOOL TRUE:开启 FALSE:关闭
* @author
* @param $type 打印按钮类型
* @param $sku 单品、多品
**/
public function analyse_btn_status($type,$sku='')
{
if(empty($this->deliveryCfg)) return true;
if ($sku=='single') {
$btnCfg = $this->deliveryCfg['set']['single'];
}elseif($sku=='multi'){
$btnCfg = $this->deliveryCfg['set']['multi'];
}else{
$btnCfg = $this->deliveryCfg['set'];
}
if($type=='merge'){
if(is_null($btnCfg['stock']) && is_null($btnCfg['delie'])){
return false;
}elseif(is_null($btnCfg['merge']) && ($btnCfg['stock']==1 || $btnCfg['delie'] == 1)){
return false;
}
}
if(is_null($btnCfg[$type])) return true;
return ($btnCfg[$type] == 0) ? false : true;
}
/**
* 获取值
*
* @return void
* @author
* @param $key 键
* @param $sku 单品、多品
**/
public function getValue($key,$sku='')
{
if ($this->deliveryCfg) {
$cfg = $this->deliveryCfg['set'];
}else{ //默认值
$cfg = array(
'wms_batch_print_nums' => 100,
'wms_eachgroup_print_count' => 20,
'single' => array(
'wms_batch_print_nums' => 100,
'wms_eachgroup_print_count' => 20,
),
'multi' => array(
'wms_batch_print_nums' => 100,
'wms_eachgroup_print_count' => 20,
),
);
}
if ($sku=='single') {
$cfg = array_merge($cfg,$cfg['single']);
}elseif($sku=='multi'){
$cfg = array_merge($cfg,$cfg['multi']);
}
$cfg['wms_batch_print_nums'] = $cfg['wms_batch_print_nums'] ? $cfg['wms_batch_print_nums'] : 100;
$cfg['wms_eachgroup_print_count'] = $cfg['wms_eachgroup_print_count'] ? $cfg['wms_eachgroup_print_count'] : 20;
return $cfg[$key] ? $cfg[$key] : '';
}
/**
* 按钮组合
*
* @return void
* @author
**/
public function btnCombi($sku='')
{
if(empty($this->deliveryCfg)) return '1_1';
$cfg = $this->deliveryCfg['set'];
if ($sku=='single') {
$cfg = array_merge($cfg,$cfg['single']);
}elseif($sku=='multi'){
$cfg = array_merge($cfg,$cfg['multi']);
}
if(is_null($cfg['stock']) && is_null($cfg['delie']) && is_null($cfg['merge'])){
return '1_1';
}elseif ($cfg['stock'] == 1 && $cfg['delie'] == 1) {
return '1_1';
}elseif ($cfg['stock'] == 1 && $cfg['delie'] == 0) {
return '1_0';
}elseif ($cfg['stock'] == 0 && $cfg['delie'] == 1) {
return '0_1';
}elseif ($cfg['stock'] == 0 && $cfg['delie'] == 0 && $cfg['merge'] == 1){
return '1_1';
}elseif ($cfg['stock'] ==0 && $cfg['delie'] == 0 && $cfg['merge'] == 0) {
return '0_0';
}else{
return '1_1';
}
}
/**
* @打印版本
* @access public
* @param void
* @return void
*/
public function getprintversion()
{
$print_version = $this->deliveryCfg['set']['wms_delivery_print_devision'];
if(!$print_version){
$print_version=0;
}
return $print_version;
}
/**
* @获取打印模式
* @access public
* @param void
* @return void
*/
public function getprintstyle()
{
$print_style = $this->deliveryCfg['set']['wms_delivery_print_style'];
if($print_style==''){
$print_style='1';
}
return $print_style;
}
public function getNormalCheckConsign() {
return array(
'normal', 'vopczc'
);
}
}