|
@@ -38,6 +38,129 @@ class Deliver extends Backend
|
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
|
* @throws \think\exception\DbException
|
|
* @throws \think\exception\DbException
|
|
|
*/
|
|
*/
|
|
|
|
|
+// public function lager()
|
|
|
|
|
+// {
|
|
|
|
|
+// $company = new QcodeCompany();
|
|
|
|
|
+// $product = new QcodeProduct();
|
|
|
|
|
+// $large = new QcodeLarge();
|
|
|
|
|
+// $bach = new QcodeBach();
|
|
|
|
|
+// $small = new QcodeSmall();
|
|
|
|
|
+// $this->request->filter(['strip_tags', 'trim']);
|
|
|
|
|
+// if (false === $this->request->isAjax()) {
|
|
|
|
|
+// return $this->view->fetch();
|
|
|
|
|
+// }
|
|
|
|
|
+// if ($this->request->request('keyField')) {
|
|
|
|
|
+// return $this->selectpage();
|
|
|
|
|
+// }
|
|
|
|
|
+// // 接收参数
|
|
|
|
|
+// $userInfo = Session::get('admin');
|
|
|
|
|
+// $where = [
|
|
|
|
|
+// 'delete_time'=> '',
|
|
|
|
|
+// ];
|
|
|
|
|
+// $filter = input('filter');
|
|
|
|
|
+// $filter = json_decode($filter,true);
|
|
|
|
|
+// $whereList = [
|
|
|
|
|
+// 'delete_time'=>'',
|
|
|
|
|
+// ];
|
|
|
|
|
+// //样品编号查询
|
|
|
|
|
+// if (isset($filter['matter_name'])){
|
|
|
|
|
+// $whereList['matter_no'] =$filter['matter_name'];
|
|
|
|
|
+// }
|
|
|
|
|
+// if (isset($filter['bach'])){
|
|
|
|
|
+// $whereList['bach_num'] = $filter['bach'];
|
|
|
|
|
+// }
|
|
|
|
|
+// if (isset($filter['manufacture_date'])){
|
|
|
|
|
+// $begin = substr($filter['manufacture_date'],0,19);
|
|
|
|
|
+// $end = substr($filter['manufacture_date'],22);
|
|
|
|
|
+// $begin = (int)date('ymd',strtotime($begin));
|
|
|
|
|
+// $end = (int)date('ymd',strtotime($end));
|
|
|
|
|
+// $whereList['manufacture_date'] = ['between',[$begin,$end]];
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// $bach_list = $bach->name($userInfo['company'].'_'.'qcode_bach')->where($whereList)->column('_id');
|
|
|
|
|
+// $bach_id = [];
|
|
|
|
|
+// foreach ($bach_list as $v){
|
|
|
|
|
+// $id = substr(json_encode($v),9,-2);
|
|
|
|
|
+// array_push($bach_id,$id);
|
|
|
|
|
+// }
|
|
|
|
|
+// $order = input('order');
|
|
|
|
|
+//// $offset = input('offset');
|
|
|
|
|
+//// $limit = input('limit');
|
|
|
|
|
+//// $limit = input('limit', 10); // 每页数量,默认10条
|
|
|
|
|
+//
|
|
|
|
|
+// $offset = input('offset', 0);
|
|
|
|
|
+// $limit = input('limit', 10);
|
|
|
|
|
+// $skip = $offset;
|
|
|
|
|
+//
|
|
|
|
|
+// $total = $large->name($userInfo['company'].'_'.'qcode_large')
|
|
|
|
|
+// ->where('l_status', 0)
|
|
|
|
|
+// ->where($where)
|
|
|
|
|
+// ->whereIn('bach_id', $bach_id)
|
|
|
|
|
+// ->count();
|
|
|
|
|
+//
|
|
|
|
|
+// $large_list = $large->name($userInfo['company'].'_'.'qcode_large')
|
|
|
|
|
+// ->order('l_flow')
|
|
|
|
|
+// ->where($where)
|
|
|
|
|
+// ->where('l_status', 0)
|
|
|
|
|
+// ->whereIn('bach_id', $bach_id)
|
|
|
|
|
+// ->skip($skip)
|
|
|
|
|
+// ->limit($limit)
|
|
|
|
|
+// ->select();
|
|
|
|
|
+//
|
|
|
|
|
+// $list=[];
|
|
|
|
|
+// foreach ($large_list as $k=>$v) {
|
|
|
|
|
+// $bach_detail = $bach
|
|
|
|
|
+// ->name($userInfo['company'].'_qcode_bach')
|
|
|
|
|
+// ->where('_id', $v['bach_id'])
|
|
|
|
|
+// ->find();
|
|
|
|
|
+// //新增取 $bach 字段
|
|
|
|
|
+// $list[$k]['num'] = $bach_detail['num'];
|
|
|
|
|
+// $list[$k]['total_boxes'] = $bach_detail['total_boxes'];
|
|
|
|
|
+// $list[$k]['tray_num'] = $bach_detail['tray_num'];
|
|
|
|
|
+// $list[$k]['box_num'] = $bach_detail['box_num'];
|
|
|
|
|
+// $list[$k]['small_num'] = $bach_detail['small_num'];
|
|
|
|
|
+// $list[$k]['pallet_height'] = $bach_detail['pallet_height'];
|
|
|
|
|
+// $list[$k]['pallet_length'] = $bach_detail['pallet_length'];
|
|
|
|
|
+// $list[$k]['pallet_width'] = $bach_detail['pallet_width'];
|
|
|
|
|
+// $list[$k]['small_num'] = $bach_detail['small_num'];
|
|
|
|
|
+// $list[$k]['larger_num'] = $bach_detail['larger_num'];
|
|
|
|
|
+//
|
|
|
|
|
+// $bach_detail = $bach->name($userInfo['company'].'_'.'qcode_bach')->where('_id',$v['bach_id'])->find();
|
|
|
|
|
+// $list[$k]['id'] = substr(json_encode($v['_id']),9,-2);
|
|
|
|
|
+// $list[$k]['bach'] = $bach_detail['bach_num'];
|
|
|
|
|
+// $list[$k]['l_flow'] = ltrim(substr($v['code'],53,6),'0');
|
|
|
|
|
+// $list[$k]['matter_name'] = $bach_detail['matter_name'];
|
|
|
|
|
+// $list[$k]['manufacture_date'] = date('Y-m-d',strtotime('20'.$bach_detail['manufacture_date']));
|
|
|
|
|
+// $list[$k]['code'] = $v['code'];
|
|
|
|
|
+// $small_num = $small->name($userInfo['company'].'_'.'qcode_small')->where('large_id',substr(json_encode($v['_id']),9,-2))->count();
|
|
|
|
|
+// $list[$k]['small_num'] = $small_num;
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+//// $result = ['total'=>$total,'rows'=>$list];
|
|
|
|
|
+// // 分组
|
|
|
|
|
+// $grouped = [];
|
|
|
|
|
+// foreach ($list as $item) {
|
|
|
|
|
+// $grouped[$item['matter_name']][] = $item;
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// // 每组排序
|
|
|
|
|
+// foreach ($grouped as &$items) {
|
|
|
|
|
+// usort($items, function ($a, $b) {
|
|
|
|
|
+// return intval($a['l_flow']) <=> intval($b['l_flow']);
|
|
|
|
|
+// });
|
|
|
|
|
+// }
|
|
|
|
|
+// unset($items);
|
|
|
|
|
+//
|
|
|
|
|
+// // 合并
|
|
|
|
|
+// $sortedList = array_merge(...array_values($grouped));
|
|
|
|
|
+//
|
|
|
|
|
+// // 输出
|
|
|
|
|
+//// echo "<pre>";
|
|
|
|
|
+//// print_r($sortedList);
|
|
|
|
|
+//// echo "</pre>";
|
|
|
|
|
+// return json(['total'=>$total,'rows'=>$sortedList]);
|
|
|
|
|
+// }
|
|
|
|
|
+
|
|
|
public function lager()
|
|
public function lager()
|
|
|
{
|
|
{
|
|
|
$company = new QcodeCompany();
|
|
$company = new QcodeCompany();
|
|
@@ -45,72 +168,95 @@ class Deliver extends Backend
|
|
|
$large = new QcodeLarge();
|
|
$large = new QcodeLarge();
|
|
|
$bach = new QcodeBach();
|
|
$bach = new QcodeBach();
|
|
|
$small = new QcodeSmall();
|
|
$small = new QcodeSmall();
|
|
|
|
|
+
|
|
|
$this->request->filter(['strip_tags', 'trim']);
|
|
$this->request->filter(['strip_tags', 'trim']);
|
|
|
|
|
+
|
|
|
if (false === $this->request->isAjax()) {
|
|
if (false === $this->request->isAjax()) {
|
|
|
return $this->view->fetch();
|
|
return $this->view->fetch();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
if ($this->request->request('keyField')) {
|
|
if ($this->request->request('keyField')) {
|
|
|
return $this->selectpage();
|
|
return $this->selectpage();
|
|
|
}
|
|
}
|
|
|
- // 接收参数
|
|
|
|
|
|
|
+
|
|
|
$userInfo = Session::get('admin');
|
|
$userInfo = Session::get('admin');
|
|
|
- $where = [
|
|
|
|
|
- 'delete_time'=> '',
|
|
|
|
|
- ];
|
|
|
|
|
|
|
+ $where = ['delete_time'=> ''];
|
|
|
$filter = input('filter');
|
|
$filter = input('filter');
|
|
|
- $filter = json_decode($filter,true);
|
|
|
|
|
- $whereList = [
|
|
|
|
|
- 'delete_time'=>'',
|
|
|
|
|
- ];
|
|
|
|
|
- //样品编号查询
|
|
|
|
|
|
|
+ $filter = json_decode($filter, true);
|
|
|
|
|
+ $whereList = ['delete_time'=>''];
|
|
|
|
|
+
|
|
|
if (isset($filter['matter_name'])){
|
|
if (isset($filter['matter_name'])){
|
|
|
- $whereList['matter_no'] =$filter['matter_name'];
|
|
|
|
|
|
|
+ $whereList['matter_no'] = $filter['matter_name'];
|
|
|
}
|
|
}
|
|
|
if (isset($filter['bach'])){
|
|
if (isset($filter['bach'])){
|
|
|
$whereList['bach_num'] = $filter['bach'];
|
|
$whereList['bach_num'] = $filter['bach'];
|
|
|
}
|
|
}
|
|
|
if (isset($filter['manufacture_date'])){
|
|
if (isset($filter['manufacture_date'])){
|
|
|
- $begin = substr($filter['manufacture_date'],0,19);
|
|
|
|
|
- $end = substr($filter['manufacture_date'],22);
|
|
|
|
|
- $begin = (int)date('ymd',strtotime($begin));
|
|
|
|
|
- $end = (int)date('ymd',strtotime($end));
|
|
|
|
|
- $whereList['manufacture_date'] = ['between',[$begin,$end]];
|
|
|
|
|
|
|
+ $begin = substr($filter['manufacture_date'], 0, 19);
|
|
|
|
|
+ $end = substr($filter['manufacture_date'], 22);
|
|
|
|
|
+ $begin = (int)date('ymd', strtotime($begin));
|
|
|
|
|
+ $end = (int)date('ymd', strtotime($end));
|
|
|
|
|
+ $whereList['manufacture_date'] = ['between', [$begin, $end]];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- $bach_list = $bach->name($userInfo['company'].'_'.'qcode_bach')->where($whereList)->column('_id');
|
|
|
|
|
|
|
+ // 查出相关 bach_id
|
|
|
|
|
+ $bach_list = $bach->name($userInfo['company'].'_qcode_bach')->where($whereList)->column('_id');
|
|
|
$bach_id = [];
|
|
$bach_id = [];
|
|
|
foreach ($bach_list as $v){
|
|
foreach ($bach_list as $v){
|
|
|
- $id = substr(json_encode($v),9,-2);
|
|
|
|
|
- array_push($bach_id,$id);
|
|
|
|
|
|
|
+ $id = substr(json_encode($v), 9, -2);
|
|
|
|
|
+ $bach_id[] = $id;
|
|
|
}
|
|
}
|
|
|
- $order = input('order');
|
|
|
|
|
- $offset = input('offset');
|
|
|
|
|
- $limit = input('limit');
|
|
|
|
|
- $total = $large->name($userInfo['company'].'_'.'qcode_large')->where('l_status',0)->where($where)->whereIn('bach_id',$bach_id)->count();
|
|
|
|
|
- $large_list = $large->name($userInfo['company'].'_'.'qcode_large')
|
|
|
|
|
- ->order('create_time')
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // 获取分页参数
|
|
|
|
|
+ $offset = input('offset', 0);
|
|
|
|
|
+ $limit = input('limit', 10);
|
|
|
|
|
+ $skip = $offset;
|
|
|
|
|
+ // 总数量
|
|
|
|
|
+ $total = $large->name($userInfo['company'].'_qcode_large')
|
|
|
|
|
+ ->where('l_status', 0)
|
|
|
->where($where)
|
|
->where($where)
|
|
|
- ->where('l_status',0)
|
|
|
|
|
- ->whereIn('bach_id',$bach_id)
|
|
|
|
|
- ->skip($offset)
|
|
|
|
|
- ->limit($limit)
|
|
|
|
|
|
|
+ ->whereIn('bach_id', $bach_id)
|
|
|
|
|
+ ->count();
|
|
|
|
|
+
|
|
|
|
|
+ // 当前页数据
|
|
|
|
|
+ $large_list = $large->name($userInfo['company'].'_qcode_large')
|
|
|
|
|
+ ->order('l_flow')
|
|
|
|
|
+ ->where($where)
|
|
|
|
|
+ ->where('l_status', 0)
|
|
|
|
|
+ ->whereIn('bach_id', $bach_id)
|
|
|
|
|
+// ->skip($skip)
|
|
|
|
|
+// ->limit($limit)
|
|
|
->select();
|
|
->select();
|
|
|
- $list=[];
|
|
|
|
|
- foreach ($large_list as $k=>$v) {
|
|
|
|
|
- $bach_detail = $bach->name($userInfo['company'].'_'.'qcode_bach')->where('_id',$v['bach_id'])->find();
|
|
|
|
|
- $list[$k]['id'] = substr(json_encode($v['_id']),9,-2);
|
|
|
|
|
|
|
+ // 数据处理
|
|
|
|
|
+ $list = [];
|
|
|
|
|
+ foreach ($large_list as $k => $v) {
|
|
|
|
|
+ $bach_detail = $bach->name($userInfo['company'].'_qcode_bach')->where('_id', $v['bach_id'])->find();
|
|
|
|
|
+
|
|
|
|
|
+ $list[$k]['id'] = substr(json_encode($v['_id']), 9, -2);
|
|
|
|
|
+ $list[$k]['l_flow'] = $bach_detail['l_flow'];
|
|
|
$list[$k]['bach'] = $bach_detail['bach_num'];
|
|
$list[$k]['bach'] = $bach_detail['bach_num'];
|
|
|
- $list[$k]['l_flow'] = ltrim(substr($v['code'],53,6),'0');
|
|
|
|
|
|
|
+ $list[$k]['num'] = $bach_detail['num'];
|
|
|
$list[$k]['matter_name'] = $bach_detail['matter_name'];
|
|
$list[$k]['matter_name'] = $bach_detail['matter_name'];
|
|
|
- $list[$k]['manufacture_date'] = date('Y-m-d',strtotime('20'.$bach_detail['manufacture_date']));
|
|
|
|
|
|
|
+ $list[$k]['total_boxes'] = $bach_detail['total_boxes'];
|
|
|
|
|
+ $list[$k]['tray_num'] = $bach_detail['tray_num'];
|
|
|
|
|
+ $list[$k]['box_num'] = $bach_detail['box_num'];
|
|
|
|
|
+ $list[$k]['pallet_height'] = $bach_detail['pallet_height'];
|
|
|
|
|
+ $list[$k]['pallet_length'] = $bach_detail['pallet_length'];
|
|
|
|
|
+ $list[$k]['pallet_width'] = $bach_detail['pallet_width'];
|
|
|
|
|
+ $list[$k]['larger_num'] = $bach_detail['larger_num'];
|
|
|
|
|
+ $list[$k]['manufacture_date'] = date('Y-m-d', strtotime('20'.$bach_detail['manufacture_date']));
|
|
|
$list[$k]['code'] = $v['code'];
|
|
$list[$k]['code'] = $v['code'];
|
|
|
- $small_num = $small->name($userInfo['company'].'_'.'qcode_small')->where('large_id',substr(json_encode($v['_id']),9,-2))->count();
|
|
|
|
|
|
|
+ $list[$k]['l_flow'] = ltrim(substr($v['code'], 53, 6), '0');
|
|
|
|
|
+
|
|
|
|
|
+ $small_num = $small->name($userInfo['company'].'_qcode_small')
|
|
|
|
|
+ ->where('large_id', $list[$k]['id'])
|
|
|
|
|
+ ->count();
|
|
|
$list[$k]['small_num'] = $small_num;
|
|
$list[$k]['small_num'] = $small_num;
|
|
|
}
|
|
}
|
|
|
- $result = ['total'=>$total,'rows'=>$list];
|
|
|
|
|
- return json($result);
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
+ // 返回分页数据(关键!不要再做分组排序!)
|
|
|
|
|
+ return json(['total' => $total, 'rows' => $list]);
|
|
|
|
|
+ }
|
|
|
/**
|
|
/**
|
|
|
* 小件列表
|
|
* 小件列表
|
|
|
* @return \think\response\Json
|
|
* @return \think\response\Json
|
|
@@ -204,7 +350,11 @@ class Deliver extends Backend
|
|
|
foreach (explode(',',$lager_id) as $kk=>$vv){
|
|
foreach (explode(',',$lager_id) as $kk=>$vv){
|
|
|
$n = $n + $small->name($userinfo['company'].'_'.'qcode_small')->where('large_id',$vv)->count();
|
|
$n = $n + $small->name($userinfo['company'].'_'.'qcode_small')->where('large_id',$vv)->count();
|
|
|
}
|
|
}
|
|
|
- $bachDetail = $bach->name($userinfo['company'].'_'.'qcode_bach')->where('_id',$bach_id[0])->find();
|
|
|
|
|
|
|
+// $bachDetail = $bach->name($userinfo['company'].'_'.'qcode_bach')->where('_id',$bach_id[0])->find();
|
|
|
|
|
+ $bachArray = $bach->name($userinfo['company'].'_'.'qcode_bach')
|
|
|
|
|
+ ->where('_id', $bach_id[0])
|
|
|
|
|
+ ->find();
|
|
|
|
|
+ $bachDetail = $bachArray ? $bachArray->toArray() : [];
|
|
|
if ($bachDetail['box_num'] === 1){
|
|
if ($bachDetail['box_num'] === 1){
|
|
|
$mater_type = 2;
|
|
$mater_type = 2;
|
|
|
}else{
|
|
}else{
|
|
@@ -213,12 +363,9 @@ class Deliver extends Backend
|
|
|
$exportData = $this->exportdata($bach_id,$lager_id,$userinfo['company'],$lager_num,$n);
|
|
$exportData = $this->exportdata($bach_id,$lager_id,$userinfo['company'],$lager_num,$n);
|
|
|
$file_dir = $this->exportExcel($exportData);
|
|
$file_dir = $this->exportExcel($exportData);
|
|
|
$row = [
|
|
$row = [
|
|
|
- 'username' => $bachDetail['supplier_name'],
|
|
|
|
|
- 'matter_name' => $bachDetail['matter_name'],
|
|
|
|
|
|
|
+ 'username' => $bachDetail['supplier_name'],//公司
|
|
|
'matter_no' => $bachDetail['matter_no'],
|
|
'matter_no' => $bachDetail['matter_no'],
|
|
|
'large_str' => $lager_id,
|
|
'large_str' => $lager_id,
|
|
|
- 'large_num' => $lager_num,
|
|
|
|
|
- 'small_num' => $n,
|
|
|
|
|
'status' => 0,
|
|
'status' => 0,
|
|
|
'bach_num' => $bachDetail['bach_num'],
|
|
'bach_num' => $bachDetail['bach_num'],
|
|
|
'note' => '',
|
|
'note' => '',
|
|
@@ -226,6 +373,17 @@ class Deliver extends Backend
|
|
|
'create_time' => time(),
|
|
'create_time' => time(),
|
|
|
'file_dir' => $file_dir,
|
|
'file_dir' => $file_dir,
|
|
|
'company_id' => $userinfo['company'],
|
|
'company_id' => $userinfo['company'],
|
|
|
|
|
+
|
|
|
|
|
+ 'large_num' => $lager_num,//你已选中 N 个大件【托盘数】
|
|
|
|
|
+ 'small_num' => $n,//共包含了 N 个小件
|
|
|
|
|
+ 'matter_name' => $bachDetail['matter_name'],//产品名称
|
|
|
|
|
+ 'total_boxes' => $bachDetail['total_boxes'],//每托箱数
|
|
|
|
|
+ 'tray_num' => $bachDetail['tray_num'],//每层箱数
|
|
|
|
|
+ 'box_num' => $bachDetail['box_num'],//每托层数
|
|
|
|
|
+ 'pallet_height' => $bachDetail['pallet_height'],//每托高度
|
|
|
|
|
+ 'pallet_length' => $bachDetail['pallet_length'],//托盘规格
|
|
|
|
|
+ 'pallet_width' => $bachDetail['pallet_width'],//托盘规格
|
|
|
|
|
+ 'larger_num' => $bachDetail['larger_num'],//总箱数
|
|
|
];
|
|
];
|
|
|
if ($bachDetail['box_num'] != 1){
|
|
if ($bachDetail['box_num'] != 1){
|
|
|
$row['num'] = $bachDetail['box_num'];
|
|
$row['num'] = $bachDetail['box_num'];
|
|
@@ -428,6 +586,15 @@ class Deliver extends Backend
|
|
|
->select();
|
|
->select();
|
|
|
$list=[];
|
|
$list=[];
|
|
|
foreach ($export_list as $k=>$v) {
|
|
foreach ($export_list as $k=>$v) {
|
|
|
|
|
+ $list[$k]['large_num'] = $v['large_num'];//托盘数量
|
|
|
|
|
+ $list[$k]['total_boxes'] = $v['total_boxes'];//每箱托数
|
|
|
|
|
+ $list[$k]['tray_num'] = $v['tray_num'];//每层箱数
|
|
|
|
|
+ $list[$k]['box_num'] = $v['box_num'];//每托层数
|
|
|
|
|
+ $list[$k]['pallet_height'] = $v['pallet_height'];//托盘高度
|
|
|
|
|
+ $list[$k]['pallet_length'] = $v['pallet_length'];//托盘规格
|
|
|
|
|
+ $list[$k]['pallet_width'] = $v['pallet_width'];//托盘规格
|
|
|
|
|
+ $list[$k]['small_num'] = $v['small_num'];//总箱数
|
|
|
|
|
+
|
|
|
$list[$k]['id'] = substr(json_encode($v['_id']),9,-2);
|
|
$list[$k]['id'] = substr(json_encode($v['_id']),9,-2);
|
|
|
$list[$k]['matter_name'] = $v['matter_name'];
|
|
$list[$k]['matter_name'] = $v['matter_name'];
|
|
|
$list[$k]['matter_no'] = $v['matter_no'];
|
|
$list[$k]['matter_no'] = $v['matter_no'];
|
|
@@ -685,6 +852,28 @@ class Deliver extends Backend
|
|
|
if ($good_list['note'] == 'NULL'){
|
|
if ($good_list['note'] == 'NULL'){
|
|
|
$good_list['note'] = '';
|
|
$good_list['note'] = '';
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ //新增代码
|
|
|
|
|
+ $good_array = $good_list ? $good_list->toArray() : [];
|
|
|
|
|
+ // 假设 $goodArray 是已经转为普通数组的结构
|
|
|
|
|
+ $dataList = $good_array['data'] ?? [];
|
|
|
|
|
+ // 步骤1:按照 create_time 升序排序
|
|
|
|
|
+ usort($dataList, function ($a, $b) {
|
|
|
|
|
+ return strtotime($a['create_time']) - strtotime($b['create_time']);
|
|
|
|
|
+ });
|
|
|
|
|
+ // 步骤2:添加 large_ber 字段
|
|
|
|
|
+ $start = 1;
|
|
|
|
|
+ foreach ($dataList as &$item) {
|
|
|
|
|
+ $count = intval($item['large_num']);
|
|
|
|
|
+ $end = $start + $count - 1;
|
|
|
|
|
+ $item['large_ber'] = ($start === $end) ? (string)$start : "$start-$end";
|
|
|
|
|
+ $start = $end + 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ unset($item);
|
|
|
|
|
+ $good_list['data'] = $dataList;
|
|
|
|
|
+// echo "<pre>";
|
|
|
|
|
+// print_r($dataList);
|
|
|
|
|
+// echo "</pre>";die;
|
|
|
return json(['code'=>1,'data'=>$good_list]);
|
|
return json(['code'=>1,'data'=>$good_list]);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|