Commit d0c81d9d by hcy001

1

parent 5e96e0a7
......@@ -25,15 +25,17 @@ class HdController extends Controller
//添加参数
private function cf(){
$param = [
["spu_name"=>"RCP0603W110RGS3","brand_name"=>"vishay"]
];
$res = (new SearchModel())->getClassName(\GuzzleHttp\json_encode($param));
print_r($res);
return;
$t = '{"0":{"inquiry_id":"1","inquiry_sn":"A161398670712345","inquiry_items_id":"1","currency":2,"goods_id":"353535","goods_name":"LM358","brand_id":"0","brand_name":"TI","supplier_id":7,"supplier_name":"digikey","quote_number":"25","status":1,"create_uid":0,"create_name":"digikey","price_origin":2.9,"raw_goods_sn":"1597-1134-ND","raw_goods_packing":"Bulk","raw_brand_name":"Seeed Technology Co., Ltd"}}';
// $param = [
// ["spu_name"=>"RCP0603W110RGS3","brand_name"=>"vishay"]
// ];
// $res = (new SearchModel())->getClassName(\GuzzleHttp\json_encode($param));
// print_r($res);
//
// return;
$t = '{"0":{"inquiry_id":"1","inquiry_sn":"A161398670712345","inquiry_items_id":"1","currency":2,"goods_id":"353535","goods_name":"RCP0603W110RGS3","brand_id":"0","brand_name":"vishay","supplier_id":7,"supplier_name":"digikey","quote_number":"25","status":1,"create_uid":0,"create_name":"digikey","price_origin":2.9,"raw_goods_sn":"1597-1134-ND","raw_goods_packing":"Bulk","raw_brand_name":"Seeed Technology Co., Ltd"}}';
$res = (new QuoteModel())->addBatch($t);
print_r($res);
die();
}
//pdf添加
......
......@@ -237,8 +237,23 @@ class QuoteModel extends Model
$con->beginTransaction();
$QuoteModel = new QuoteModel();
#批量获取品牌
$param = [];
foreach ($input as $a=>$b){
array_push($param,["spu_name"=>strtoupper($b["goods_name"]),"brand_name"=>strtoupper($b["brand_name"])]);
}
$classArr = (new SearchModel())->getClassName(\GuzzleHttp\json_encode($param));
#拼接批量插入明细
foreach ($input as $k=>&$v){
if ($classArr !== false){
$classInfo = @$classArr[strtoupper($v["goods_name"])."#".strtoupper($v["brand_name"])];
if (count($classInfo) > 0){
$v["class_id2"] = $classInfo["class_id2"];
$v["class_id2_name"] = $classInfo["class_id2_name"];
}
}
$quote_sn = $this->where(["inquiry_items_id"=>$inquiry_items_id,"raw_goods_sn"=>$v["raw_goods_sn"]])->value("quote_sn");
if ($quote_sn){ #存在更新
......
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