|
|
@@ -200,6 +200,8 @@ class Whlabel extends Start_Controller
|
|
|
$this->_uckjs();
|
|
|
}else if ($arg == 'whlabelexcelzhjs') {
|
|
|
$this->_whlabelexcelzhjs();
|
|
|
+ }else if($arg == 'dccrtypejs'){
|
|
|
+ $this->_dccrtypejs();
|
|
|
}else if($arg == "w_t_cs"){
|
|
|
$this->_w_t_cs(); //首页
|
|
|
}else {
|
|
|
@@ -8830,4 +8832,253 @@ class Whlabel extends Start_Controller
|
|
|
exit(json_encode(array('code' => 1,'msg'=>"获取成功",'data'=>['merges'=>$merges, 'data' => $end_list,'title'=>$title,'cols' => $cols])));
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //出库、退库导出
|
|
|
+ public function _dccrtypejs()
|
|
|
+ {
|
|
|
+ $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['sid'])) {
|
|
|
+ $wh = array();
|
|
|
+ $w = $this->warehouse->find_all('1=1', 'id,title');
|
|
|
+ foreach ($w as $v) {
|
|
|
+ $wh[$v['id']] = $v['title'];
|
|
|
+ }
|
|
|
+ $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);
|
|
|
+ $lacetype = $this->input->get('lacetype', true);
|
|
|
+ $lacecolor = $this->input->get('lacecolor', true);
|
|
|
+ $density = $this->input->get('density', true);
|
|
|
+ $haircap = $this->input->get('haircap', true);
|
|
|
+ $purchase = $this->input->get('purchase', true);
|
|
|
+ $title = $this->input->get('title', 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 ($lacetype) {
|
|
|
+ $where .= " and features like '%-$lacetype-%'";
|
|
|
+ }
|
|
|
+ if ($lacecolor) {
|
|
|
+ $where .= " and features like '%-$lacecolor-%'";
|
|
|
+ }
|
|
|
+ if ($density) {
|
|
|
+ $where .= " and features like '%-$density-%'";
|
|
|
+ }
|
|
|
+ if ($haircap) {
|
|
|
+ $where .= " and features like '%-$haircap-%'";
|
|
|
+ }
|
|
|
+ if ($title) {
|
|
|
+ $title = trim($title, ' ');
|
|
|
+ $title = trim($title, ' ');
|
|
|
+ $where .= " and title like '%$title%'";
|
|
|
+ }
|
|
|
+ if ($sku) {
|
|
|
+ $sku = trim($sku, ' ');
|
|
|
+ $sku = trim($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') . ")";
|
|
|
+ }
|
|
|
+ //数据排序
|
|
|
+ $order_str = "time desc";
|
|
|
+ if (empty($page)) {
|
|
|
+ $start = 0;
|
|
|
+ $perpage = 1;
|
|
|
+ } else {
|
|
|
+ $start = ($page - 1) * $perpage;
|
|
|
+ }
|
|
|
+ $wh = array();
|
|
|
+ $w = $this->warehouse->find_all('1=1', 'id,title');
|
|
|
+ foreach ($w as $v) {
|
|
|
+ $wh[$v['id']] = $v['title'];
|
|
|
+ }
|
|
|
+ $wt = array();
|
|
|
+ $whlabel_type = $this->whlabel_type->find_all();
|
|
|
+ foreach ($whlabel_type as $v) {
|
|
|
+ $wt[$v['id']] = $v['title'];
|
|
|
+ }
|
|
|
+ $classid = $this->classid->sku();
|
|
|
+ $list = array();
|
|
|
+ $rows_r = $this->whlabel->find_pc($where . " and enter > '$ktime' and enter < '$jtime' " . $sidwhere, 'sku,features,warehouse,enter', 'warehouse,sku,title,zh,features,time,enter,rktype,number,text');
|
|
|
+ foreach ($rows_r as $key => $value) {
|
|
|
+ $rows_r[$key]['warehouse'] = $wh[$value['warehouse']];
|
|
|
+ $pm = $classid;
|
|
|
+ $jm = $classid;
|
|
|
+ $rows_r[$key]['enter'] = '入库';
|
|
|
+ $rows_r[$key]['time'] = $value['enter'];
|
|
|
+ if ($value['rktype'] == 1) {
|
|
|
+ $rows_r[$key]['rktype'] = '采购入库';
|
|
|
+ } else if ($value['rktype'] == 2) {
|
|
|
+ $rows_r[$key]['rktype'] = '盘盈调整';
|
|
|
+ } else if ($value['rktype'] == 3) {
|
|
|
+ $rows_r[$key]['rktype'] = '其他调整入库';
|
|
|
+ } else if ($value['rktype'] == 4) {
|
|
|
+ $rows_r[$key]['rktype'] = '其他调整入库';
|
|
|
+ } else if ($value['rktype'] == 5) {
|
|
|
+ $rows_r[$key]['rktype'] = '退库入库';
|
|
|
+ } else if ($value['rktype'] == 6) {
|
|
|
+ $rows_r[$key]['rktype'] = '退货可用入库';
|
|
|
+ } else if ($value['rktype'] == 7) {
|
|
|
+ $rows_r[$key]['rktype'] = '形态转换入库';
|
|
|
+ } else {
|
|
|
+ $rows_r[$key]['rktype'] = '';
|
|
|
+ }
|
|
|
+ $features = explode('-', trim($value['features'], '-'));
|
|
|
+ foreach ($features as $v) {
|
|
|
+ if (isset($typeclass[$v])) {
|
|
|
+ $zh = explode('|', trim($typeclass[$v]['zh'], '|'));
|
|
|
+ $pm[$typeclass[$v]['classid']] = $zh[0];
|
|
|
+ }
|
|
|
+ if (isset($typeclass[$v])) {
|
|
|
+ if (isset($jm[$typeclass[$v]['classid']])) {
|
|
|
+ $jm[$typeclass[$v]['classid']] = $typeclass[$v]['jm'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $zh = implode(" ", $pm);
|
|
|
+ $zh = str_replace('自然色 ', '', rtrim($zh, ' '));
|
|
|
+ $zh = str_replace(array(' ', ' ', ' ', ' ', ' ', ' ', ' '), ' ', $zh);
|
|
|
+ $rows_r[$key]['zh'] = $zh;
|
|
|
+ $jm = array_filter($jm);
|
|
|
+ $rows_r[$key]['features'] = implode("-", $jm);
|
|
|
+ $rows_r[$key]['number'] = $this->whlabel->find_count($where . " and enter = '" . $value['enter'] . "' " . $sidwhere);
|
|
|
+ }
|
|
|
+
|
|
|
+ $rows_c = $this->whlabel->find_all($where . " and outk > '$ktime' and outk < '$jtime' " . $sidwhere, 'warehouse,sku,title,zh,features,time,outk,cktype,number,textout,state');
|
|
|
+ foreach ($rows_c as $key => $value) {
|
|
|
+ $rows_c[$key]['warehouse'] = $wh[$value['warehouse']];
|
|
|
+ $pm = $classid;
|
|
|
+ $jm = $classid;
|
|
|
+ $rows_c[$key]['time'] = $value['outk'];
|
|
|
+ $rows_c[$key]['outk'] = '出库';
|
|
|
+ if ($value['cktype'] == 1) {
|
|
|
+ $rows_c[$key]['cktype'] = (($value['state']==10)&&($value['warehouse']== 5))?'美国销售调货出库': '销售出库';
|
|
|
+ } else if ($value['cktype'] == 2) {
|
|
|
+ $rows_c[$key]['cktype'] = '美国销售调货出库';
|
|
|
+ } else if ($value['cktype'] == 3) {
|
|
|
+ $rows_c[$key]['cktype'] = '盘亏调整';
|
|
|
+ } else if ($value['cktype'] == 4) {
|
|
|
+ $rows_c[$key]['cktype'] = '其他调整出库';
|
|
|
+ } else if ($value['cktype'] == 5) {
|
|
|
+ $rows_c[$key]['cktype'] = '形态转换出库';
|
|
|
+ } else {
|
|
|
+ $rows_c[$key]['cktype'] = '';
|
|
|
+ }
|
|
|
+ unset($rows_c[$key]['state']);
|
|
|
+ $features = explode('-', trim($value['features'], '-'));
|
|
|
+ foreach ($features as $v) {
|
|
|
+ if (isset($typeclass[$v])) {
|
|
|
+ $zh = explode('|', trim($typeclass[$v]['zh'], '|'));
|
|
|
+ $pm[$typeclass[$v]['classid']] = $zh[0];
|
|
|
+ }
|
|
|
+ if (isset($typeclass[$v])) {
|
|
|
+ if (isset($jm[$typeclass[$v]['classid']])) {
|
|
|
+ $jm[$typeclass[$v]['classid']] = $typeclass[$v]['jm'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $zh = implode(" ", $pm);
|
|
|
+ $zh = str_replace('自然色 ', '', rtrim($zh, ' '));
|
|
|
+ $zh = str_replace(array(' ', ' ', ' ', ' ', ' ', ' ', ' '), ' ', $zh);
|
|
|
+ $rows_c[$key]['zh'] = $zh;
|
|
|
+ $jm = array_filter($jm);
|
|
|
+ $rows_c[$key]['features'] = implode("-", $jm);
|
|
|
+ $rows_c[$key]['number'] = 1;
|
|
|
+ }
|
|
|
+ $merged = $rows_r;
|
|
|
+ foreach ($rows_c as $key => $value) {
|
|
|
+ if (isset($merged[$key])) {
|
|
|
+ $merged[] = $value;
|
|
|
+ } else {
|
|
|
+ $merged[$key] = $value;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ usort($merged, function ($a, $b) {
|
|
|
+ return $a['time'] - $b['time'];
|
|
|
+ });
|
|
|
+ foreach ($merged as $key => $value) {
|
|
|
+ $merged[$key]['time'] = date('Y-m-d H:i:s', $value['time']);
|
|
|
+ }
|
|
|
+ $title = date('Y-m-d', $ktime) . '至' . date('Y-m-d', $jtime);
|
|
|
+
|
|
|
+ $first_row = ["仓库","SKU","商品名称","仓库品名","料号","时间","操作","类型","数量","备注"];
|
|
|
+
|
|
|
+ $cols = [
|
|
|
+ ["wch"=>"15"],["wch"=>"30"],["wch"=>"30"],["wch"=>"15"],["wch"=>"30"],["wch"=>"15"],["wch"=>"15"],["wch"=>"15"],["wch"=>"15"],["wch"=>"15"],
|
|
|
+ ];
|
|
|
+ $final_list= [];
|
|
|
+ foreach($merged as $key => $value){
|
|
|
+ $final_list[] = array_values($value) ;
|
|
|
+ }
|
|
|
+ if(empty($merged)){
|
|
|
+ exit(json_encode(array('code' => 0, 'msg' => '无符合条件数据')));
|
|
|
+ }
|
|
|
+ array_unshift($final_list, $first_row);
|
|
|
+ $end_list = [];
|
|
|
+ foreach ($final_list as $key => $value) {
|
|
|
+ $end_list[] = array_values($value);
|
|
|
+ }
|
|
|
+ $merges = [];
|
|
|
+ exit(json_encode(array('code' => 1,'msg'=>"获取成功",'data'=>['merges'=>$merges, 'data' => $end_list,'title'=>$title,'cols' => $cols])));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|