Files
OMS/app/ome/lib/receipt/dlyitemsstoragelife.php
2026-01-04 19:08:31 +08:00

106 lines
4.0 KiB
PHP

<?php
/**
* Copyright 2012-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 ome_receipt_dlyitemsstoragelife{
/**
*
* 唯一码发货历史记录
* @param Array $sdf
*/
public function consign($params, &$msg){
//校验传入参数
if(!$this->checkParams($params,$msg)){
return false;
}
$delivery_id = $params['delivery_id'];
$delivery_bn = $params['delivery_bn'];
$branch_id = $params['branch_id'];
$out_storagelife = $params['out_storagelife'];
$nowTime = time();
$opinfo = kernel::single('ome_func')->getDesktopUser();
$dlyItemsStoragelifeObj = app::get('ome')->model('delivery_items_storagelife');
$prdStoragelifeHistoryObj = app::get('ome')->model('product_storagelife_history');
//delivery items serial info
$serial_sql = 'insert into sdb_ome_delivery_items_storagelife(delivery_id,bm_id,bn,product_name,expire_bn,number,status) values ';
//io serial history
$log_sql = 'insert into sdb_ome_product_storagelife_history(branch_id,bn,product_name,act_type,act_time,act_owner,bill_type,bill_no,expire_bn,number) values ';
foreach($out_storagelife as $storagelife){
//convert params
$storagelife_vals[] = "('".$delivery_id."','".$storagelife['bm_id']."','".$storagelife['material_bn']."','".$storagelife['product_name']."','".$storagelife['expire_bn']."','".$storagelife['nums']."','1')";
//history log
$log_vals[] = "('".$branch_id."','".$storagelife['material_bn']."','".$storagelife['product_name']."','1',".$nowTime.",'".$opinfo['op_id']."','1','".$delivery_bn."','".$storagelife['expire_bn']."','".$storagelife['nums']."')";
}
$sql1 = $serial_sql.implode(',',$storagelife_vals);
if($dlyItemsStoragelifeObj->db->exec($sql1)){
$sql2 = $log_sql.implode(',',$log_vals);
if($prdStoragelifeHistoryObj->db->exec($sql2)){
return true;
}else{
return false;
}
}else{
return false;
}
}
private function checkParams($params,&$msg){
return true;
}
/**
*
* 唯一码退货历史记录
* @param Array $sdf
*/
public function returnProduct($history_storagelife, &$msg){
//校验传入参数
if(!$this->checkReturnParams($history_storagelife,$msg)){
return false;
}
$nowTime = time();
$opinfo = kernel::single('ome_func')->getDesktopUser();
$prdStoragelifeHistoryObj = app::get('ome')->model('product_storagelife_history');
//io serial history
$log_sql = 'insert into sdb_ome_product_storagelife_history(branch_id,bn,product_name,act_type,act_time,act_owner,bill_type,bill_no,expire_bn,number) values ';
foreach($history_storagelife as $storagelife){
//history log
$log_vals[] = "('".$storagelife['branch_id']."','".$storagelife['bn']."','".$storagelife['product_name']."','2',".$nowTime.",'".$opinfo['op_id']."','2','".$storagelife['reship_bn']."','".$storagelife['expire_bn']."','".$storagelife['nums']."')";
}
$sql = $log_sql.implode(',',$log_vals);
if($prdStoragelifeHistoryObj->db->exec($sql)){
return true;
}else{
return false;
}
}
private function checkReturnParams($params,&$msg){
return true;
}
}