Commit 7434bdb9 by 朱继来

merge

parents f8a79119 5431532c
......@@ -30,8 +30,9 @@ class CommonModel extends Model
//搜索自己的客户
public function getMyUser($create_uid,$k)
{
$where = $k ? "and user_name like '%".$k."%'":"";
$dbspu = DB::connection("rfq");
$brandInfo = $dbspu->select("select id value,user_name name from lie_inquiry_users where create_uid = $create_uid and user_name like '".$k."%' limit 10");
$brandInfo = $dbspu->select("select id value,user_name name from lie_inquiry_users where create_uid = $create_uid $where limit 10");
if (count($brandInfo) == 0){
$brandInfo = [["value"=>0,"name"=>$k]];
}
......
......@@ -185,7 +185,7 @@ class InquiryItemsModel extends Model
return [1001,"插入数据不得为空"];
}
if (empty($b["inquiry_id"])) return [1003, "询价单ID不得为空"];
if (empty($b["brand_s"])) return [1003, "请选择型号名称"];
if (empty($b["brand_s"])) return [1003, "请选择品牌名称名称"];
if (empty($b["inquiry_number"])) return [1003, "请输入询价数量"];
if (empty($b["batch"])) return [1003, "请输入批次要求"];
if (empty($b["delivery_time"])) return [1003, "请选择交货日期"];
......@@ -207,7 +207,7 @@ class InquiryItemsModel extends Model
"target_price"=>@$b["target_price"] ? $b["target_price"] : 0,
"delivery_time"=>@$b["delivery_time"] ? $b["delivery_time"] : "",
"batch"=>@$b["batch"] ? $b["batch"] : "" ,
"assign_type"=>@$b["assign_type"] ? $b["assign_type"] : 0,
"assign_type"=>$b["pur_s"] !== "" ? 1: 2,
"remark"=>@$b["remark"] ? $b["remark"] : "",
"create_time"=>time() ,
"update_time"=>time() ,
......@@ -238,11 +238,10 @@ class InquiryItemsModel extends Model
}
}
#日志
\App\Model\OpLogModel::log([
'types'=>1,
'relation_id'=>$b["inquiry_id"],
'relation_id'=>$inquiryItemsId, #明细id
'relation_sn'=>(new InquiryModel())->FindInquirySn($b["inquiry_id"]),
'content'=>'批量导入询价',
'create_uid'=>$b['user_id'],
......@@ -285,7 +284,7 @@ class InquiryItemsModel extends Model
"target_price"=>@$b["target_price"] ? $b["target_price"] : 0,
"delivery_time"=>@$b["delivery_time"] ? $b["delivery_time"] : "",
"batch"=>@$b["batch"] ? $b["batch"] : "" ,
"assign_type"=>@$b["assign_type"] ? $b["assign_type"] : 2,
"assign_type"=>@$b["pur_s"] != "" ? 1: 2,
"remark"=>@$b["remark"] ? $b["remark"] : "",
"flag"=>0, #重新自动报价
"create_time"=>time() ,
......@@ -313,6 +312,16 @@ class InquiryItemsModel extends Model
}
}
#修改询价日志
\App\Model\OpLogModel::log([
'types'=>1,
'relation_id'=>$inquiry_items_id, #明细id
'relation_sn'=>(new InquiryModel())->FindInquirySn($b["inquiry_id"]),
'content'=>'修改询价,型号:'.$updateArr["goods_name"]." 品牌名称:".$updateArr["brand_name"]." 分类名称:".$updateArr["class_id2_name"]." 询价数量:".$updateArr["inquiry_number"],
'create_uid'=>$b['user_id'],
'create_name'=>$b["user_name"],
]);
$con->commit();
return [0,"修改成功"];
}catch (\Exception $e) {
......@@ -446,13 +455,14 @@ class InquiryItemsModel extends Model
$temp = [];
$c = 0;
foreach ($v as $a=>$b){
if ($a >=7) continue;
if (empty(trim($b))) $c ++;
$temp[$filer[$a]] = trim($b);
}
if ($c == count($v)) continue;
array_push($goodsInfo,$temp);
}
if (count($goodsInfo) == 1) return [1, '询价信息不全'];
if (count($goodsInfo) == 0) return [1, '询价信息不全'];
#验证数据
$CommonModel = new CommonModel();
......
......@@ -99,8 +99,8 @@ class InquiryItemsReportModel extends Model
$name = 'sale_report_'.time().'.pdf';
PDF::loadHTML($html)
// ->setPaper('a4', 'landscape') //横列
->setPaper('a4', 'portrait') //竖列
->setPaper('a4', 'landscape') //横列
//->setPaper('a4', 'portrait') //竖列
->setWarnings(false)
->save('pdf/'.$name);
......@@ -121,7 +121,8 @@ class InquiryItemsReportModel extends Model
$temp["price_rmb"] = @$data["price_rmb"] ? $data["price_rmb"] : 0;
$currency = @$data["currency"] ? $data["currency"] : 1; #报价币种
$inquiryItem = (new InquiryItemsModel())->select("inquiry_id")->where("id",$inquiry_items_id)->first()->toArray();
$InquiryItemsModel = new InquiryItemsModel();
$inquiryItem = $InquiryItemsModel->select("inquiry_id")->where("id",$inquiry_items_id)->first()->toArray();
$inquiry= (new InquiryModel())->select("currency")->where("id",$inquiryItem["inquiry_id"])->first()->toArray();
$mainCurrency = $inquiry["currency"]; #询价币种
$rate = (new CommonModel())->getRate("美元"); #获取美元汇率
......@@ -137,6 +138,9 @@ class InquiryItemsReportModel extends Model
(new QuoteModel())->where("id",$data["quote_id"])->update(["status"=>$data["status"]]); #更新报价选中
#更新询价明细表状态
$InquiryItemsModel->where("id",$inquiry_items_id)->update(["status"=>$data["status"] == 2 ? 3:5]);
return [0,"成功"];
}
/*
......
......@@ -47,20 +47,20 @@ class InquiryModel extends Model
}
switch ($k) {
case "inquiry_sn":
$query->where('a.' . $k, '=', $v);
$query->whereRaw('lie_a.'.$k.' like "%' . $v . '%" ');
break;
case "inquiry_id":
$query->where('a.id', '=', $v);
break;
case "goods_name":
case "brand_name":
$query->whereRaw('lie_b.'.$k.' like "' . $v . '%" ');
$query->whereRaw('lie_b.'.$k.' like "%' . $v . '%" ');
break;
case "customer_name":
$query->whereRaw('lie_a.user_name like "' . $v . '%" ');
break;
case "status":
$query->where('b.status', '=', $v);
$query->whereRaw('lie_b.status in ('.rtrim($v,",").')');
break;
case "create_uid":
$query->where('a.create_uid', '=', $v);
......@@ -109,15 +109,16 @@ class InquiryModel extends Model
//getSql("rfq");
if (!$list) return [20001, '没有数据'];
$QuoteModel = new QuoteModel();
$InquiryItemsUrgeModel = new InquiryItemsUrgeModel;
$InquiryItemsAssignModel = new InquiryItemsAssignModel();
$Redis = \RedisDB::connection();
foreach ($list['data'] as $k => &$v) {
$inquiry_items_id = $v["id"]; #明细id
//报价
$v['status_val'] = InquiryMap::$status[$v["status"]];
if ($v["status_val"] == "已报价") {
$count = $QuoteModel->where("inquiry_items_id", $v["id"])->whereIn("status", QuoteMap::$status_used)->count();
$count = $QuoteModel->where("inquiry_items_id", $inquiry_items_id)->whereIn("status", QuoteMap::$status_used)->count();
$v['status_val'] = $v['status_val'] . "(" . $count . ")";
}
......@@ -152,6 +153,15 @@ class InquiryModel extends Model
$v["quote_price"] = $lowerPrice;
}
#查询指定采购
$v["assign_name"] = "";
if ($v["assign_type"] == 1){
$assign = $InquiryItemsAssignModel->select(DB::Raw("GROUP_CONCAT(assign_name) assign_name"))->where("inquiry_items_id",$inquiry_items_id)->first();
if ($assign){
$v["assign_name"] = $assign->assign_name;
}
}
// 在Redis集合中检查是否有新的报价
if ($export == 0){
$res = $Redis->SISMEMBER('frq_quote_urge', $v['id']);
......@@ -379,6 +389,7 @@ class InquiryModel extends Model
"status" => 1, #启用
"remark" => $input["remark"],
"delivery_place" => $input["delivery_place"],
"currency" => $input["delivery_place"],
"user_types" => $input["user_types"], //询价客户类型: 1 个人 2 公司
"create_time" => time(),
"update_time" => time(),
......@@ -387,6 +398,8 @@ class InquiryModel extends Model
if ($input["user_types"] == 1) { #个人询价
if ($user[0]["value"] == 0) { #客户id是0,新建客户
$userId = (new InquiryUsersModel())->insertGetId(["create_uid" => $input["user_id"], "user_name" => $user[0]["name"], "create_time" => time()]);
}else{
$userId = $user[0]["value"];
}
$data["user_id"] = $userId;
$data["user_name"] = $user[0]["name"];
......
......@@ -685,9 +685,24 @@ class QuoteModel extends Model
if (!$id) return [-1, '参数缺失'];
try {
$rqpConn = DB::connection('rfq');
$res = $this->where('id', $id)->update(['status' => $status, 'update_time'=>time()]);
$quote_info = $this->find($id);
#更新询价明细表状态
$inquiry_items_id = $quote_info["inquiry_items_id"];
$sql = "select status from lie_quote where inquiry_items_id=$inquiry_items_id and status in (1,2,3) and id not in ($id)";
$has =$rqpConn->select($sql);
$check = 1;
if ($has){
$check = 0;
}
if($check){
(new InquiryItemsModel())->where("id",$quote_info["inquiry_items_id"])->update(["status"=>$status]);
}
$data = [];
$data['types'] = 1;
$data['relation_id'] = $id;
......
......@@ -19,7 +19,7 @@ layui.config({
data:$("#sku_init").val() == "" ? []:JSON.parse($("#sku_init").val()) ,
remoteMethod: function(val, cb, show){
//这里如果val为空, 则不触发搜索
if(!val){
if(!val || val.length <3 ){
return cb([]);
}
$.ajax({
......@@ -40,9 +40,7 @@ layui.config({
}
,on: function (data) {
var arr = data.arr
if (arr.length == 0){
console.log("数组为空")
}else {
if (arr.length > 0){
console.log(data.arr[0].name)
$("#sku_s").val(data.arr[0].name);
}
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>ichunt.com--{$data['order_sn']}</title>
<style type="text/css" media="screen">
*{ font-family: "simsun"; font-weight: normal;margin:0px;padding:0px; }
.pdf-box{margin:0 auto;font-size: 14px;color:#333;padding:10px;box-sizing: border-box;}
.header{ text-align: center;font-size: 28px;color:#000; position: relative;}
.header img{width:120px;position: absolute;left:60px;top:10px;}
.bjdx{background: #ccffff;font-size: 28px;color:#0000DA;text-align: center;}
table{width:100%;border-collapse: collapse;}
table, th, td{border: 1px solid #000;}
table td{padding:10px;}
table td b,.table-tips b,.footer b{font-weight: bold;}
.table-tips{font-weight: bold;padding:20px 0;font-weight: normal;}
.footer{position: relative;}
.footer .pr30{position: relative;left:80px;}
.footer .pr60{position: relative;left:107px;}
.footer img{position: absolute;left: 600px;top: 40px;}
.xhhez{max-width:150px;white-space:normal; word-break:break-all;}
</style>
</head>
<body>
<div class="pdf-box" >
<div class="header" >
<img src="https://static.ichunt.com/dist/res/home/images/new_logo.png" style="float:left;">
<p class="company">
深圳市猎芯科技有限公司<br/>
ICHUNT TECHNOLOGY CO.,LTD
</p>
</div>
<div class="bjdx">报 价 单/ QUOTATION</div>
<div class="table1">
<table>
<tr>
<td colspan="2"></td>
<td colspan="2">Date:2020-7-14</td>
</tr>
<tr>
<td><b>Attn</b>:深圳市度申科技有限公司</td>
<td><b>C.C</b>:李美媛</td>
<td><b>Fax</b>:</td>
<td><b>Tel</b>: 0755-29823982</td>
</tr>
<tr>
<td><b>From</b>:深圳市猎芯科技有限公司</td>
<td><b>C.C</b>:杨娟</td>
<td><b>Fax</b>:18529505446</td>
<td><b>Tel</b>: 0755-23485782-8031</td>
</tr>
</table>
</div>
<div class="table-tips">
很高兴为您提供我们最优惠的价格和货期,请参看如下:<br/>
<b>We are pleased to quote our best price and delivery terms for your requirement as following:</b>
</div>
<div class="table2" >
<table style="width:100%!important;table-layout:fixed;" >
<tr>
<td>客户型号 Cust PartNo</td>
<td >原厂型号 Mfr PartNo</td>
<td >品牌 Mfr Name</td>
<td >报价(RMB含税)Quoted Price (RMB with 13%VAT,freight fee to factory and import fee )</td>
<td >报价(美金)QuotedPrice In USD</td>
<td>数量 Quantity</td>
<td>金额</td>
<td>货期 Std LeadTime</td>
<td>产品类型 Prod Type</td>
<td>DATE CODE</td>
</tr>
<tr>
<td><div class="xhhez">TLV70712PDQNRasdasdasdasdasdsa</div></td>
<td><div class="xhhez">TLV70712PDQNRasdasdasdasdasdsa</div></td>
<td><div class="xhhez">TLV70712PDQNRasdasdasdasdasdsa</div></td>
<td>0.692</td>
<td></td>
<td>500</td>
<td>346</td>
<td>6-9DAYS</td>
<td></td>
<td>5年内</td>
</tr>
<tr>
<td></td>
<td></td>
<td colspan="2"></td>
<td></td>
<td></td>
<td><b>TOTAL:</b></td>
<td colspan="2"><b>2,431.00</b></td>
<td></td>
</tr>
</table>
</div>
<div class="footer" style="padding-top: 20px;">
<img src="./contract.png" width='150' height='150'>
<b style="font-size: 18px;font-weight: bold;color:#000;"> 条款和说明:<br>
Terms and conditions:</b>
<br>1.> <span class="pr30">付款方式:月结30天</span>
<br><span class="pr60">Payment Terms:</span>
<br>2.> <span class="pr30">参考货期仅供参考,需下单后以原厂回复为准。</span>
<br><b class="pr60">Leadtime is for reference only, order actual delivery date is subjected to Supplier’s final <br/>confirmation. </b>
<br>3.> <span class="pr30">所有库存均以我司确认为准。</span>
<br><b class="pr60">Available to sell stock is open to all customers based on our confirmation. </b>
<br>4.> <b class="pr30">Subject to ICHUNT TECHNOLOGY' terms </b>
</div>
</div>
</body>
</html>
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