51 行
1.5 KiB
PHP
可执行文件
51 行
1.5 KiB
PHP
可执行文件
<?php
|
|
|
|
namespace Common\Model;
|
|
|
|
use Think\Model;
|
|
|
|
//[1.7.90]
|
|
|
|
/**
|
|
*门店盘点串号记录
|
|
* Class PurchaseGoodsModel
|
|
* @package Common\Model
|
|
*/
|
|
class SellSerialModel extends BaseModel
|
|
{
|
|
protected $tableName = 'retail_sell_serial';
|
|
protected $fields = array(
|
|
'id', //int(11) NOT NULL AUTO_INCREMENT,
|
|
'merchant_id', //int(11) DEFAULT '0' COMMENT '商户Id',
|
|
'store_id',
|
|
'outside_id', //外部明细id
|
|
'goods_id', //商品id
|
|
'sku_id', //规格id
|
|
'main_serial_number', //主串码
|
|
'auxiliary_serial_number_one', //辅助串码1
|
|
'auxiliary_serial_number_two', //辅助串码2
|
|
'add_time', //添加时间
|
|
'num', //数量
|
|
'type', //1出库 2入库
|
|
'edit_type'
|
|
);
|
|
|
|
/**
|
|
* 串号搜索订单id
|
|
* @param $serial_number 串号
|
|
* @param int $type 1出库 2入库
|
|
* @return mixed
|
|
*/
|
|
public function basisSerialOrderId($serial_number, $type = 1)
|
|
{
|
|
$order_id_arr = $this->alias('a')
|
|
->join('ls_retail_sell as s on a.outside_id = s.id')
|
|
->where([
|
|
'a.num' => ['gt', 0],
|
|
'a.main_serial_number|a.auxiliary_serial_number_one|a.auxiliary_serial_number_two' => ['like','%'.$serial_number.'%'],
|
|
'a.type' => is_array($type) ? ['in', $type] : $type
|
|
])->field('s.bill_id')
|
|
->select();
|
|
return array_columns($order_id_arr,'bill_id');
|
|
}
|
|
} |