v1.0

parent 367dad68
......@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use App\Jobs\JopExportAbnormlList;
use App\Jobs\JopExportGoodsList;
use App\Jobs\JopExportOrderList;
use App\Jobs\JopExportPutawayList;
use App\Model\CommonModel;
use App\Model\ExportModel;
use App\Model\GoodsAuditModel;
......@@ -52,7 +53,7 @@ class ApiController extends Controller
//订单列表导出
private function ApiOrderListExport($request, $id){
$data= $request->input();
$data['picking_type'] = 2; //寄售类型
$data['is_consign'] = 1; //供应商代发
$id = (new UploadLogModel())->addLog($request->account_id,1,$data);
if(!$id) return Export(20003,'任务推送失败');
dispatch(new JopExportOrderList($id));
......@@ -65,7 +66,7 @@ class ApiController extends Controller
//退货列表(寄售)
private function ApiAbnormalList($request, $id){
$data = $request->input();
$data['picking_type'] = 2; //寄售类型
$data['is_consign'] = 1; //供应商代发
(new ServerPurModel($request->appid,$request->key))->AbnormalList($data);
}
//退货详情
......@@ -75,12 +76,31 @@ class ApiController extends Controller
//退货列表导出
private function ApiAbnormalListExport($request, $id){
$data= $request->input();
$data['picking_type'] = 2; //寄售类型
$data['is_consign'] = 1; //供应商代发
$id = (new UploadLogModel())->addLog($request->account_id,1,$data);
if(!$id) return Export(20003,'任务推送失败');
dispatch(new JopExportAbnormlList($id));
Export(0,$id);
}
//入库列表
private function ApiPutawayList($request, $id){
$data = $request->input();
$data['is_consign'] = 1; //供应商代发
(new ServerPurModel($request->appid,$request->key))->PutawayList($data);
}
//入库列表详情
private function ApiPutawayDetail($request, $id){
(new ServerPurModel($request->appid,$request->key))->PutawayDetail($request->input());
}
//入库列表导出
private function ApiPutawayListExport($request, $id){
$data= $request->input();
$data['is_consign'] = 1; //供应商代发
$id = (new UploadLogModel())->addLog($request->account_id,1,$data);
if(!$id) return Export(20003,'任务推送失败');
dispatch(new JopExportPutawayList($id));
Export(0,$id);
}
//获取对账单列表
private function ApiAccountCheckingList($request, $id){
(new ServerFinanceModel($request->appid,$request->key))->accountCheckingList($request->input());
......@@ -147,6 +167,4 @@ class ApiController extends Controller
}
}
}
......@@ -140,14 +140,14 @@ class WebController extends Controller
$data['db'] = $db == "" ? "yunxin":$db;
return view('pure', $data);
}
//财务对账列表
//入库列表
private function PutawayList($request,$data,$id){
$data['title']='对账列表';
$data['title']='入库列表';
return view('pc',$data);
}
//财务对账列表-明细
private function PutawayDetail($request,$data,$id){
$data['title']='对账详情';
$data['title']='入库详情';
return view('pc',$data);
}
......
<?php
namespace App\Jobs;
use App\Jobs\Job;
use App\Model\ExportModel;
use App\Model\Server\ServerPurModel;
use App\Model\SupplierAccountModel;
use App\Model\UploadLogModel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Support\Facades\Storage;
use RedisDB;
use DB;
class JopExportPutawayList extends Job implements ShouldQueue
{
use InteractsWithQueue, SerializesModels;
private $id;
public function __construct($id)
{
$this->id=$id;
}
/**
* Execute the job.
* @return void
*/
public function handle()
{
$UploadLogModel=new UploadLogModel();
$LogInfo=$UploadLogModel->LogInfo($this->id);
$log = json_decode($LogInfo['log'],true);
$query = json_decode($LogInfo['remark'],true);
$UploadLogModel->UpdateLogArr($this->id,'开始处理任务',1,$log);
#建立临时文件
$filename=date('Y-m-d-H-i-s') . '-' . uniqid() . '.csv';
$filePath = storage_path().DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.$filename;
$x=fopen($filePath,'a'); //不存在则创建
$Arr = ["入库单号","采购单号","入库单金额","结算币种","结算方式","创建时间"]; // 表头
foreach ($Arr as $k=>$v){
$Arr[$k]=iconv('utf-8','gbk//IGNORE',$v);
}
fputcsv($x,$Arr); //写入表头
#导出查询数据
$account = (new SupplierAccountModel())->select("appid","key")->where("id",$LogInfo['create_uid'])->first();
$query['p'] = 1;
$query['limit'] = 1000;
$res = (new ServerPurModel($account->appid,$account->key,$LogInfo['extend']))->PutawayList($query,2);
if (!count($res['data']) ){
$UploadLogModel->UpdateLogArr($this->id,'没有数据',3,$log);
return true;
}
$count = ceil($res['count']/1000);
for ($p = 1; $p < $count + 1; $p++) {
sleep(1);
$query['p'] = $p;
$query['limit'] = 1000;
$list = (new ServerPurModel($account->appid,$account->key,$LogInfo['extend']))->PutawayList($query,2);
if ($list['code'] > 0){
break;
}
foreach ($list['data'] as $k=>&$v){
$out = [
'putaway_sn'=>$v['putaway_sn'],
'picking_sn'=>$v['picking_sn'],
'amount'=>$v['amount'],
'currency'=>$v['currency'],
'pay_type'=>$v['pay_type'],
'create_time'=>$v['create_time'],
];
foreach ($out as $k1=>&$v1){
$v1= iconv('utf-8', 'gbk', $v1);
}
fputcsv($x,$out);
}
}
$UploadFileModel=new UploadLogModel();
$Url=$UploadFileModel->SaveDownFile($filename);
fclose($x);
unlink($filePath);
if(!$Url){
$UploadLogModel->UpdateLogArr($this->id,'导出失败',3,$log);
return true;
}else{
$UploadLogModel->where('id',$this->id)->update(['file_path'=>$Url]);
$UploadLogModel->UpdateLogArr($this->id,'任务完成',2,$log,['file_path'=>$Url]);
return true;
}
}
}
......@@ -61,6 +61,13 @@ class ServerPurModel
public function AbnormalDetail($data,$type =1){
return $this->push( '/thridapi/AbnormalDetail',$data,$type);
}
//获取退货列表
public function PutawayList($data,$type =1){
return $this->push( '/thridapi/PutawayList',$data,$type);
}
//获取退货明细
public function PutawayDetail($data,$type =1){
return $this->push( '/thridapi/PutawayDetail',$data,$type);
}
}
\ No newline at end of file
;!function () {
window.app = {
init: function () {
this.tableList(1);
//刷新搜索
$("#search").click(function () {
tableList(1)
})
},
tableList:function (page) {
var res = ajax_push( '/api/ApiPutawayDetail',{'p':page,'putaway_id':$("#putaway_id").val()})
if (res.code == 0) {
var other = res.other;
$(".picking_sn").html(other.picking_sn);
$(".putaway_sn").html(other.putaway_sn);
$(".create_time").html(other.create_time);
$(".pay_type").html(other.pay_type);
$(".amount").html(other.amount);
$(".currency").html(other.currency);
var html;
for (i = 0; i < res.data.length; i++) {
var s = res.data[i];
html += "<tr class=\"you\"> " +
"<td><span class=\"t1\">"+s.goods_name+"</span></td>" +
"<td><span class=\"t1\">"+s.brand_name+"</span></td>" +
"<td><span class=\"t1\">"+s.encap+"</span></td>" +
"<td><span class=\"t1\">"+s.packing_id+"</span></td>" +
"<td><span class=\"t1\">"+s.mpq+"</span></td>" +
"<td><span class=\"t1\">"+s.plan_number+"</span></td>" +
"<td><span class=\"t1\">"+s.putaway_number+"</span></td>" +
"<td><span class=\"t1\">"+s.initial_price+"</span></td>" +
"</tr>"
}
$("#shopListContent").html(html)
layui.laypage.render({
elem: 'pagination',
theme: '#1080d0',
count: res.count,
groups:10,
curr: page,
jump:function (obj, first) {
if(!first){
this.tableList(obj.curr)
}
}
});
} else {
alert_err(res.msg)
return false;
}
}
}, $(function () {
app.init();
})
}();
\ No newline at end of file
......@@ -42,12 +42,12 @@
,first: true //不显示首页
,last: false //不显示尾页
,cols: [[
{field:'order_sn', title: '订单号',align:'center'}
,{field:'create_time', title: '创建时间',align:'center'}
,{field:'picking_amount', title: '订单金额',align:'center'}
{field:'putaway_sn', title: '入库单号',align:'center'}
,{field:'picking_sn', title: '采购单号',align:'center'}
,{field:'amount', title: '入库单金额',align:'center'}
,{field:'currency', title: '结算币种',align:'center'}
,{field:'pay_type', title: '结算方式',align:'center'}
,{field:'status', title: '付款状态',align:'center'}
,{field:'create_time', title: '创建时间',align:'center'}
,{field:'cahe', title: '操作',templet:'#cahe',width:80,align:'center', fixed: 'right'}
]]
,id:'Abnormal'
......@@ -59,8 +59,8 @@
}
});
},
export:function (){ //商品列表导出
common_export('/api/ApiOrderListExport',formJson('form1'))
export:function (){ //导出
common_export('/api/ApiPutawayListExport',formJson('form1'))
}
}, $(function () {
app.init();
......
......@@ -110,7 +110,7 @@
{{--</dd> --}}-->
</dl>
</li>
<li class="<?php if( in_array($id,['OrderList','OrderDetail','AbnormalList','AbnormalDetail']) !== false ) echo "curr" ?>">
<li class="<?php if( in_array($id,['OrderList','OrderDetail','AbnormalList','AbnormalDetail','PutawayList','PutawayDetail']) !== false ) echo "curr" ?>">
<a href="javascript:;" class="bx">
<i class="iconfont icon-dingdanguanli- va-m"></i>
<span class="t1 lineBlock va-m">订单管理</span>
......@@ -127,7 +127,7 @@
</dd>
<dd class=" <?php if( in_array($id,['PutawayList','PutawayDetail']) !== false ) echo "curr" ?>">
<i class="line"></i>
<a href="/web/OrderList">入库列表(寄售)</a>
<a href="/web/PutawayList">入库列表(寄售)</a>
</dd>
<!--
{{--<dd class=" <?php if( in_array($id,['AbnormalList','AbnormalDetail']) !== false ) echo "curr" ?>">--}}
......
<div class="lx-content-r fr">
<div class="tit-bar">
<a href="">订单管理</a>
<span>&gt;</span>
<a class="text" href="">{{ $title }}</a>
</div>
<div class="con-section shop-list">
<p class="text">{{ $title }}</p>
<div class="detail-list">
<div class="lineBlock va-m mr100">
<span class="lineBlock t1">采购单号:</span>
<span class="lineBlock t2 picking_sn"></span>
</div>
<div class="lineBlock va-m mr126">
<span class="lineBlock t1">入库单号:</span>
<span class="lineBlock t2 putaway_sn"></span>
</div>
<div class="lineBlock va-m mr126">
<span class="lineBlock t1">入库时间:</span>
<span class="lineBlock t2 create_time"></span>
</div>
<div class="mt20">
<div class="lineBlock va-m mr26">
<span class="lineBlock t3">结算方式:</span>
<span class="lineBlock t4 pay_type"></span>
</div>
<div class="lineBlock va-m mr40">
<span class="lineBlock t3">入库金额:</span>
<span class="lineBlock t4 amount"></span>
</div>
<div class="lineBlock va-m">
<span class="lineBlock t3">结算币种:</span>
<span class="lineBlock t4 currency"></span>
</div>
</div>
</div>
<div class="table-list" id="shopList">
<table>
<tr>
<th>型号<b></b></th>
<th>品牌<b></b></th>
<th>封装</th>
<th>包装方式</th>
<th>标准包装量(MPQ)</th>
<th>数量</th>
<th>收库数量</th>
<th>单价</th>
</tr>
<tbody id="shopListContent">
</tbody>
</table>
</div>
<div class="pagination-with" id="pagination"></div>
</div>
</div>
<!--隐藏域-->
<input type="hidden" value="{{ @$_GET['id'] }}" id="putaway_id">
\ No newline at end of file
......@@ -9,22 +9,16 @@
<form action="" id="form1">
<div class="search-bar">
<div class="lineBlock input-inline va-m">
<label class="tag">单号:</label>
<input type="text" class="inp w180" name="order_sn" placeholder="输入订单号">
<label class="tag">入库单号:</label>
<input type="text" class="inp w180" name="putaway_sn" placeholder="">
</div>
<div class="lineBlock input-inline va-m">
<label class="tag">号:</label>
<input type="text" class="inp w180" name="goods_name" placeholder="输入型号">
<label class="tag">采购单号:</label>
<input type="text" class="inp w180" name="picking_sn" placeholder="">
</div>
<div class="lineBlock input-inline va-m">
<label class="tag">状态:</label>
<select class="sel w180" name="status">
<option value=""></option>
<option value="-10">已取消</option>
<option value="-2">处理中</option>
<option value="6">部分收货</option>
<option value="10">完全收货</option>
</select>
<label class="tag">型号:</label>
<input type="text" class="inp w180" name="goods_name" placeholder="">
</div>
<div class="lineBlock input-inline va-m">
<label class="tag">下单时间:</label>
......@@ -57,7 +51,7 @@
</div>
<script type="text/html" id="cahe">
<a class="btn btn-xs btn-outline btn-danger pointer" href="/web/OrderDetail?id=@{{ d.order_id }}" >明细</a>
<a class="btn btn-xs btn-outline btn-danger pointer" href="/web/PutawayDetail?id=@{{ d.putaway_id }}" >明细</a>
</script>
</div>
......
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