134 行
4.4 KiB
PHP
可执行文件
134 行
4.4 KiB
PHP
可执行文件
<?php
|
|
|
|
namespace Retail\Controller;
|
|
|
|
use Common\Business\DownFile;
|
|
use Common\Business\Export;
|
|
use Common\Business\SerialNumberGoods;
|
|
use Common\Business\StockRecord;
|
|
use Common\Business\Supplier;
|
|
use Think\Controller;
|
|
|
|
//[1.7.90]
|
|
class SStockOutRecordController extends BaseController
|
|
{
|
|
public function index()
|
|
{
|
|
$global_store_jurisdiction = session('global_store_jurisdiction');
|
|
$merchant_id = session("ls_userinfo")['merchantid'];
|
|
$arr = array(
|
|
'exportOperation' => '/index.php/Retail/SStockOutRecord/export',
|
|
);
|
|
$authArr = checkFunction($arr);
|
|
$class_name = A('Api/Inventory')->GoodsClass($merchant_id);
|
|
$SupplierClass = new Supplier();
|
|
$supplier_list = $SupplierClass->getList([
|
|
'user_type' => 4,
|
|
'merchant_id' => $this->merchant_id,
|
|
'store_id' => $this->store_id,
|
|
'fields' => 'id,supplier_name'
|
|
]);
|
|
$this->assign('authArr', $authArr);
|
|
$this->assign('goodsClass1', json_encode($class_name));
|
|
$this->assign('supplier_list', json_encode($supplier_list));
|
|
$this->assign('data_export', $global_store_jurisdiction['data_export']);
|
|
$this->assign('identity', self::$identity);
|
|
$this->assign("supplier_type", session('ls_userinfo')['supplier_type']);
|
|
|
|
$this->display();
|
|
}
|
|
|
|
|
|
//出库记录串号列表
|
|
public function stockSerialList()
|
|
{
|
|
$data = I('post.');
|
|
$data['user_type'] = 4;
|
|
$data['serial_type'] = 3;
|
|
$SerialClass = new SerialNumberGoods();
|
|
$result = $SerialClass->recordSerialList($data);
|
|
$this->ajaxReturn($result);
|
|
}
|
|
|
|
|
|
//出库记录列表
|
|
public function recordList()
|
|
{
|
|
$data = I("post.");
|
|
$data['merchant_id'] = $this->merchant_id;
|
|
$data['store_id'] = $this->store_id;
|
|
$RecordClass = new StockRecord();
|
|
$result = $RecordClass->storeRecordList($data);
|
|
$this->ajaxReturn($result);
|
|
}
|
|
|
|
//导出
|
|
public function export()
|
|
{
|
|
ini_set('memory_limit', '-1');
|
|
$content = I("post.");
|
|
$content['merchant_id'] = $this->merchant_id;
|
|
$content['store_id'] = $this->store_id;
|
|
$content['requester_type'] = 1; //web端
|
|
$directory_name = $content['directory_name']; //文件路径
|
|
$RecordClass = new StockRecord();
|
|
$info = $RecordClass->storeRecordList($content);
|
|
if (empty($directory_name)) {
|
|
$directory_name = "./Uploads/StockOutExport/{$this->merchant_id}/{$this->store_id}/";
|
|
}
|
|
$fileds_name = "出库记录";
|
|
$arr = array(
|
|
array('index', '序号'),
|
|
array('type_name', '出库类型'),
|
|
array('supplier_name', '供货商'),
|
|
array('goods_name', '商品名称'),
|
|
array('sku_name', '规格名称'),
|
|
array('goods_number', '货号'),
|
|
array('goods_code', '条码'),
|
|
array('sku_num', '规格基数'),
|
|
array('company', '单位'),
|
|
array('stock_num', '出库数量'),
|
|
array('stock_price', '出库价'),
|
|
array('subtotal', '合计'),
|
|
array('remarks', '备注'),
|
|
array('add_time', '出库时间'),
|
|
array('examine_name', '状态'),
|
|
);
|
|
$str = $fileds_name . ',导出日期:' . date('Y-m-d H:i:s', time());
|
|
$param = [
|
|
'expTitle' => $fileds_name,
|
|
'expCellName' => $arr,
|
|
'expTableData' => $info['data']['list'],
|
|
'common' => $str,
|
|
'directory_name' => $directory_name,
|
|
'page' => $content['page'],
|
|
];
|
|
$ExportClass = new Export();
|
|
$result = $ExportClass->generateXLS($param);
|
|
$res = [
|
|
'status' => 1,
|
|
'message' => '请继续生成文件',
|
|
'data' => [
|
|
'type' => 1,
|
|
'directory_name' => $result['directory_name'],
|
|
]
|
|
];
|
|
if (count($info['data']['list']) < $content['limit']) {
|
|
$res['data']['type'] = 2;
|
|
$res['message'] = '数据生成完毕';
|
|
}
|
|
$this->ajaxReturn($res);
|
|
}
|
|
|
|
|
|
//下载文件
|
|
public function exportFile()
|
|
{
|
|
$DownFileClass = new DownFile();
|
|
$DownFileClass->downFile([
|
|
'file_path' => I('get.file_path'),
|
|
'file_name' => '出库记录导出',
|
|
'file_type' => '.xls'
|
|
]);
|
|
}
|
|
} |