Commit 24fa1dec by hcy001

1

parent 335dfec3
......@@ -71,7 +71,7 @@ class ApiController extends Controller
}
//创建询价明细
private function ApiCreateOneItems($input, $id){
Export((new InquiryItemsModel())->addItems(1,[$input]));
Export((new InquiryItemsModel())->addItems($input));
}
//更新询价明细
private function ApiUpdateOneItems($input, $id){
......@@ -165,6 +165,10 @@ class ApiController extends Controller
{
Export((new QuoteModel())->import($input));
}
// 批量导入询价
public function ApiImportInquiry($input, $id)
{
Export((new InquiryItemsModel())->import($input));
}
}
......@@ -10,11 +10,44 @@ use DB;
class CommonModel extends Model
{
//搜索联营品牌
public function BrandList($k)
public function BrandList($k,$types=1)
{
$brandInfo = DB::connection("spu")->select("select brand_id as value,brand_name as name from lie_brand where brand_name like '%".$k."%' limit 10");
echo json_encode($brandInfo,JSON_UNESCAPED_UNICODE) ;
exit();
$dbspu = DB::connection("spu");
if ($types == 1) { #模糊搜索
$brandInfo = $dbspu->select("select brand_id as value,brand_name as name from lie_brand where brand_name like '%".$k."%' limit 10");
echo json_encode($brandInfo,JSON_UNESCAPED_UNICODE) ;
exit();
}else{
$brandInfo = $dbspu->select("select brand_id as brand_id,brand_name as name from lie_brand where brand_name = '".$k."' limit 1");
if (!$brandInfo){
return false;
}else{
return $brandInfo[0]["brand_id"];
}
}
}
/*
* 查询采购名称
*/
public function UserList($k,$types = 1){
$dbcms = DB::connection();
if ($types == 1) { #模糊搜索
$purInfo = $dbcms->select("select userId as value,name as name from user_info where name like '%".$k."%' limit 10");
echo json_encode($purInfo,JSON_UNESCAPED_UNICODE) ;
exit();
}else{
$k = explode(",",$k);
$str = [];
foreach ($k as $k=>$b){
$purInfo = $dbcms->select("select userId as uid,name as user_name from user_info where name = '".$b."'");
if (!$purInfo){
return false;
}
array_push($str,["uid"=>$purInfo[0]["uid"],"user_name"=>$purInfo[0]["user_name"]]);
}
return $str;
}
}
//导出pdf
......@@ -48,14 +81,6 @@ class CommonModel extends Model
echo json_encode($temp,JSON_UNESCAPED_UNICODE) ;
}
/*
* 查询采购名称
*/
public function UserList($k){
$purInfo = DB::connection()->select("select userId as value,name as name from user_info where name like '%".$k."%' limit 10");
echo json_encode($purInfo,JSON_UNESCAPED_UNICODE) ;
}
// 搜索供应商
public function SupplierList($k)
{
......
......@@ -294,6 +294,15 @@ class InquiryModel extends Model
return $inqueryId;
}
//生成草稿id
public function FindInquirySn($inquiry_id=''){
$result=$this->where('id','=',$inquiry_id)->select('inquiry_sn')->first();
if(!$result){
return false;
}else{
return $result->inquiry_sn;
}
}
......
......@@ -240,6 +240,7 @@ class QuoteModel extends Model
// 报价导入
public function import($input)
{
$inquiry_id = @$input["inquiry_id"];
$file = $_FILES['file']; // $request->file('file')
$filePath = $file['tmp_name']; // 临时路径
......@@ -252,10 +253,14 @@ class QuoteModel extends Model
if (empty($excel)) return [1, '未获取到模板内容,请检查模板内容数据格式'];
$map = Config('quote.import_quote_map');
if (count($map) != count($excel[0])) return [2, '导入模板错误'];
$excel = $this->handleExcelData($excel, $map); // 处理数据
$excel = $this->handleExcelData($excel, $map); // 处理数据
print_r($excel);
$valid = $this->excelValid($excel); // 验证excel内容
if ($valid[0] != 0) return $valid;
......
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