Commit 6c439f8a by hcy001

更新自动报价

parent 9df7088c
......@@ -25,20 +25,21 @@ class HdController extends Controller
//添加参数
private function cf(){
$mongo = \DB::connection("mongodb")
->collection("spu")
// ->where("****","***")
->first();
print_r($mongo);
die();
$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"}}';
// $mongo = \DB::connection("mongodb")
// ->collection("spu")
//// ->where("****","***")
// ->first();
// print_r($mongo);
// die();
// $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"}}';
$t = '{"0":{"inquiry_id":"109","inquiry_sn":"X2021042600489","inquiry_items_id":"300","currency":1,"goods_id":"41757","goods_name":"XC6210B332MR","brand_id":"4725","brand_name":"n//a","supplier_id":"10000","supplier_name":"猎芯自营","quote_number":"100","remark":"3-7工作日","price_rmb":"0.8457","status":1,"create_uid":1737,"create_name":"陈进"}}';
$res = (new QuoteModel())->addBatch($t);
print_r($res);
die();
......
......@@ -360,11 +360,15 @@ class QuoteModel extends Model
$v['price_rmb'] = $rate ? number_format($v['price_origin'] * $rate, 6) : 0; // 需计算汇率(排序用)
}
$quote_sn = $this->where(["inquiry_items_id"=>$inquiry_items_id,"raw_goods_sn"=>$v["raw_goods_sn"]])->value("quote_sn");
if (@$v["supplier_name"] == "猎芯自营"){
$quote_sn = $this->where(["inquiry_items_id"=>$inquiry_items_id,"goods_id"=>$v["goods_id"],"supplier_name"=>"猎芯自营"])->value("quote_sn");
}else{
$quote_sn = $this->where(["inquiry_items_id"=>$inquiry_items_id,"raw_goods_sn"=>$v["raw_goods_sn"]])->value("quote_sn");
}
if ($quote_sn){ #存在更新
$v["create_time"] = time();
$this->where(["inquiry_items_id"=>$inquiry_items_id,"raw_goods_sn"=>$v["raw_goods_sn"]])->update($v) ;
$this->where(["quote_sn"=>$quote_sn])->update($v) ;
$currency_sign = array_get(Config('quote.currency_sign'), $v['currency'], '¥');
OpLogModel::log([
......
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