Commit ce43f6b7 by 朱继来

m

parents a9cbebe2 31357a21
...@@ -247,4 +247,10 @@ class ApiController extends Controller ...@@ -247,4 +247,10 @@ class ApiController extends Controller
Export((new InquiryItemsReportModel())->checkOrder($input)); Export((new InquiryItemsReportModel())->checkOrder($input));
} }
// 检测是否存在已经存在的询价单
public function ApiCheckGoods($input, $id)
{
Export((new InquiryItemsModel())->checkGoods($input));
}
} }
...@@ -224,7 +224,7 @@ class InquiryItemsModel extends Model ...@@ -224,7 +224,7 @@ class InquiryItemsModel extends Model
if ($b["pur_s"] !== "" ){ if ($b["pur_s"] !== "" ){
$purArr = json_decode($b["pur_s"],true); $purArr = json_decode($b["pur_s"],true);
$assignInsert = []; #指定领取人 $assignInsert = []; #指定领取人
foreach ($purArr as $b=>$c){ foreach ($purArr as $f=>$c){
array_push($assignInsert,[ array_push($assignInsert,[
"inquiry_items_id"=>$inquiryItemsId, "inquiry_items_id"=>$inquiryItemsId,
"assign_uid"=>$c["uid"], "assign_uid"=>$c["uid"],
...@@ -242,7 +242,7 @@ class InquiryItemsModel extends Model ...@@ -242,7 +242,7 @@ class InquiryItemsModel extends Model
'types'=>1, 'types'=>1,
'relation_id'=>$inquiryItemsId, #明细id 'relation_id'=>$inquiryItemsId, #明细id
'relation_sn'=>(new InquiryModel())->FindInquirySn($b["inquiry_id"]), 'relation_sn'=>(new InquiryModel())->FindInquirySn($b["inquiry_id"]),
'content'=>'批量导入询价', 'content'=>'单个添加询价',
'create_uid'=>$b['user_id'], 'create_uid'=>$b['user_id'],
'create_name'=>$b["user_name"], 'create_name'=>$b["user_name"],
]); ]);
...@@ -520,6 +520,28 @@ class InquiryItemsModel extends Model ...@@ -520,6 +520,28 @@ class InquiryItemsModel extends Model
return count($err) == 0 ? [0, $goodsInfo] : [1, implode('; ', $err)]; return count($err) == 0 ? [0, $goodsInfo] : [1, implode('; ', $err)];
} }
/*
* 检测是否存在已经存在的询价单
*/
public function checkGoods($input){
if (empty($input["inquiry_id"])) return [1003, "询价单ID不得为空"];
if (empty($input["brand_s"])) return [1003, "请选择品牌名称名称"];
if (empty($input["inquiry_number"])) return [1003, "请输入询价数量"];
if (empty($input["batch"])) return [1003, "请输入批次要求"];
if (empty($input["delivery_time"])) return [1003, "请选择交货日期"];
$brandInfo = json_decode($input["brand_s"],true);
$check = $this
->select("inquiry_id")
->where(["goods_name"=>$input["goods_name"],"inquiry_number"=>$input["inquiry_number"],"brand_name"=>$brandInfo[0]["brand_name"]])
->whereRaw("create_time > ".strtotime(date('Y-m-d')))->first();
if ($check){
$user_name = (new InquiryModel())->where("id",$check->inquiry_id)->value("user_name");
return [1001,"此型号 ".$user_name." 在询,仍然询价吗?"];
}
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