Commit ea8e2f5f by 朱继来

修改报价

parent 47890d55
...@@ -178,5 +178,10 @@ class ApiController extends Controller ...@@ -178,5 +178,10 @@ class ApiController extends Controller
Export((new QuoteModel())->batchQuote($input)); Export((new QuoteModel())->batchQuote($input));
} }
// 修改报价
public function ApiEditQuote($input, $id)
{
Export((new QuoteModel())->edit($input));
}
} }
...@@ -10,6 +10,7 @@ use DB; ...@@ -10,6 +10,7 @@ use DB;
use App\Model\OplogModel; use App\Model\OplogModel;
use App\Model\UserModel; use App\Model\UserModel;
use App\Http\Controllers\PermController; use App\Http\Controllers\PermController;
use App\Http\Controllers\ApiController;
use RedisDB; use RedisDB;
use Excel; use Excel;
...@@ -272,12 +273,18 @@ class QuoteModel extends Model ...@@ -272,12 +273,18 @@ class QuoteModel extends Model
// 插入到报价表 -- 状态:草稿 // 插入到报价表 -- 状态:草稿
try { try {
$UserModel = new UserModel;
$ApiController = new ApiController;
foreach ($excel as &$v) { foreach ($excel as &$v) {
$v['quote_sn'] = $ApiController->createSn($this, 'quote_sn', 'B');
$v['currency'] = $v['currency'] == 'RMB' ? 1 : 2; $v['currency'] = $v['currency'] == 'RMB' ? 1 : 2;
$v['inquiry_id'] = $input['inquiry_id']; $v['inquiry_id'] = $input['inquiry_id'];
$v['inquiry_sn'] = $input['inquiry_sn']; $v['inquiry_sn'] = $input['inquiry_sn'];
$v['inquiry_items_id'] = $input['inquiry_items_id']; $v['inquiry_items_id'] = $input['inquiry_items_id'];
$v['status'] = 0; $v['status'] = 0;
$v['create_uid'] = $input['user_id'];
$v['create_name'] = $UserModel->FinduserInfoName($input['user_id']);
$v['create_time'] = time(); $v['create_time'] = time();
$v['update_time'] = time(); $v['update_time'] = time();
} }
...@@ -285,8 +292,6 @@ class QuoteModel extends Model ...@@ -285,8 +292,6 @@ class QuoteModel extends Model
$res = $this->insert($excel); // 批量插入 $res = $this->insert($excel); // 批量插入
if ($res === false) return [1, '添加报价草稿失败']; if ($res === false) return [1, '添加报价草稿失败'];
$UserModel = new UserModel;
$data = []; $data = [];
$data['types'] = 2; $data['types'] = 2;
$data['relation_id'] = $input['inquiry_items_id']; $data['relation_id'] = $input['inquiry_items_id'];
...@@ -459,4 +464,30 @@ class QuoteModel extends Model ...@@ -459,4 +464,30 @@ class QuoteModel extends Model
return [0, '批量提交报价成功']; 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