Files
OMS/app/omevirtualwms/model/dataStatus.php
2026-01-04 17:22:44 +08:00

75 lines
2.4 KiB
PHP

<?php
/**
* Copyright 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 omevirtualwms_mdl_dataStatus extends dbeav_model {
/**
* table_name
* @param mixed $full full
* @return mixed 返回值
*/
public function table_name($full=null)
{
if ($full)
return kernel::database()->prefix.'omevirtualwms_data_status';
else
return 'data_status';
}
/**
* 保存
* @param mixed $data 数据
* @param mixed $mustUpdate mustUpdate
* @return mixed 返回操作结果
*/
public function save(&$data, $mustUpdate=null)
{
if (current($this->dump(array('bn'=>$data['bn'], 'type'=>$data['type']),'count(*) as cnt')) == 0)
return $this->insert($data);
else
return $this->update($data,array('bn'=>$data['bn'], 'type'=>$data['type']));
}
/**
* scanANDclean
* @return mixed 返回值
*/
public function scanANDclean()
{
/* $sql = 'delete from sdb_omevirtualwms_data_status where type=\'stockin\' and bn in ( select appropriation_bn from sdb_omestorage_appropriation where in_status not in (0,1) and otype=\'0\' )';
$this->db->query($sql);
$sql = 'delete from sdb_omevirtualwms_data_status where type=\'stockout\' and bn in ( select appropriation_bn from sdb_omestorage_appropriation where in_status not in (3,4) and otype=\'1\' )';
$this->db->query($sql); */
$sql = 'delete from sdb_omevirtualwms_data_status where type=\'reship\' and bn in ( select reship_bn from sdb_ome_reship where status!=\'ready\' and status!=\'progress\' )';
$this->db->query($sql);
$sql = 'delete from sdb_omevirtualwms_data_status where type=\'delivery\' and bn in ( select delivery_bn from sdb_ome_delivery where status!=\'ready\' and status!=\'accept\' and status!=\'progress\' )';
$this->db->query($sql);
}
}