Commit a420f07e by hcy001
parents ff292939 bb9ed0d9
......@@ -183,5 +183,10 @@ class ApiController extends Controller
Export((new QuoteModel())->batchQuote($input));
}
// 修改报价
public function ApiEditQuote($input, $id)
{
Export((new QuoteModel())->edit($input));
}
}
......@@ -10,6 +10,7 @@ use DB;
use App\Model\OplogModel;
use App\Model\UserModel;
use App\Http\Controllers\PermController;
use App\Http\Controllers\ApiController;
use RedisDB;
use Excel;
......@@ -272,20 +273,24 @@ class QuoteModel extends Model
// 插入到报价表 -- 状态:草稿
try {
$UserModel = new UserModel;
$ApiController = new ApiController;
foreach ($excel as &$v) {
$v['quote_sn'] = $ApiController->createSn($this, 'quote_sn', 'B');
$v['currency'] = $v['currency'] == 'RMB' ? 1 : 2;
$v['inquiry_id'] = $input['inquiry_id'];
$v['inquiry_sn'] = $input['inquiry_sn'];
$v['inquiry_items_id'] = $input['inquiry_items_id'];
$v['status'] = 0;
$v['create_uid'] = $input['user_id'];
$v['create_name'] = $UserModel->FinduserInfoName($input['user_id']);
$v['create_time'] = time();
$v['update_time'] = time();
}
$res = $this->insert($excel); // 批量插入
if ($res === false) return [1, '添加报价草稿失败'];
$UserModel = new UserModel;
if ($res === false) return [1, '添加报价草稿失败'];
$data = [];
$data['types'] = 2;
......@@ -459,4 +464,30 @@ class QuoteModel extends Model
return [0, '批量提交报价成功'];
}
// 修改报价
public function edit($input)
{
if (!$input['quote_id']) return [-1, '参数缺失'];
try {
$this->where('id', $input['quote_id'])->update($input['quote_info']);
$UserModel = new UserModel;
$data = [];
$data['types'] = 2;
$data['relation_id'] = $input['quote_id'];
$data['relation_sn'] = $input['quote_sn'];
$data['content'] = '修改报价,报价单号:'.$input['quote_sn'];
$data['create_uid'] = $input['user_id'];
$data['create_name'] = $UserModel->FinduserInfoName($input['user_id']);
OplogModel::log($data);
} catch (Exception $e) {
return [1, $e->getMessage()];
}
return [0, '修改报价成功'];
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment