|
|
@@ -196,6 +196,8 @@ class Whlabel extends Start_Controller
|
|
|
} else if ($arg == 'summaryjs') //汇总导出
|
|
|
{
|
|
|
$this->_summaryjs($arg_array);
|
|
|
+ }else if($arg == 'uckjs'){
|
|
|
+ $this->_uckjs();
|
|
|
}else if($arg == "w_t_cs"){
|
|
|
$this->_w_t_cs(); //首页
|
|
|
}else {
|
|
|
@@ -8494,6 +8496,8 @@ class Whlabel extends Start_Controller
|
|
|
$merges = [
|
|
|
[
|
|
|
"s"=>["r"=>0,"c"=>0],
|
|
|
+
|
|
|
+
|
|
|
"e"=>["r"=>0,"c"=>7]
|
|
|
]
|
|
|
];
|
|
|
@@ -8531,4 +8535,188 @@ class Whlabel extends Start_Controller
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public function _uckjs()
|
|
|
+ {
|
|
|
+ if (isset($_GET['excel'])) {
|
|
|
+ $tc = array();
|
|
|
+ $typeclass = $this->typeclass->find_all();
|
|
|
+ foreach ($typeclass as $v) {
|
|
|
+ $tc[$v['id']] = $v['zh'];
|
|
|
+ }
|
|
|
+ $first_row = [
|
|
|
+ '类别','颜色','曲度','名称','SKU','月初库存','剩余库存','在途数量','预达日期'
|
|
|
+ ];
|
|
|
+
|
|
|
+ $t = array();
|
|
|
+ $rq = '';
|
|
|
+ $ts = strtotime(date("Y-m-d", time())) - strtotime(date("Y-m", time()));
|
|
|
+ $ts = $ts / (24 * 3600);
|
|
|
+
|
|
|
+ for ($i = 0; $i < $ts; $i++) {
|
|
|
+ $t[] = date("Y-m-d", strtotime('-' . ($ts - $i) . ' day'));
|
|
|
+ $first_row[] = date("Y-m-d", strtotime('-' . ($ts - $i) . ' day'));
|
|
|
+ }
|
|
|
+ $day_len = count($t);
|
|
|
+ $first_row[] = "本月出库";
|
|
|
+
|
|
|
+ $merges = [
|
|
|
+
|
|
|
+ ];
|
|
|
+ $info_list = $this->whlabel->find_pc("warehouse = '5'", 'sku', 'warehouse,sku,features');
|
|
|
+ $excel_key = 1;
|
|
|
+ $final_list = [];
|
|
|
+ foreach ($info_list as $k => $v) {
|
|
|
+ $features = explode('-', trim($v['features'], '-'));
|
|
|
+ if (!isset($features[3]) || !isset($features[4])) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $tmp = [];
|
|
|
+ $tmp[0] = $tc[$features[0]]; //类型
|
|
|
+ $tmp[1] = ($features[3] != 57) ? $tc[$features[3]] : ''; //颜色,自然色不显示
|
|
|
+ $tmp[2] = $tc[$features[4]]; //曲度
|
|
|
+ $tmp[3] = '';
|
|
|
+
|
|
|
+ if (isset($data[$k][1])) {
|
|
|
+ $tmp[3] .=$tmp[1];
|
|
|
+ }
|
|
|
+ if (isset($data[$k][2])) {
|
|
|
+ $tmp[3] .= $tmp[2];
|
|
|
+ }
|
|
|
+ if (isset($features[5])) {
|
|
|
+ $tmp[3] .= $tc[$features[5]];
|
|
|
+ }
|
|
|
+ if (isset($features[2])) {
|
|
|
+ $tmp[3] .= $tc[$features[2]];
|
|
|
+ }
|
|
|
+ //$data[$k][3] 颜色,曲度,头套种类,尺寸
|
|
|
+ $tmp[4] = $v['sku'];
|
|
|
+ $tmp[5] = $this->whlabel->find_count('sku = "' . $v['sku'] . '" and warehouse = "' . $v['warehouse'] . '" and features = "' . $v['features'] . '" and (state = 0 or (state = 1 and outk > ' . strtotime(date("Y-m", time())) . '))'); //月初库存
|
|
|
+ $tmp[6] = $this->whlabel->find_count('sku = "' . $v['sku'] . '" and state = 0 and warehouse = "' . $v['warehouse'] . '" and features = "' . $v['features'] . '"'); //剩余库存
|
|
|
+
|
|
|
+ $tmp[7] ="";
|
|
|
+ $tmp[8] ="";
|
|
|
+
|
|
|
+ $byck = 0;
|
|
|
+ foreach ($t as $vv) {
|
|
|
+ $sl = $this->whlabel->find_count('sku = "' . $v['sku'] . '" and warehouse = "' . $v['warehouse'] . '" and features = "' . $v['features'] . '" and state = 1 and outk > ' . strtotime($vv) . ' and outk < ' . (strtotime($vv) + 24 * 3600));
|
|
|
+ $tmp[] = ($sl > 0) ? '<b>' . $sl . '</b>' : '';
|
|
|
+ $byck += $sl;
|
|
|
+ }
|
|
|
+ $tmp[] = ($byck > 0) ? $byck : '';
|
|
|
+
|
|
|
+
|
|
|
+ $zt = $this->whlabeltransport->find_all('sku = "' . $v['sku'] . '" and warehouse = "' . $v['warehouse'] . '" and features = "' . $v['features'] . '" and cz = "0"');
|
|
|
+ // $ztrq = '';
|
|
|
+ // $ztsl = '';
|
|
|
+ // if (count($zt) > 0) {
|
|
|
+ // foreach ($zt as $vv) {
|
|
|
+ // $ztrq .= date('Y-m-d', $vv['stime']) . '<br>';
|
|
|
+ // $ztsl .= $vv['num'] . '<br>';
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ if(empty($zt)){
|
|
|
+ $final_list[] = $tmp;
|
|
|
+ $excel_key = $excel_key + 1;
|
|
|
+ }else{
|
|
|
+ $len = count($zt);
|
|
|
+ if($len == 1){
|
|
|
+ $tmp[7] = $zt[0]['num'] ;
|
|
|
+ $tmp[8] = date('Y-m-d', $zt[0]['stime']);
|
|
|
+ $final_list[] = $tmp;
|
|
|
+ $excel_key = $excel_key + 1;
|
|
|
+ }else{
|
|
|
+ foreach($zt as $vv){
|
|
|
+ $tmp[7] = "";
|
|
|
+ $tmp[8] = "";
|
|
|
+
|
|
|
+ $tmp[7] = $vv['num'];
|
|
|
+ $tmp[8] = date('Y-m-d', $vv['stime']) ;
|
|
|
+ $final_list[] = $tmp;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ $merges[] = [
|
|
|
+ "s"=>["r"=>$excel_key,"c"=>0],
|
|
|
+ "e"=>["r"=>$excel_key+$len-1,"c"=>0]
|
|
|
+ ];
|
|
|
+ $merges[] = [
|
|
|
+ "s"=>["r"=>$excel_key,"c"=>1],
|
|
|
+ "e"=>["r"=>$excel_key+$len-1,"c"=>1]
|
|
|
+ ];
|
|
|
+ $merges[] = [
|
|
|
+ "s"=>["r"=>$excel_key,"c"=>2],
|
|
|
+ "e"=>["r"=>$excel_key+$len-1,"c"=>2]
|
|
|
+ ];
|
|
|
+ $merges[] = [
|
|
|
+ "s"=>["r"=>$excel_key,"c"=>3],
|
|
|
+ "e"=>["r"=>$excel_key+$len-1,"c"=>3]
|
|
|
+ ];
|
|
|
+ $merges[] = [
|
|
|
+ "s"=>["r"=>$excel_key,"c"=>4],
|
|
|
+ "e"=>["r"=>$excel_key+$len-1,"c"=>4]
|
|
|
+ ];
|
|
|
+ $merges[] = [
|
|
|
+ "s"=>["r"=>$excel_key,"c"=>5],
|
|
|
+ "e"=>["r"=>$excel_key+$len-1,"c"=>5]
|
|
|
+ ];
|
|
|
+ $merges[] = [
|
|
|
+ "s"=>["r"=>$excel_key,"c"=>6],
|
|
|
+ "e"=>["r"=>$excel_key+$len-1,"c"=>6]
|
|
|
+ ];
|
|
|
+ for($i=1;$i<=$day_len;$i++){
|
|
|
+ $merges[] = [
|
|
|
+ "s"=>["r"=>$excel_key,"c"=>8+$i],
|
|
|
+ "e"=>["r"=>$excel_key,"c"=>8+$i]
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ $merges[] = [
|
|
|
+ "s"=>["r"=>$excel_key,"c"=>8+$day_len+1],
|
|
|
+ "e"=>["r"=>$excel_key,"c"=>8+$day_len+1]
|
|
|
+ ];
|
|
|
+ $excel_key = $excel_key + $len;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ $title = "详情 " . date("Y-m-d", time());
|
|
|
+ if(empty($final_list)){
|
|
|
+ exit(json_encode(array('code' => 0, 'msg' => '无符合条件数据')));
|
|
|
+ }
|
|
|
+
|
|
|
+ $cols = [
|
|
|
+ ["wch"=>"10"],["wch"=>"10"],["wch"=>"10"],["wch"=>"40"],["wch"=>"40"],["wch"=>"10"],["wch"=>"15"],["wch"=>"15"],
|
|
|
+ ];
|
|
|
+ array_unshift($final_list, $first_row);
|
|
|
+ // echo "<pre>";
|
|
|
+ // print_r($merges);
|
|
|
+ // die;
|
|
|
+
|
|
|
+ exit(json_encode(array('code' => 1,'msg'=>"获取成功",'data'=>['merges'=>$merges, 'data' => $final_list,'title'=>$title,'cols' => $cols])));
|
|
|
+
|
|
|
+
|
|
|
+ exit();
|
|
|
+
|
|
|
+ $titlename = "<table border=1>
|
|
|
+ <tr align='center'>
|
|
|
+ <td>类别</td>
|
|
|
+ <td>颜色</td>
|
|
|
+ <td>曲度</td>
|
|
|
+ <td>名称</td>
|
|
|
+ <td>SKU</td>
|
|
|
+ <td>月初库存</td>
|
|
|
+ <td>剩余库存</td>
|
|
|
+ <td>在途数量</td>
|
|
|
+ <td>预达日期</td>" .
|
|
|
+ $rq
|
|
|
+ . "<td>本月出库</td></tr>
|
|
|
+ </table>";
|
|
|
+ $filename = $title . ".xls";
|
|
|
+ $tail = "";
|
|
|
+ $this->excel->get_fz2($data, $titlename, $filename, $tail);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|