|
|
@@ -190,9 +190,10 @@ class Whlabel extends Start_Controller
|
|
|
$this->_excelrjs();
|
|
|
} else if($arg == 'excelctjs'){
|
|
|
$this->_excelctjs();
|
|
|
- }else if($arg == 'excelcrjs'){
|
|
|
- $this->_excelcrjs();
|
|
|
- }else if($arg == "w_t_cs"){
|
|
|
+ }else if ($arg == 'exceljxcjs') //进销存信息导出
|
|
|
+ {
|
|
|
+ $this->_exceljxcjs();
|
|
|
+ } else if($arg == "w_t_cs"){
|
|
|
$this->_w_t_cs(); //首页
|
|
|
}else {
|
|
|
$this->_index();
|
|
|
@@ -7704,22 +7705,6 @@ class Whlabel extends Start_Controller
|
|
|
$list[] = array('warehouse' => $warehouse, 'sku' => $value['sku'], 'title' => $value['title'], 'time' => date('Y-m-d H:i:s', $value['enter']), 'number' => $g);
|
|
|
}
|
|
|
|
|
|
- // $list = [
|
|
|
- // [
|
|
|
- // 'warehouse'=>"许昌仓",
|
|
|
- // 'sku'=>"123456",
|
|
|
- // 'title'=>"商品名称",
|
|
|
- // 'time'=>"2021-01-01 12:00:00",
|
|
|
- // 'number'=>"121-111121"
|
|
|
- // ],
|
|
|
- // [
|
|
|
- // 'warehouse'=>"美仓",
|
|
|
- // 'sku'=>"353456",
|
|
|
- // 'title'=>"商品名称1",
|
|
|
- // 'time'=>"2021-01-01 12:01:00",
|
|
|
- // 'number'=>"121-1333121"
|
|
|
- // ],
|
|
|
- // ];
|
|
|
if(empty($list)){
|
|
|
exit(json_encode(array('code' => 0, 'msg' => '没有合适数据')));
|
|
|
}else{
|
|
|
@@ -7735,7 +7720,16 @@ class Whlabel extends Start_Controller
|
|
|
array_unshift($final_list,[
|
|
|
$title,"","","",""
|
|
|
]);
|
|
|
- exit(json_encode(array('code' => 1,'msg'=>"获取成功", 'data' => $final_list,'title'=>$title)));
|
|
|
+ $merges = [
|
|
|
+ [
|
|
|
+ "s"=>["r"=>0,"c"=>0],
|
|
|
+ "e"=>["r"=>0,"c"=>4]
|
|
|
+ ]
|
|
|
+ ];
|
|
|
+ $cols = [
|
|
|
+ ["wch"=>"10"],["wch"=>"10"],["wch"=>"10"],["wch"=>"10"],["wch"=>"10"],
|
|
|
+ ];
|
|
|
+ exit(json_encode(array('code' => 1,'msg'=>"获取成功",'data'=>['data' => $final_list,'title'=>$title,'cols' => $cols,'merges' => $merges])));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -8033,10 +8027,6 @@ class Whlabel extends Start_Controller
|
|
|
if(empty($final_list)){
|
|
|
exit(json_encode(array('code' => 0, 'msg' => '没有合适数据')));
|
|
|
}else{
|
|
|
- // $final_list = [];
|
|
|
- // foreach($list as $v){
|
|
|
- // $final_list[] = array_values($v);
|
|
|
- // }
|
|
|
$end_list = [];
|
|
|
foreach($final_list as $v){
|
|
|
$end_list[] = array_values($v);
|
|
|
@@ -8047,32 +8037,23 @@ class Whlabel extends Start_Controller
|
|
|
"仓库","供应商","SKU","商品名称","商品中文","标签","订单号","订单编码","运单号",$tl . "时间(中国时间)"
|
|
|
]);
|
|
|
array_unshift($end_list,[
|
|
|
- $title,"","","",""
|
|
|
+ $title,"","","","","","","","",""
|
|
|
]);
|
|
|
- exit(json_encode(array('code' => 1,'msg'=>"获取成功", 'data' => $end_list,'title'=>$title)));
|
|
|
+
|
|
|
+ $merges = [
|
|
|
+ [
|
|
|
+ "s"=>["r"=>0,"c"=>0],
|
|
|
+ "e"=>["r"=>0,"c"=>9]
|
|
|
+ ]
|
|
|
+ ];
|
|
|
+ $cols = [
|
|
|
+ ["wch"=>"10"],["wch"=>"10"],["wch"=>"20"],["wch"=>"40"],["wch"=>"40"],["wch"=>"20"],["wch"=>"10"],["wch"=>"10"],["wch"=>"10"],["wch"=>"15"],
|
|
|
+ ];
|
|
|
+ exit(json_encode(array('code' => 1,'msg'=>"获取成功",'data'=>[
|
|
|
+ 'data' => $end_list,'title'=>$title,'merges'=>$merges,'cols'=>$cols
|
|
|
+ ] )));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- // $title = date('Y-m-d', $ktime) . '至' . date('Y-m-d', $jtime) . $tl . '详情';
|
|
|
- // $titlename = "<table border=1>
|
|
|
- // <tr><th colspan='10' align='center'><h3>" . $title . "<h3></th></tr>
|
|
|
- // <tr align='center'>
|
|
|
- // <td>仓库</td>
|
|
|
- // <td>供应商</td>
|
|
|
- // <td>SKU</td>
|
|
|
- // <td>商品名称</td>
|
|
|
- // <td>商品中文</td>
|
|
|
- // <td>标签</td>
|
|
|
- // <td>订单号</td>
|
|
|
- // <td>订单编码</td>
|
|
|
- // <td>运单号</td>
|
|
|
- // <td>" . $tl . "时间(中国时间)</td>
|
|
|
- // </tr>
|
|
|
- // </table>";
|
|
|
- // $filename = $title . ".xls";
|
|
|
- // $tail = "";
|
|
|
- // $this->excel->get_fz2($final_list, $titlename, $filename, $tail);
|
|
|
} else if ($type == 5) {
|
|
|
$info_list = $this->whlabel->find_all($where, 'warehouse,purchase,sku,title,features,label,outk', $order_str);
|
|
|
|
|
|
@@ -8118,36 +8099,21 @@ class Whlabel extends Start_Controller
|
|
|
"仓库","供应商","SKU","商品名称","商品中文","标签", $tl . "时间(中国时间)"
|
|
|
]);
|
|
|
array_unshift($final_list,[
|
|
|
- $title,"","","",""
|
|
|
+ $title,"","","","","","",
|
|
|
]);
|
|
|
- exit(json_encode(array('code' => 1,'msg'=>"获取成功", 'data' => $final_list,'title'=>$title)));
|
|
|
- }
|
|
|
-
|
|
|
- // $title = date('Y-m-d', $ktime) . '至' . date('Y-m-d', $jtime) . $tl . '详情';
|
|
|
- // $titlename = "<table border=1>
|
|
|
- // <tr><th colspan='6' align='center'><h3>" . $title . "<h3></th></tr>
|
|
|
- // <tr align='center'>
|
|
|
- // <td>仓库</td>
|
|
|
- // <td>供应商</td>
|
|
|
- // <td>SKU</td>
|
|
|
- // <td>商品名称</td>
|
|
|
- // <td>商品中文</td>
|
|
|
- // <td>标签</td>
|
|
|
- // <td>" . $tl . "时间(中国时间)</td>
|
|
|
- // </tr>
|
|
|
- // </table>";
|
|
|
- // $filename = $title . ".xls";
|
|
|
- // $tail = "";
|
|
|
- // $this->excel->get_fz2($info_list, $titlename, $filename, $tail);
|
|
|
+ $merges = [
|
|
|
+ [
|
|
|
+ "s"=>["r"=>0,"c"=>0],
|
|
|
+ "e"=>["r"=>0,"c"=>6]
|
|
|
+ ]
|
|
|
+ ];
|
|
|
+ $cols = [
|
|
|
+ ["wch"=>"10"],["wch"=>"10"],["wch"=>"20"],["wch"=>"40"],["wch"=>"40"],["wch"=>"15"],["wch"=>"15"]
|
|
|
+ ];
|
|
|
+ exit(json_encode(array('code' => 1,'msg'=>"获取成功",'data'=>[ 'data' => $final_list,'title'=>$title,'merges'=>$merges,'cols'=>$cols])));
|
|
|
+ }
|
|
|
+
|
|
|
} else {
|
|
|
- /**
|
|
|
- $info_list = $this->whlabel->find_all($where.$sidwhere,'*');
|
|
|
- $rows = array();$list = array();
|
|
|
- foreach ($info_list as $key=>$value)
|
|
|
- {
|
|
|
- $rows[strtolower($value['sku']).'warehouse'.$value['warehouse']] = $value;//所有数据sku
|
|
|
- }
|
|
|
- **/
|
|
|
$wh = array();
|
|
|
$w = $this->warehouse->find_all('1=1', 'id,title');
|
|
|
foreach ($w as $v) {
|
|
|
@@ -8223,42 +8189,10 @@ class Whlabel extends Start_Controller
|
|
|
|
|
|
$features = str_replace(array('-163-', '-164-', '-165-', '-166-'), '-', $value['features']);
|
|
|
$features = explode('-', trim($features, '-'));
|
|
|
- // $pm = $classid;
|
|
|
- // foreach ($features as $k => $v) {
|
|
|
- // if ($v != 0) {
|
|
|
- // if (!isset($typeclass[$v])) {
|
|
|
- // continue;
|
|
|
- // }
|
|
|
- // if (isset($pm[$typeclass[$v]['classid']])) {
|
|
|
- // if (stripos($typeclass[$v]['zh'], '|') !== false) {
|
|
|
- // $tz = explode('|', $typeclass[$v]['zh']);
|
|
|
- // $pm[$typeclass[$v]['classid']] = $tz[0];
|
|
|
- // } else {
|
|
|
- // $pm[$typeclass[$v]['classid']] = $typeclass[$v]['zh'];
|
|
|
- // }
|
|
|
- // if (isset($jm[$typeclass[$v]['classid']])) {
|
|
|
- // if ($typeclass[$v]['jm']) {
|
|
|
- // $jm[$typeclass[$v]['classid']] = $typeclass[$v]['jm'];
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // $zh = implode(" ", $pm);
|
|
|
- // $zh = str_replace('自然色 ', '', trim($zh, ' '));
|
|
|
- // $zh = str_replace(array(' ', ' ', ' ', ' ', ' ', ' ', ' '), ' ', $zh);
|
|
|
- // $zh = preg_replace("/\r\n|\r|\n/", '', $zh);
|
|
|
- // $rows[$key]['features'] = $zh;
|
|
|
- // $jm = array_filter($jm); //去除空值
|
|
|
- // $jm = implode("-", $jm);
|
|
|
- // $rows[$key]['jm'] = $jm;
|
|
|
$rows[$key]['asd'] = $typeclass[$features[0]]['title'];
|
|
|
}
|
|
|
|
|
|
$tmp_list = $this->logic_whlabel->dataTran($rows,['pm','weight']);
|
|
|
- // echo "<pre>";
|
|
|
- // print_r($tmp_list);
|
|
|
- // die;
|
|
|
$final_list =[];
|
|
|
foreach($tmp_list as $k=>$v){
|
|
|
$final_list[] = [
|
|
|
@@ -8299,216 +8233,202 @@ class Whlabel extends Start_Controller
|
|
|
array_unshift($end_list,[
|
|
|
$title,"","","",""
|
|
|
]);
|
|
|
- exit(json_encode(array('code' => 1,'msg'=>"获取成功", 'data' => $end_list,'title'=>$title)));
|
|
|
- }
|
|
|
-
|
|
|
- // $titlename = "<table border=1>
|
|
|
- // <tr><th colspan='18' align='center'><h3>" . $title . "<h3></th></tr>
|
|
|
- // <tr align='center'>
|
|
|
- // <td>仓库</td>
|
|
|
- // <td>供应商</td>
|
|
|
- // <td>位置</td>
|
|
|
- // <td>库存编码</td>
|
|
|
- // <td>SKU</td>
|
|
|
- // <td>商品名称</td>
|
|
|
- // <td>商品中文</td>
|
|
|
- // <td>产品备注</td>
|
|
|
- // <td>说明</td>
|
|
|
- // <td>类型</td>
|
|
|
- // <td>入库总量</td>
|
|
|
- // <td>库存数量</td>
|
|
|
- // <td>销售数量</td>
|
|
|
- // <td>退货数量</td>
|
|
|
- // <td>占单数量</td>
|
|
|
- // <td>料号</td>
|
|
|
- // <td>重量</td>
|
|
|
- // <td>类目</td>
|
|
|
- // </tr>
|
|
|
- // </table>";
|
|
|
- // $filename = $title . ".xls";
|
|
|
- // $tail = "";
|
|
|
- // $this->excel->get_fz2($final_list, $titlename, $filename, $tail);
|
|
|
+ $merges = [
|
|
|
+ [
|
|
|
+ "s"=>["r"=>0,"c"=>0],
|
|
|
+ "e"=>["r"=>0,"c"=>6]
|
|
|
+ ]
|
|
|
+ ];
|
|
|
+ $cols = [
|
|
|
+ ["wch"=>"10"],["wch"=>"10"],["wch"=>"20"],["wch"=>"40"],["wch"=>"40"],["wch"=>"15"],["wch"=>"15"]
|
|
|
+ ];
|
|
|
+ exit(json_encode(array('code' => 1,'msg'=>"获取成功",'data'=>[
|
|
|
+ 'data' => $end_list,'title'=>$title,'merges'=>$merges,'cols'=>$cols
|
|
|
+ ])));
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //出库+入库数据整合
|
|
|
- public function _excelcrjs()
|
|
|
- {
|
|
|
- if (isset($_GET['excel'])) {
|
|
|
- $type = $this->input->get('excel', true);
|
|
|
- $category = $this->input->get('category', true);
|
|
|
- $size = $this->input->get('size', true);
|
|
|
- $grade = $this->input->get('grade', true);
|
|
|
- $color = $this->input->get('color', true);
|
|
|
- $lowe = $this->input->get('lowe', true);
|
|
|
- $sku = $this->input->get('sku', true);
|
|
|
- $warehouse = $this->input->get('warehouse', true);
|
|
|
- $purchase = $this->input->get('purchase', true);
|
|
|
- $state = $this->input->get('state', true);
|
|
|
- $sid = $this->input->get('sid', true);
|
|
|
- $ktime = $this->input->get('ktime', true);
|
|
|
- $jtime = $this->input->get('jtime', true);
|
|
|
- $ktime = strtotime($ktime);
|
|
|
- $jtime = strtotime($jtime);
|
|
|
- $where = "1=1";
|
|
|
- $gj = "";
|
|
|
- $ck = "";
|
|
|
- if ($category) {
|
|
|
- $where .= " and features like '%-$category-%'";
|
|
|
- }
|
|
|
- if ($size) {
|
|
|
- $where .= " and features like '%-$size-%'";
|
|
|
- }
|
|
|
- if ($grade) {
|
|
|
- $where .= " and features like '%-$grade-%'";
|
|
|
- }
|
|
|
- if ($color) {
|
|
|
- $where .= " and features like '%-$color-%'";
|
|
|
- }
|
|
|
- if ($lowe) {
|
|
|
- $where .= " and features like '%-$lowe-%'";
|
|
|
- }
|
|
|
- if ($warehouse) {
|
|
|
- $where .= " and warehouse = '$warehouse'";
|
|
|
- }
|
|
|
- if ($purchase) {
|
|
|
- $where .= " and purchase = '$purchase'";
|
|
|
- }
|
|
|
- if ($state) {
|
|
|
- $where .= " and state = '$state'";
|
|
|
- }
|
|
|
- if ($sku) {
|
|
|
- $where .= " and sku like '%$sku%'";
|
|
|
- }
|
|
|
- if ($ktime && $jtime) {
|
|
|
- $where .= " and ((enter > '$ktime' and enter < '$jtime') or (outk > '$ktime' and outk < '$jtime'))";
|
|
|
- }
|
|
|
- $sidwhere = '';
|
|
|
- if ($sid) {
|
|
|
- $sd = "";
|
|
|
- $s = explode(',', trim($sid, ','));
|
|
|
- foreach ($s as $value) {
|
|
|
- $sd .= " id = " . $value . " or";
|
|
|
- }
|
|
|
- $sidwhere .= " and (" . rtrim($sd, 'or') . ")";
|
|
|
- }
|
|
|
-
|
|
|
- //取得信息列表
|
|
|
- $timeread = $ktime;
|
|
|
- $timenum = ceil(($jtime - $ktime) / (24 * 3600));
|
|
|
- $timelist = array();
|
|
|
- for ($i = 0; $i < $timenum; $i++) {
|
|
|
- $timeread = ($i > 0) ? $ktime + $i * 24 * 3600 : $ktime;
|
|
|
- $timelist[date('Y-m-d', $timeread)] = array('c' => 0, 'r' => 0);
|
|
|
+ public function _exceljxcjs(){
|
|
|
+ $classid = $this->classid->sku();
|
|
|
+ $pm = $classid;
|
|
|
+ $typeclass = array();
|
|
|
+ $tc = $this->typeclass->find_all();
|
|
|
+ foreach ($tc as $v) {
|
|
|
+ $typeclass[$v['id']] = $v;
|
|
|
+ }
|
|
|
+ $prc = array();
|
|
|
+ $purchase = $this->purchase->find_all();
|
|
|
+ foreach ($purchase as $k => $v) {
|
|
|
+ $prc[$v['id']] = $v['title'];
|
|
|
+ }
|
|
|
+ if(!isset($_GET['excel'])){
|
|
|
+ exit(json_encode(array('code' => 0, 'msg' => '请求参数缺失')));
|
|
|
+ }
|
|
|
+
|
|
|
+ $where = "sku != 'Preset'";
|
|
|
+ //数据排序
|
|
|
+ $order_str = "id desc";
|
|
|
+ if (empty($page)) {
|
|
|
+ $start = 0;
|
|
|
+ $perpage = 1;
|
|
|
+ } else {
|
|
|
+ $start = ($page - 1) * $perpage;
|
|
|
+ }
|
|
|
+ $category = $this->input->get('category', true);
|
|
|
+ $warehouse = $this->input->get('warehouse', true);
|
|
|
+ $excelid = $this->input->get('sid', true);
|
|
|
+ if ($category) {
|
|
|
+ $where .= " and features like '%-$category-%'";
|
|
|
+ }
|
|
|
+ if ($warehouse) {
|
|
|
+ $where .= " and warehouse = '$warehouse'";
|
|
|
+ }
|
|
|
+ $xzid = '';
|
|
|
+ if ($excelid) {
|
|
|
+ $excelid = explode(',', trim($excelid, ','));
|
|
|
+ foreach ($excelid as $key => $value) {
|
|
|
+ $xzid .= " id = " . $value . " or";
|
|
|
}
|
|
|
+ $xzid = " and (" . rtrim($xzid, 'or') . ")";;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
- $info_list = $this->whlabel->find_all($where . $sidwhere, 'outk,enter,sku,state');
|
|
|
- //echo "<pre>";
|
|
|
- //print_r($info_list);
|
|
|
- //exit();
|
|
|
- $rows = array();
|
|
|
- $list = array();
|
|
|
- foreach ($info_list as $key => $value) {
|
|
|
- $thistime = $timelist;
|
|
|
- if (isset($rows[strtolower($value['sku'])])) {
|
|
|
- if ($value['outk'] > $ktime && $value['state'] < $jtime) {
|
|
|
- $rows[strtolower($value['sku'])][date('Y-m-d', $value['outk'])]['c'] += 1;
|
|
|
- }
|
|
|
- if ($value['enter'] > $ktime && $value['enter'] < $jtime) {
|
|
|
- $rows[strtolower($value['sku'])][date('Y-m-d', $value['enter'])]['r'] += 1;
|
|
|
- }
|
|
|
- } else {
|
|
|
- if ($value['outk'] > $ktime && $value['outk'] < $jtime) {
|
|
|
- $thistime[date('Y-m-d', $value['outk'])]['c'] += 1;
|
|
|
+ $wt = array();
|
|
|
+ $whlabel_type = $this->whlabel_type->find_all();
|
|
|
+ foreach ($whlabel_type as $v) {
|
|
|
+ $wt[$v['id']] = $v['title'];
|
|
|
+ }
|
|
|
+ $wh = array();
|
|
|
+ $w = $this->warehouse->find_all('1=1', 'id,title');
|
|
|
+ foreach ($w as $v) {
|
|
|
+ $wh[$v['id']] = $v['title'];
|
|
|
+ }
|
|
|
+ $list = array();
|
|
|
+ $rows = $this->whlabel->find_pc($where, 'sku,purchase,features,warehouse', 'warehouse,purchase,details,cpid,dbcontent,sku,cs,bs,title,features,cpbz,sm,type,number');
|
|
|
+ foreach ($rows as $key => $value) {
|
|
|
+ if (isset($wt[$value['type']])) {
|
|
|
+ $rows[$key]['type'] = $wt[$value['type']];
|
|
|
+ } else {
|
|
|
+ $rows[$key]['type'] = '未设置';
|
|
|
+ }
|
|
|
+ $bm = '03';
|
|
|
+ $bmpx = array(13 => '', 16 => '', 18 => '', 25 => '', 26 => '', 41 => '');
|
|
|
+ $rows[$key]['purchase'] = (isset($prc[$value['purchase']])) ? $prc[$value['purchase']] : '未知';
|
|
|
+ $sd = $this->whlabel->find_all($where . ' and purchase = "' . $value['purchase'] . '" and sku = "' . $value['sku'] . '" and warehouse = "' . $value['warehouse'] . '" and features = "' . $value['features'] . '"', 'details,cpid,cpbz,state');
|
|
|
+ $details = array();
|
|
|
+ $cpid = array();
|
|
|
+ $cpbz = array();
|
|
|
+ $c = 0;
|
|
|
+ $g = 0;
|
|
|
+ $x = 0;
|
|
|
+ $t = 0;
|
|
|
+ $s = 0;
|
|
|
+ $q = 0;
|
|
|
+ foreach ($sd as $k => $v) {
|
|
|
+ if ($v['state'] == 0) {
|
|
|
+ $c++;
|
|
|
+ if ($v['cpid'] != 0) {
|
|
|
+ $cpid[$v['cpid']] = $v['cpid'];
|
|
|
}
|
|
|
- if ($value['enter'] > $ktime && $value['enter'] < $jtime) {
|
|
|
- $thistime[date('Y-m-d', $value['enter'])]['r'] += 1;
|
|
|
+ if ($v['cpbz'] != '') {
|
|
|
+ $cpbz[$v['cpbz']] = $v['cpbz'];
|
|
|
}
|
|
|
- $rows[strtolower($value['sku'])] = $thistime;
|
|
|
}
|
|
|
+ if ($v['state'] != 9) {
|
|
|
+ $g++;
|
|
|
+ }
|
|
|
+ if ($v['state'] == 1) {
|
|
|
+ $x++;
|
|
|
+ }
|
|
|
+ if ($v['state'] == 2) {
|
|
|
+ $t++;
|
|
|
+ }
|
|
|
+ if ($v['state'] == 8) {
|
|
|
+ $s++;
|
|
|
+ }
|
|
|
+ if ($v['state'] == "3" || $v['state'] == "4" || $v['state'] == "5" || $v['state'] == "6" || $v['state'] == "7") {
|
|
|
+ $q++;
|
|
|
+ }
|
|
|
+ $details[$v['details']] = $v['details'];
|
|
|
}
|
|
|
+ $z = $this->whlabel->find_count($where . ' and sku = "' . $value['sku'] . '" and zd != "" and state = 0 and purchase = "' . $value['purchase'] . '" and warehouse = "' . $value['warehouse'] . '" and features = "' . $value['features'] . '"');
|
|
|
+ $rows[$key]['details'] = implode("、", $details);
|
|
|
+ $rows[$key]['cpid'] = ($cpid) ? implode(" ", $cpid) : '';
|
|
|
+ $number = $value['number'];
|
|
|
+ $ftime = time() - 15 * 24 * 3600;
|
|
|
+ $rows[$key]['warehouse'] = isset($wh[$value['warehouse']])?$wh[$value['warehouse']]:"??";
|
|
|
+ $rows[$key]['number'] = $g;
|
|
|
+ $rows[$key]['c'] = $c;
|
|
|
+ $rows[$key]['x'] = $x;
|
|
|
+ $rows[$key]['t'] = $t;
|
|
|
+ $rows[$key]['s'] = $s;
|
|
|
+ $rows[$key]['q'] = $q;
|
|
|
+ $rows[$key]['z'] = $z;
|
|
|
|
|
|
- if(empty($rows)){
|
|
|
- exit(json_encode(array('code' => 0, 'msg' => '没有合适数据')));
|
|
|
- }else{
|
|
|
- $final_list = [];
|
|
|
- foreach($rows as $k=>$v){
|
|
|
- $tmp = [];
|
|
|
- $tmp[] = $k;
|
|
|
- foreach($v as $kk=>$vv){
|
|
|
- $tmp[] = $vv['c'];
|
|
|
- $tmp[] = $vv['r'];
|
|
|
- }
|
|
|
- $final_list[] = $tmp;
|
|
|
- }
|
|
|
- $title = date("Y-m-d H:i:s"). "详情";
|
|
|
- $first_line = [];
|
|
|
- $first_line[] = "SKU";
|
|
|
- $send_line = [];
|
|
|
- $send_line[] = $title;
|
|
|
- foreach ($timelist as $k => $v) {
|
|
|
- $first_line[] = $k . "出库";
|
|
|
- $first_line[] = $k . "入库";
|
|
|
- $send_line[] = " ";
|
|
|
- $send_line[] = " ";
|
|
|
- }
|
|
|
-
|
|
|
- array_unshift($final_list,$first_line);
|
|
|
- array_unshift($final_list,$send_line);
|
|
|
-
|
|
|
- exit(json_encode(array('code' => 1,'msg'=>"获取成功", 'data' => $final_list,'title'=>$title)));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- // $str = "<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\">
|
|
|
- // <head>
|
|
|
- // <!--[if gte mso 9]><xml>
|
|
|
- // <x:ExcelWorkbook>
|
|
|
- // <x:ExcelWorksheets>
|
|
|
- // <x:ExcelWorksheet>
|
|
|
- // <x:Name>EXCEL</x:Name>
|
|
|
- // <x:WorksheetOptions>
|
|
|
- // <x:Print>
|
|
|
- // <x:ValidPrinterInfo />
|
|
|
- // </x:Print>
|
|
|
- // </x:WorksheetOptions>
|
|
|
- // </x:ExcelWorksheet>
|
|
|
- // </x:ExcelWorksheets>
|
|
|
- // </x:ExcelWorkbook>
|
|
|
- // </xml>
|
|
|
- // <![endif]-->
|
|
|
- // </head><body>";
|
|
|
-
|
|
|
- // $str .= "<table border=1><tr><td>SKU</td>";
|
|
|
- // foreach ($timelist as $k => $v) {
|
|
|
- // $str .= "<td>" . $k . "出库</td>";
|
|
|
- // $str .= "<td>" . $k . "入库</td>";
|
|
|
- // }
|
|
|
- // $str .= "</tr></table>";
|
|
|
- // $str .= "<table border=1 style='font-family: Microsoft Yahei;font-size: 13px;'>";
|
|
|
- // foreach ($rows as $key => $val) {
|
|
|
- // $str .= "<tr><td>" . strtoupper($key) . "</td>";
|
|
|
- // foreach ($val as $k => $v) {
|
|
|
- // $str .= "<td>" . $val[$k]['c'] . "</td>";
|
|
|
- // if ($val[$k]['r'] > 0) {
|
|
|
- // $str .= "<td style='color:#f00'>-" . $val[$k]['r'] . "</td>";
|
|
|
- // } else {
|
|
|
- // $str .= "<td>" . $val[$k]['r'] . "</td>";
|
|
|
- // }
|
|
|
- // }
|
|
|
- // $str .= "</tr>";
|
|
|
- // }
|
|
|
- // $str .= "</table>";
|
|
|
- // $str .= "</body></html>";
|
|
|
- // header("Content-Type: application/vnd.ms-excel; name='excel'");
|
|
|
- // header("Content-type: application/octet-stream");
|
|
|
- // header("Content-Disposition: attachment; filename=" . time() . '.xls');
|
|
|
- // header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
|
|
|
- // header("Pragma: no-cache");
|
|
|
- // header("Expires: 0");
|
|
|
- // exit($str);
|
|
|
+ $features = str_replace(array('-163-', '-164-', '-165-', '-166-'), '-', $value['features']);
|
|
|
+ $features = explode('-', trim($features, '-'));
|
|
|
+ $rows[$key]['dbcontent'] = isset($typeclass[$features[0]])?$typeclass[$features[0]]['title']:" ??";
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ $list = $this->logic_whlabel->dataTran($rows, ['pm', 'weight']);
|
|
|
+
|
|
|
+ $final_list = [];
|
|
|
+ foreach ($list as $k => $v) {
|
|
|
+ if (empty($v['sku'])) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $final_list[] = [
|
|
|
+ $v["warehouse"],
|
|
|
+ $v["purchase"],
|
|
|
+ $v["details"],
|
|
|
+ $v["cpid"],
|
|
|
+ $v["dbcontent"],
|
|
|
+ $v["sku"],
|
|
|
+ $v["bm"],
|
|
|
+ $v["jm"],
|
|
|
+ $v["title"],
|
|
|
+ $v["pm"],
|
|
|
+ $v["cpbz"],
|
|
|
+ $v["sm"],
|
|
|
+ $v["type"],
|
|
|
+ $v["number"],
|
|
|
+ $v["c"],
|
|
|
+ $v["x"],
|
|
|
+ $v["t"],
|
|
|
+ $v["s"],
|
|
|
+ $v["q"],
|
|
|
+ $v["z"],
|
|
|
+ $v['weight'],
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+ if(empty($final_list)){
|
|
|
+ exit(json_encode(array('code' => 0, 'msg' => '无符合条件数据')));
|
|
|
}
|
|
|
+ $title = "总进销存统计表";
|
|
|
+
|
|
|
+ $first_row = ["仓库", "供应商", "位置", "库存编码", "类目", "SKU", "用友编码", "用友料号", "商品名称", "商品中文", "产品备注", "说明", "类型", "入库总量", "库存数量", "销售数量", "退货数量", "删除数量", "其它操作", "占单数量", "重量(g)"];
|
|
|
+ $merges = [
|
|
|
+ [
|
|
|
+ "s"=>["r"=>0,"c"=>0],
|
|
|
+ "e"=>["r"=>0,"c"=>21]
|
|
|
+ ]
|
|
|
+ ];
|
|
|
+ $cols = [
|
|
|
+ ["wch"=>"10"],["wch"=>"10"],["wch"=>"10"],["wch"=>"10"],["wch"=>"10"],["wch"=>"40"],["wch"=>"30"],["wch"=>"40"],
|
|
|
+ ["wch"=>"40"],["wch"=>"40"],["wch"=>"20"],["wch"=>"20"],["wch"=>"10"],["wch"=>"10"],["wch"=>"10"],["wch"=>"10"],
|
|
|
+ ["wch"=>"10"],["wch"=>"10"],["wch"=>"10"],["wch"=>"10"],["wch"=>"10"],
|
|
|
+ ];
|
|
|
+
|
|
|
+ array_unshift($final_list, $first_row);
|
|
|
+ array_unshift($final_list, [$title,"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""]);
|
|
|
+
|
|
|
+ exit(json_encode(array('code' => 1,'msg'=>"获取成功",'data'=>['merges'=>$merges, 'data' => $final_list,'title'=>$title,'cols' => $cols])));
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|