Commit 64283d47 by 朱继来

调整导入

parent 38d792f1
......@@ -207,8 +207,7 @@ class CommonModel extends Model
// 判断型号是否存在
public function isGoodsNameExists($goods_name)
{
$SpuModel = new SpuModel;
return $SpuModel->where('spu_name', $goods_name)->value('_id');
return DB::connection('mongodb')->collection('spu')->where('spu_name', $goods_name)->value('_id');
}
// 判断品牌是否存在
......
......@@ -48,11 +48,10 @@ class QuoteModel extends Model
->toArray();
if (!$list) return [20001, '没有数据'];
foreach ($list['data'] as $k=>&$v){
$currency_sign = InquiryMap::$currency_sign[$v["currency"]];
$v["price_origin"] = $v["currency"] >1 ? $currency_sign.$v["price_origin"] : "--";
$v["price_rmb"] = $v["currency"] == 1 ? $currency_sign.$v["price_rmb"]:"--";
$v["price_origin"] = $v["currency"] == 2 ? "$".$v["price_origin"] : "--";
$v["price_rmb"] = $v["currency"] == 1 ? "¥".$v["price_rmb"]:"--";
$v['status'] = QuoteMap::$status[$v["status"]];
if ($v["remark"] == "digikey"){
if ($v["create_name"] == "digikey"){
$v["create_name"] = "digikey(包装:".$v["raw_goods_packing"].")";
}
}
......@@ -201,16 +200,13 @@ class QuoteModel extends Model
case "brand_name":
$query->where('it.brand_name', 'like',$b.'%');
break;
case "inquiry_items_id":
$query->where('it.id', '<>',$b);
break;
}
}
$query->whereIn('q.status', [1,2,3]);
});
$list = $list->orderBy('id', 'desc')->paginate($limit, ['*'], 'page', $page)->toArray();
foreach ( $list['data'] as $b=>&$v) {
foreach ($list['data'] as $b=>&$v) {
if ($v['currency'] == 1){
$v["price_origin"] = "--";
}else{
......@@ -610,19 +606,34 @@ class QuoteModel extends Model
$CommonModel = new CommonModel();
$err = []; // 提示信息
array_walk($excel, function($val, $key) use($required, $required_keys, &$err) {
array_walk($excel, function($val, $key) use($CommonModel, $required, $required_keys, &$err) {
// 跳过第一条
if ($key != 0) {
if ($val['goods_name']) { // 判断型号是否存在
$res = $CommonModel->isGoodsNameExists($val['goods_name']);
if (!$res) {
$err[] = '第'.($key+1).'行,型号'.$val['goods_name'].'不存在于系统';
return;
}
}
if ($val['brand_name']) { // 判断型号是否存在
if ($val['brand_name']) { // 判断品牌是否存在
$res = $CommonModel->isBrandNameExists($val['brand_name']);
if (!$res) {
$err[] = '第'.($key+1).'行,品牌'.$val['brand_name'].'不存在于系统';
return;
}
}
if ($val['supplier_name']) { // 判断型号是否存在
if ($val['supplier_name']) { // 判断供应商是否存在
$res = $CommonModel->isSupplierNameExists($val['supplier_name']);
if (!$res) {
$err[] = '第'.($key+1).'行,供应商'.$val['supplier_name'].'不存在于系统';
return;
}
}
if ($val['currency'] != '人民币' && $val['price_origin'] <= 0) {
......
......@@ -29,7 +29,7 @@ return [
2 => '美元',
3 => '港币',
4 => '欧元',
5 => '英',
5 => '英',
],
'currency_sign' => [
......
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