Commit 4e2b4e09 by 杜文军

导出已领取询价单

parent 9a1ddb07
......@@ -177,6 +177,12 @@ class ApiController extends Controller
private function ApiInquiryExport($input){
(new ExportModel())->InquiryExport($input,$this->user_id);
}
private function ApiReceiveInquiryExport($input)
{
(new ExportModel())->MyReceiveInquiryExport($input,$this->user_id);
}
//生成报价pdf
private function ApiOfferPdf($request){
(new CommonModel())->Pdf();
......
......@@ -41,11 +41,55 @@ class ServerController extends Controller
$server->addMethod('InquiryServer',$this);
$server->handle();
}
public function InquiryServer($info){
$res= (new InquiryModel())->getList(json_decode($info,true),1);
return ExportLayuiReturn($res);
}
public function MyReceiveInquiryExport()
{
$server=new Hprose\Http\Service();
$server->addMethod('MyReceiveInquiryServer',$this);
$server->handle();
}
public function MyReceiveInquiryServer($info){
$params = json_decode($info,true);
$inquiry_item_ids = explode(",", $params['inquiry_item_ids']);
$inquiry_item_ids = array_values(array_filter($inquiry_item_ids));
$data = [];
$InquiryItemsModel = new InquiryItemsModel();
$inquire_item_list = $InquiryItemsModel->GetInquireItemsListByIds($inquiry_item_ids);
if ($inquire_item_list && is_array($inquire_item_list)){
$inquiry_ids = array_column($inquire_item_list, 'inquiry_id');
$InquiryModel = new InquiryModel();
$inquire_list = $InquiryModel->GetInquiryListByIds($inquiry_ids);
$inquire_info_map = array_combine(array_column($inquire_list, 'id'), $inquire_list);
foreach ($inquire_item_list as $inquire_item_info){
$data[] = [
"inquiry_item_id" => (int) $inquire_item_info['id'],
"goods_name" => (string) $inquire_item_info['goods_name'],
"brand_name" => (string) $inquire_item_info['brand_name'],
"inquiry_number" => (int) $inquire_item_info['inquiry_number'],
"target_price" => $inquire_item_info['target_price'],
"delivery_place" => (int) $inquire_info_map[$inquire_item_info['inquiry_id']]['delivery_place'],
"delivery_time" => (int) $inquire_item_info['delivery_time'],
"supplier_name" => '',
"currency" => '',
"price_origin" => '',
"price_rmb" => '',
"price_other" => '',
"batch" => '',
"quote_delivery_time" => '',
];
}
}
$res = [0, '成功', $data, count($inquiry_item_ids)];
return ExportLayuiReturn($res);
}
//下载pdf文件
private function DownPdf($input, $id){
$filename = base_path()."/public/pdf/".$input["file_name"];
......
......@@ -63,5 +63,24 @@ class ExportModel
echo self::push($data);
}
public function MyReceiveInquiryExport($input,$create_uid){
$input["is_export"] = 1; #导出状态
$header = ["明细id", "型号", "品牌", "数量", "目标价", "交货地", "交货时间", "供应商", "报价币种", "单价", "含税价格", "采购费", "批次", "交期"];
$file_name = "已领取的询价";
$data = [
"type"=> 2, # 类型 1:模板调用 2: api回调
"source_items_id"=>config("website.export_source_items_id"), #来源明细id,必填
"file_name"=> $file_name,
"excel_suf" => "csv", #导出文件格式 csv,xls
"header"=> $header,
"query_param"=>$input, #查询参数
"callbackurl"=> $this->frqApiUrl."/server/MyReceiveInquiryExport", #rpc回调网址
"callbackfuc"=>"InquiryServer", #rpc回调函数
"create_uid"=> $create_uid, #创建人id
];
echo self::push($data);
}
}
\ No newline at end of file
......@@ -25,6 +25,12 @@ class InquiryItemsModel extends Model
return strtotime(parent::fromDateTime($value));
}
public function GetInquireItemsListByIds($ids)
{
return $this->whereIn("id", $ids)->get()->toArray();
}
//生成报价单详情
public function ItemsOfferDetail($inquiry_id)
{
......
......@@ -20,6 +20,12 @@ class InquiryModel extends Model
protected $primaryKey = 'id';
public $timestamps = false;
public function GetInquiryListByIds($ids)
{
return $this->whereIn("id", $ids)->get()->toArray();
}
/**
* 询价列表
*/
......
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