liuhairui 1 年之前
父节点
当前提交
1c2984ca3f

+ 179 - 47
application/api/controller/Manufacture.php

@@ -941,6 +941,7 @@ class Manufacture extends Api
         $date = date('Y-m-d 00:00:00', time() - 1888000);
 
         $clwhere['mod_rq'] = null;
+//    $clwhere['sczl_jtbh'] = 'CQ03';
         $arr = \db('设备_产量计酬')
             ->field([
                 'DISTINCT(date_format(sczl_rq,"%Y-%m-%d"))' => '时间',
@@ -950,6 +951,7 @@ class Manufacture extends Api
             ->where($clwhere)
             ->order('sczl_rq desc')
             ->select();
+
         $list = ['裁剪','车缝', '手工', '大烫', '总检', '包装'];
 
         $MachineList = \db('设备_基本资料')
@@ -998,6 +1000,10 @@ class Manufacture extends Api
                 }
             }
         }
+
+        // 对年月份进行降序排序,使最新的月份在最上面
+        krsort($formattedData);
+
         $this->success('成功', $formattedData);
     }
 
@@ -1006,62 +1012,56 @@ class Manufacture extends Api
     /**
      * 月度车间报工汇总-列表数据
      */
-    public function MachineDetail()
-    {
+    public function MachineDetail(){
         if ($this->request->isGet() === false){
             $this->error('请求错误');
         }
-
         $param = $this->request->param();
         if (empty($param)){
             $this->error('参数错误');
         }
-
         $where = [];
-
-
         if (isset($param['date'])) {
             // 检查 `date` 的格式是否为 "YYYY-MM" 或 "MM-DD"
             if (preg_match('/^\d{4}-\d{2}$/', $param['date'])) {
                 // 如果格式为 "YYYY-MM",则查询当月数据
-                $where['a.sczl_rq'] = ['like', "{$param['date']}%"];
+                $where['a.sys_rq'] = ['like', "{$param['date']}%"];
             } elseif (preg_match('/^\d{2}-\d{2}$/', $param['date'])) {
                 // 如果格式为 "MM-DD",则查询指定的月份和日期
                 $monthDay = $param['date'];
-                $where['a.sczl_rq'] = ['like', "%-$monthDay%"];
+                $where['a.sys_rq'] = ['like', "%-$monthDay%"];
             }
         }
-
         // 判断是否传入订单编号参数
         if(!empty($param['order'])){
-            $where['b.订单编号'] = $param['order'];
+            $where['b.订单编号|b.款号'] = ['like','%'.$param['order'].'%'];
         }
+        $where['a.sczl_jtbh'] = $param['machine'];//机台号
+
 
-        $where['a.sczl_jtbh'] = $param['machine'];
         $list = \db('设备_产量计酬')->alias('a')
             ->join('工单_印件资料 b', 'b.订单编号 = a.订单编号 AND a.子订单编号 = a.子订单编号')
             ->join('工单_基本资料 j', 'b.订单编号 = j.订单编号', 'LEFT')
             ->field('
                 b.订单编号, b.子订单编号, b.款号, b.颜色, b.船样, a.尺码, b.zdtotal as 制单数,b.颜色备注,
-                a.数量 as 已完成, a.sys_rq as 上报时间,a.UniqId,
+                a.数量, MIN(a.sys_rq)  as 上报时间,a.UniqId,
                 j.客户编号,j.生产款号,j.款式
                 ')
             ->where($where)
             ->where('a.mod_rq',null)
-            ->order('a.sczl_rq desc')
+            ->order('a.UniqId asc')
             ->group('a.UniqId')
             ->select();
 
         // 提取所有的尺码,并去重
         $sizeList = array_values(array_unique(array_column($list, '尺码')));
-
         // 动态将尺码的数量添加到每个订单中,并替换已完成字段
         foreach ($list as &$item) {
             $size = $item['尺码'];
-            $item[$size] = $item['已完成']; // 动态添加尺码字段,值为数量
-            unset($item['已完成']); // 移除原来的已完成字段
+            $item[$size] = $item['数量'];
+//            unset($item['数量']);
         }
-
+        sort($sizeList);
         // 返回结果
         $this->success('请求成功', [
             'table' => $list,
@@ -1114,17 +1114,34 @@ class Manufacture extends Api
         }
         $param = $this->request->param();
         if (isset($param)){
-            $where['订单编号'] = ['like','%'.$param['search'].'%'];
+            $where['订单编号|生产款号'] = ['like','%'.$param['search'].'%'];
         }
 //        $where['审核'] = null;
 //        $where['审核日期'] = null;
         $where['Mod_rq'] = null;
         $list = \db('工单_基本资料')
             ->where($where)
-            ->orderRaw("FIELD(gd_statu, '1-计划中', '2-生产中')")  // 自定义状态排序,'1-计划中'排在前
-            ->order('订单编号 desc')  // 按订单编号降序排序
+            ->orderRaw("FIELD(gd_statu, '1-计划中', '2-生产中')")
+            ->order('订单编号 desc')
             ->select();
-        $this->success('成功',$list);
+        // 提取所有订单编号
+        $orderIds = array_column($list, '订单编号');
+        // 查询相关附件中是否存在这些订单编号
+        $relatedOrders = \db('工单_相关附件')
+            ->whereIn('关联编号', $orderIds)
+            ->whereIn('附件备注', '技术附件')
+            ->column('关联编号');
+        // 遍历数据,为每个订单设置 status
+        foreach ($list as &$value) {
+            if (in_array($value['订单编号'], $relatedOrders)) {
+                $value['status'] = '';
+            } else {
+                $value['status'] = '*';
+            }
+        }
+        $data['total'] = count($list);
+        $data['table'] = $list;
+        $this->success('成功',$data);
     }
 
     /**
@@ -1135,7 +1152,7 @@ class Manufacture extends Api
         $param = $this->request->param();
         // 处理搜索条件
         if (isset($param['search'])){
-            $where['j.订单编号'] = ['like','%'.$param['search'].'%'];
+            $where['j.订单编号|j.生产款号'] = ['like','%'.$param['search'].'%'];
         }
         if (isset($param['client'])){
             $where['j.客户编号'] = $param['client'];
@@ -1148,7 +1165,7 @@ class Manufacture extends Api
         // 只查询生产中的工单
         $where['j.gd_statu'] = '2-生产中';
         $where['j.Mod_rq'] = null;
-        // 查询工单基本资料,获取订单编号和其他基本信息
+
         $orderList = \db('工单_基本资料')
             ->alias('j')
             ->join('工单_印件资料 y', 'j.订单编号 = y.订单编号')
@@ -1156,6 +1173,7 @@ class Manufacture extends Api
             ->group('y.订单编号')  // 去重订单编号
             ->where($where)
             ->select();
+
         $orderIds = array_column($orderList, '订单编号');
         // 通过订单编号关联设备_产量计酬表,获取工序名称和数量,并进行分组和汇总
         $processList = \db('设备_产量计酬')
@@ -1269,8 +1287,8 @@ class Manufacture extends Api
     {
 
     }
-
-    /**车缝派单菜单
+    /**
+     * 车缝派单菜单
      * @return void
      */
     public function CfmachineList()
@@ -1278,41 +1296,59 @@ class Manufacture extends Api
         if ($this->request->isGet() === false) {
             $this->error('请求错误');
         }
+
         // 查询所有生产工序为"车缝"的设备编号和设备编组
         $machineList = \db('设备_基本资料')
             ->where('生产工序', '车缝')
             ->field('设备编号, 设备编组')
+            ->order('设备编号') // 按设备编号排序
             ->select();
+
         $result = [];
+
         foreach ($machineList as $machine) {
             $machineCode = $machine['设备编号'];
             $machineGroup = $machine['设备编组'];
-            // 查询该设备编号在 设备_产量计酬 表中的订单编号
+
+            // 查询该设备编号在 设备_产量计酬 表中的订单编号及日期
             $orders = \db('设备_产量计酬')
                 ->where('sczl_jtbh', $machineCode)
                 ->where('mod_rq', null)
-                ->column('订单编号');
+                ->order('sys_rq asc') // 按生产日期升序排序
+                ->select();
 
-            // 去重统计订单编号数量
-            $workOrderCount = count(array_unique($orders));
+            // 根据月份分组统计订单数量
+            $monthlyOrders = [];
+            foreach ($orders as $order) {
+                $yearMonth = date('Ym', strtotime($order['sys_rq']));
+                if (!isset($monthlyOrders[$yearMonth])) {
+                    $monthlyOrders[$yearMonth] = [];
+                }
+                $monthlyOrders[$yearMonth][] = $order['订单编号'];
+            }
 
             // 构建返回数据,格式为:设备编号【设备编组 生产中:工单数量】
-            $result[] = $machineCode . '【' . $machineGroup . ' 生产中:' . $workOrderCount . '】';
+            foreach ($monthlyOrders as $yearMonth => $orderList) {
+                $workOrderCount = count(array_unique($orderList));
+                if (!isset($result[$yearMonth])) {
+                    $result[$yearMonth] = [];
+                }
+                // 使用集合来去重设备编号
+                $deviceKey = $machineCode . '【' . $machineGroup . ' 生产中:' . $workOrderCount . '】';
+                if (!in_array($deviceKey, $result[$yearMonth])) {
+                    $result[$yearMonth][] = $deviceKey;
+                }
+            }
         }
-        $yearMonth = date('Ym');
-        $finalResult = [
-            $yearMonth => $result
-        ];
-        $this->success('成功', $finalResult);
-    }
 
+        // 按月份排序,确保最新的月份在前面
+        krsort($result);
 
-    /**
+        $this->success('成功', $result);
+    }
+
+        /**
      * 车缝派单列表
-     * @return void
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
      */
     public function CfdataList()
     {
@@ -1321,27 +1357,123 @@ class Manufacture extends Api
         }
 
         $param = $this->request->param();
-        if (empty($param)) {
+        if (empty($param['machine']) || empty($param['date'])) {
             $this->error('参数错误');
         }
 
+        // 将传入的 YYYYMM 格式日期转换为 YYYY-MM-01
+        $year = substr($param['date'], 0, 4);
+        $month = substr($param['date'], 4, 2);
+        $startDate = "$year-$month-01 00:00:00";
+        $endDate = date("Y-m-t 23:59:59", strtotime($startDate)); // 获取该月的最后一天
+
         // 查询设备产量计酬与工单基本资料的关联数据
         $list = \db('设备_产量计酬')->alias('c')
             ->join('工单_基本资料 j', 'c.订单编号 = j.订单编号', 'left')
             ->where('c.sczl_jtbh', $param['machine'])
-            ->where('j.mod_rq', null)
+            ->where('c.mod_rq', null)
+            ->where('c.sczl_rq', '>=', $startDate)
+            ->where('c.sczl_rq', '<=', $endDate)
             ->field('
-            j.订单编号, j.生产款号, j.款式, j.客户编号, j.订单数量, 
-            LEFT(j.落货日期, 10) as 落货日期,  -- 只保留日期部分
-            j.Sys_rq as 创建时间, j.gd_statu as 工单状态
+            c.订单编号, c.款号, j.款式, j.客户编号, j.订单数量,
+            LEFT(j.落货日期, 10) as 落货日期,
+            c.sczl_rq as 创建时间, j.gd_statu as 工单状态
         ')
-            ->group('j.订单编号')
+            ->group('c.订单编号')
             ->select();
 
         // 返回数组结果
         $this->success('请求成功', ['table' => $list, 'length' => count($list)]);
     }
 
+    //
+//    /**车缝派单菜单
+//     * @return void
+//     */
+//    public function CfmachineList()
+//    {
+//        if ($this->request->isGet() === false) {
+//            $this->error('请求错误');
+//        }
+//
+//        // 查询所有生产工序为"车缝"的设备编号和设备编组
+//        $machineList = \db('设备_基本资料')
+//            ->where('生产工序', '车缝')
+//            ->field('设备编号, 设备编组')
+//            ->order('设备编号') // 按设备编号排序
+//            ->select();
+//
+//        $result = [];
+//        $addedMachineCodes = []; // 用于跟踪已经添加的设备编号
+//
+//        foreach ($machineList as $machine) {
+//            $machineCode = $machine['设备编号'];
+//            $machineGroup = $machine['设备编组'];
+//
+//            // 检查是否已经添加过该设备编号
+//            if (in_array($machineCode, $addedMachineCodes)) {
+//                continue; // 跳过已添加的设备
+//            }
+//
+//            // 查询该设备编号在 设备_产量计酬 表中的订单编号
+//            $orders = \db('设备_产量计酬')
+//                ->where('sczl_jtbh', $machineCode)
+//                ->order('sys_rq desc')
+//                ->where('mod_rq', null)
+//                ->column('订单编号');
+//
+//            // 去重统计订单编号数量
+//            $workOrderCount = count(array_unique($orders));
+//
+//            // 构建返回数据,格式为:设备编号【设备编组 生产中:工单数量】
+//            $result[] = $machineCode . '【' . $machineGroup . ' 生产中:' . $workOrderCount . '】';
+//
+//            // 将设备编号添加到跟踪数组中
+//            $addedMachineCodes[] = $machineCode;
+//        }
+//
+//        $yearMonth = date('Ym');
+//        $finalResult = [
+//            $yearMonth => $result
+//        ];
+//
+//        $this->success('成功', $finalResult);
+//    }
+//
+//
+//    /**
+//     * 车缝派单列表
+//     */
+//    public function CfdataList()
+//    {
+//        if ($this->request->isGet() === false) {
+//            $this->error('请求错误');
+//        }
+//
+//        $param = $this->request->param();
+//        if (empty($param)) {
+//            $this->error('参数错误');
+//        }
+//
+//        // 查询设备产量计酬与工单基本资料的关联数据
+//        $list = \db('设备_产量计酬')->alias('c')
+//            ->join('工单_基本资料 j', 'c.订单编号 = j.订单编号', 'left')
+//            ->where('c.sczl_jtbh', $param['machine'])
+//            ->where('c.mod_rq', null)
+//            ->field('
+//            c.订单编号, c.款号, j.款式, j.客户编号, j.订单数量,
+//            LEFT(j.落货日期, 10) as 落货日期,
+//            j.Sys_rq as 创建时间, j.gd_statu as 工单状态
+//        ')
+//            ->group('c.订单编号')
+//            ->select();
+//
+//
+//        // 返回数组结果
+//        $this->success('请求成功', ['table' => $list, 'length' => count($list)]);
+//    }
+
+
 
     //车缝派单删除
     public function CfdataDel()

+ 408 - 245
application/api/controller/WorkOrder.php

@@ -107,44 +107,46 @@ class WorkOrder extends Api
      */
     public function WorkOrderList()
     {
-        if ($this->request->isGet() === false){
+        if ($this->request->isGet() === false) {
             $this->error('请求错误');
         }
+
         $search = input('search');
-        //页数
         $page = input('page');
-        //条数
         $limit = input('limit');
         $param = $this->request->param();
+
         $where = [];
-        if (!empty($search)){
-            $where['订单编号|生产款号|客户编号|款式|审核|Sys_id'] = ['like','%'.$search.'%'];
+        if (!empty($search)) {
+            $where['订单编号|生产款号|客户编号|款式|审核|Sys_id'] = ['like', '%' . $search . '%'];
         }
         $where['Mod_rq'] = null;
-//        $total = \db('工单_基本资料')->where($where)->distinct(true)->count();
-//         $list = \db('工单_基本资料')
-//             ->where($where)
-//             ->order('订单编号 desc,Gd_statu desc,Sys_rq desc')
-//             ->limit(($page-1)*$limit,$limit)
-// //            ->limit($page,$limit)
-//             ->select();
-        $total = \db('工单_基本资料')->where($where)->distinct(true)->count();
+
         $list = \db('工单_基本资料')
             ->where($where)
-            ->order('订单编号 desc,Gd_statu desc,Sys_rq desc')
-            ->limit(($page-1)*$limit,$limit)
+            ->order('订单编号 desc, Gd_statu desc, Sys_rq desc')
+            ->limit(($page - 1) * $limit, $limit)
             ->select();
 
-        foreach ($list as $key=>$value){
-            $number = \db('工单_工艺资料')->where('订单编号',$value['订单编号'])->count();
-            if ($number === 0){
-                $list[$key]['status'] = '*';
-            }else{
-                $list[$key]['status'] = '';
+        // 提取所有订单编号
+        $orderIds = array_column($list, '订单编号');
+
+        // 查询所有在“工单_相关附件”表中存在的订单编号
+        $relatedOrders = \db('工单_相关附件')
+            ->whereIn('关联编号', $orderIds)
+            ->whereIn('附件备注', '技术附件')
+            ->column('关联编号');
+
+        // 遍历数据,判断每个订单编号是否在相关附件表中
+        foreach ($list as &$value) {
+            if (in_array($value['订单编号'], $relatedOrders)) {
+                $value['status'] = '';  // 有相关附件,status为空
+            } else {
+                $value['status'] = '*'; // 没有相关附件,标记为新订单
             }
         }
-//        $this->success('成功',['data'=>$list,'total'=>$total]);
-        $this->success('成功',['data'=>$list,'total'=>count($list)]);
+
+        $this->success('成功', ['data' => $list, 'total' => count($list)]);
     }
 
 
@@ -326,7 +328,7 @@ class WorkOrder extends Api
         $data = \db('工单_基本资料')->alias('j')
             ->field('j.客户编号, REPLACE(DATE_FORMAT(j.Sys_rq, "%Y-%m"), "-", "") as 年月, GROUP_CONCAT(DISTINCT j.订单编号) as 订单编号')
             ->where($where)
-            ->order('j.Sys_rq desc')
+            ->order('j.客户编号 asc')
             ->group('j.客户编号, 年月')
             ->select();
         $result = [];
@@ -1530,7 +1532,7 @@ class WorkOrder extends Api
         }
 
         // 自定义型号排序
-        $customOrder = array('XS','S', 'M', 'L', 'XL', '2XL', '3XL', '4XL');
+        $customOrder = array('XS','S', 'M', 'L', 'XL','XXL', '2XL', '3XL', '4XL');
         usort($arr, function ($a, $b) use ($customOrder) {
             $posA = array_search($a, $customOrder);
             $posB = array_search($b, $customOrder);
@@ -1578,60 +1580,55 @@ class WorkOrder extends Api
     }
 
     /**
-     * 工单资料管理->工艺资料删除
-     * @return void
-     * @throws \think\Exception
-     * @throws \think\exception\PDOException
+     * 月度车间报工汇总->报工删除记录
      */
-//    public function ProcessDetailDel()
-//    {
-//        if ($this->request->isGet() === false){
-//            $this->error('请求错误');
-//        }
-//        $param = $this->request->param();
-//        if (isset($param['UniqId']) === false){
-//            $this->error('参数错误');
-//        }
-//        $printId = explode(',',$param['UniqId']);
-//        $i = 0;
-//        //获取工单编号、印件号
-//        $codeList = \db('工单_工艺资料')
-//            ->where('UniqId',$printId[0])
-//            ->field('rtrim(Gy0_gdbh) as 工单编号,rtrim(Gy0_yjno) as 印件号')
-//            ->find();
-//        //获取平张投料数量
-//        $number = \db('工单_印件资料')
-//            ->where([
-//                'Yj_Gdbh' => $codeList['工单编号'],
-//                'yj_Yjno' => $codeList['印件号']
-//            ])
-//            ->value('rtrim(yj_平张投料)');
-//        //循环删除工艺资料
-//        foreach ($printId as $value){
-//            $res = \db('工单_工艺资料')
-//                ->where('UniqId',$value)
-//                ->delete();
-//            if ($res === false){
-//                $i++;
-//            }
-//        }
-//        //重新分配工艺计划产量
-//        if ((int)$number>0){
-//            $this->PlannedProcessYield($codeList['工单编号'],$codeList['印件号'],0,$number);
-//        }
-//        if ($i === 0){
-//            $this->success('删除成功');
-//        }else{
-//            $this->error('删除失败');
-//        }
-//    }
+    public function ProcessDetailDel()
+    {
+        if ($this->request->isGet() === false){
+            $this->error('请求错误');
+        }
+//        $where['mod_rq'] = ['neq', ''];
+//        $list = \db('设备_产量计酬')->alias('c')
+//            ->field('c.订单编号,j.客户编号,c.mod_rq,c.delsys_id,c.款号,j.款式,,,,,,,,')
+//            ->join('工单_基本资料 j', 'c.订单编号 = j.订单编号', 'left')
+//            ->where($where)
+//            ->order('c.mod_rq desc')
+//            ->select();
+//        echo "<pre>";
+//        print_r($list);
+//        echo "<pre>";
+
+        $where['a.mod_rq'] = ['neq', ''];
+        $list = \db('设备_产量计酬')->alias('a')
+            ->join('工单_印件资料 b', 'b.订单编号 = a.订单编号 AND a.子订单编号 = a.子订单编号')
+            ->join('工单_基本资料 j', 'b.订单编号 = j.订单编号', 'LEFT')
+            ->field('
+                b.订单编号, b.子订单编号, b.款号, b.颜色, b.船样, a.尺码, b.zdtotal as 制单数,b.颜色备注,
+                a.数量, a.sys_rq as 上报时间,a.UniqId,a.mod_rq,a.delsys_id,a.sczl_bh,
+                j.客户编号,j.生产款号,j.款式
+                ')
+            ->where($where)
+            ->order('a.mod_rq desc')
+            ->group('a.UniqId')
+            ->select();
+
+        // 提取所有的尺码,并去重
+        $sizeList = array_values(array_unique(array_column($list, '尺码')));
+
+        // 动态将尺码的数量添加到每个订单中,并替换已完成字段
+        foreach ($list as &$item) {
+            $size = $item['尺码'];
+            $item[$size] = $item['数量']; // 动态添加尺码字段,值为数量
+//            unset($item['数量']); // 移除原来的已完成字段
+        }
+
+        $data['total'] = count($list);
+        $data['table'] = $list;
+        $this->success('成功',$data);
+    }
 
     /**
      * 工艺资料添加->工序损耗代码
-     * @return void
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
      */
 //    public function WastageList()
 //    {
@@ -2326,77 +2323,160 @@ class WorkOrder extends Api
 //    }
 
 
-    public function orderPrint()
-    {
-        if ($this->request->isGet() === false){
-            $this->error('请求错误');
-        }
+    public function orderPrint(){
+        if ($this->request->isGet() === false){$this->error('请求错误');}
         $param = $this->request->param();
-        if (empty($param['order'])){
-            $this->error('参数错误');
+        if (empty($param['order'])){$this->error('参数错误');}
+
+        //订单信息
+        $list = \db('工单_基本资料')
+            ->where('订单编号',$param['order'])
+            ->where('Mod_rq',null)
+            ->field('订单编号,img,生产款号,客户编号,款式,落货日期,箱唛要求,面料,船样描述,船样合计,粘衬,订单数量,审核,审核日期,要求')
+            ->find();
+
+        //表格表头
+        $xhdata = \db('工单_印件资料')
+            ->where('订单编号',$param['order'])
+            ->where('Mod_rq',null)
+            ->field('cm1,cm2,cm3,cm4,cm5,cm6,cm7,cm8,cm9,cm10')
+            ->select();
+        $arr = [];
+        foreach ($xhdata as $key => $value){
+            for($i=1;$i<=10;$i++){
+                if ($value['cm'.$i] !== '' && $value['cm'.$i] !== null){
+                    array_push($arr,$value['cm'.$i]);
+                }
+            }
         }
+        $arr = array_unique($arr);
 
-        $wheres['Mod_rq'] = null;
 
+
+        $where['Mod_rq'] = null;
         $porlis = \db('工单_印件资料')
             ->where('订单编号',$param['order'])
             ->where('船样',0)
-            ->where($wheres)
+            ->where($where)
             ->field('子订单编号')
             ->select();
-
         $subOrder = $porlis[0]['子订单编号'];
         // 找到子订单编号中的 '-' 位置
         $dashPos = strpos($subOrder, '-');
+
         if ($dashPos !== false) {
             // 提取 '-' 后面的部分
             $afterDash = substr($subOrder, $dashPos + 1);
+
             // 判断长度是否等于2或等于4
             if (strlen($afterDash) == 2) {
-                $where['Mod_rq'] = null;
-                $list = \db('工单_基本资料')
-                    ->where('订单编号',$param['order'])
-                    ->where($where)
-                    ->field('订单编号,img,生产款号,客户编号,款式,落货日期,箱唛要求,面料,船样描述,船样合计,粘衬,订单数量,审核,审核日期,要求')
-                    ->find();
-
-                //表格表头
-                $xhdata = \db('工单_印件资料')
-                    ->where('订单编号',$param['order'])
-                    ->where('船样',0)
-                    ->where($where)
-                    ->field('cm1,cm2,cm3,cm4,cm5,cm6,cm7,cm8,cm9,cm10')
-                    ->select();
-                $arr = [];
-                foreach ($xhdata as $key => $value){
-                    for($i=1;$i<=10;$i++){
-                        if ($value['cm'.$i] !== '' && $value['cm'.$i] !== null){
-                            array_push($arr,$value['cm'.$i]);
-                        }
-                    }
-                }
-                $arr = array_unique($arr);
-                // 初始打印格式
+//                // 查询船样为0的数据
+//                $processlist = \db('工单_印件资料')
+//                    ->where('订单编号', $param['order'])
+//                    ->where($where)
+//                    ->where('船样', 0)
+//                    ->field('子订单编号,颜色,款号,zdtotal,颜色备注,color_id,
+//        cm1,cm2,cm3,cm4,cm5,cm6,cm7,cm8,cm9,cm10,
+//        cmsl1,cmsl2,cmsl3,cmsl4,cmsl5,cmsl6,cmsl7,cmsl8,cmsl9,cmsl10,Uniqid')
+//                    ->select();
+//
+//                foreach ($processlist as $key => $value) {
+//                    // 将尺码和对应的数量从 cm1-cm10 和 cmsl1-cmsl10 转换为动态键值对
+//                    for ($i = 1; $i <= 10; $i++) {
+//                        if ($value['cm' . $i] !== '' && $value['cm' . $i] !== null) {
+//                            $processlist[$key][$value['cm' . $i]] = $value['cmsl' . $i];
+//                        }
+//                        // 移除���始的 cm 和 cmsl 字段
+//                        unset($processlist[$key]['cm' . $i], $processlist[$key]['cmsl' . $i]);
+//                    }
+//                    // 添加条码字段,值为子订单编号
+//                    $processlist[$key]['条码'] = $value['子订单编号'];
+//                }
+//
+//// 用于存储合并后的数据
+//                $mergedData = [];
+//
+//// 按颜色备注进行合并
+//                foreach ($processlist as $item) {
+//                    $key = $item['颜色备注'];
+//
+//                    if (!isset($mergedData[$key])) {
+//                        $mergedData[$key] = $item;
+//                    } else {
+//                        // 合并尺码对应的数量
+//                        foreach ($item as $size => $quantity) {
+//                            if (is_numeric($size)) {
+//                                if (!isset($mergedData[$key][$size])) {
+//                                    $mergedData[$key][$size] = 0;
+//                                }
+//                                $mergedData[$key][$size] += $quantity;
+//                            }
+//                        }
+//                        // 合并 zdtotal
+//                        $mergedData[$key]['zdtotal'] += $item['zdtotal'];
+//                    }
+//                }
+//
+//// 将合并后的数据转换为索引数组
+//                $processlist = array_values($mergedData);
+//
+//// 如果有 0 的值,清空为 ''
+//                foreach ($processlist as &$row) {
+//                    foreach ($row as $key => $value) {
+//                        if ($value === 0) {
+//                            $row[$key] = '';
+//                        }
+//                    }
+//                }
+//
+//// 对数组进行排序
+//                sort($processlist);
+//
+//// 自定义排序顺序
+//                $customOrder = ['XXS', 'XS', 'S', 'M', 'L', 'XL', 'XXL'];
+//                usort($processlist, function($a, $b) use ($customOrder) {
+//                    $posA = array_search($a, $customOrder);
+//                    $posB = array_search($b, $customOrder);
+//                    return $posA - $posB;
+//                });
+//
+//// 查询船样为1的数据
+//                $chuanyang = \db('工单_印件资料')
+//                    ->where('订单编号', $param['order'])
+//                    ->where($where)
+//                    ->where('船样', 1)
+//                    ->field('子订单编号,颜色,款号,zdtotal,颜色备注,color_id,
+//        cm1,cm2,cm3,cm4,cm5,cm6,cm7,cm8,cm9,cm10,
+//        cmsl1,cmsl2,cmsl3,cmsl4,cmsl5,cmsl6,cmsl7,cmsl8,cmsl9,cmsl10,Uniqid')
+//                    ->select();
+//
+//                foreach ($chuanyang as $key => $value) {
+//                    // 将尺码和对应的数量从 cm1-cm10 和 cmsl1-cmsl10 转换为动态键值对
+//                    for ($i = 1; $i <= 10; $i++) {
+//                        if ($value['cm' . $i] !== '' && $value['cm' . $i] !== null) {
+//                            $chuanyang[$key][$value['cm' . $i]] = $value['cmsl' . $i];
+//                        }
+//                        // 移除原始的 cm 和 cmsl 字段
+//                        unset($chuanyang[$key]['cm' . $i], $chuanyang[$key]['cmsl' . $i]);
+//                    }
+//                    // 添加条码字段,值为子订单编号
+//                    $chuanyang[$key]['条码'] = $value['子订单编号'];
+//                }
+//
+//// 将船样为1的数据添加到船样为0的数据后面
+//                $finalList = array_merge($processlist, $chuanyang);
+//
+//                $data['process'] = $finalList;
+                // 查询船样为0的数据
                 $processlist = \db('工单_印件资料')
                     ->where('订单编号', $param['order'])
                     ->where($where)
                     ->where('船样', 0)
                     ->field('子订单编号,颜色,款号,zdtotal,颜色备注,color_id,
-        cm1,cm2,cm3,cm4,cm5,cm6,cm7,cm8,cm9,cm10,
-        cmsl1,cmsl2,cmsl3,cmsl4,cmsl5,cmsl6,cmsl7,cmsl8,cmsl9,cmsl10,Uniqid')
+cm1,cm2,cm3,cm4,cm5,cm6,cm7,cm8,cm9,cm10,
+cmsl1,cmsl2,cmsl3,cmsl4,cmsl5,cmsl6,cmsl7,cmsl8,cmsl9,cmsl10,Uniqid')
                     ->select();
 
-                if (!$processlist) {
-                    $processlist = \db('工单_印件资料')
-                        ->where('订单编号', $param['order'])
-                        ->where('船样', 0)
-                        ->where($where)
-                        ->field('子订单编号,颜色,款号,zdtotal,颜色备注,color_id,
-            cm1,cm2,cm3,cm4,cm5,cm6,cm7,cm8,cm9,cm10,
-            cmsl1,cmsl2,cmsl3,cmsl4,cmsl5,cmsl6,cmsl7,cmsl8,cmsl9,cmsl10,Uniqid')
-                        ->select();
-                }
-
                 foreach ($processlist as $key => $value) {
                     // 将尺码和对应的数量从 cm1-cm10 和 cmsl1-cmsl10 转换为动态键值对
                     for ($i = 1; $i <= 10; $i++) {
@@ -2406,148 +2486,208 @@ class WorkOrder extends Api
                         // 移除原始的 cm 和 cmsl 字段
                         unset($processlist[$key]['cm' . $i], $processlist[$key]['cmsl' . $i]);
                     }
-                    // 添加条码字段,值为子订单编号
-                    $processlist[$key]['条码'] = $value['子订单编号'];
                 }
 
-                // 如果有 0 的值,清空为 ''
-                foreach ($processlist as &$row) {
-                    foreach ($row as $key => $value) {
-                        if ($value === 0) {
-                            $row[$key] = '';
+// 用于存储合并后的数据
+                $mergedData = [];
+
+// 按颜色备注进行合并
+                foreach ($processlist as $item) {
+                    $key = $item['颜色备注'];
+
+                    if (!isset($mergedData[$key])) {
+                        $mergedData[$key] = $item;
+                        // 添加条码字段,值为子订单编号
+                        $mergedData[$key]['条码'] = $item['子订单编号'];
+                    } else {
+                        // 合并尺码对应的数量
+                        foreach ($item as $size => $quantity) {
+                            if (is_numeric($size)) {
+                                if (!isset($mergedData[$key][$size])) {
+                                    $mergedData[$key][$size] = 0;
+                                }
+                                $mergedData[$key][$size] += $quantity;
+                            }
                         }
+                        // 合并 zdtotal
+                        $mergedData[$key]['zdtotal'] += $item['zdtotal'];
                     }
                 }
-                sort($arr);
-                $customOrder = ['XXS','XS', 'S', 'M', 'L', 'XL', 'XXL'];
-                usort($arr, function($a, $b) use ($customOrder) {
-                    $posA = array_search($a, $customOrder);
-                    $posB = array_search($b, $customOrder);
-                    return $posA - $posB;
-                });
-                $data['order'] = $list;
-                $data['xhdata'] = $arr;
-                $data['print'] = 1;
-                $data['process'] = $processlist;
-                $this->success('成功',$data);
-            } elseif (strlen($afterDash) == 4) {
-                $where['Mod_rq'] = null;
-                $list = \db('工单_基本资料')
-                    ->where('订单编号',$param['order'])
-                    ->where($where)
-                    ->field('订单编号,img,生产款号,客户编号,款式,落货日期,箱唛要求,面料,船样描述,船样合计,粘衬,订单数量,审核,审核日期,要求')
-                    ->find();
 
-                //表格表头
-                $xhdata = \db('工单_印件资料')
-                    ->where('订单编号',$param['order'])
-                    ->where('船样',0)
+// 查询船样为1的数据
+                $chuanyang = \db('工单_印件资料')
+                    ->where('订单编号', $param['order'])
                     ->where($where)
-                    ->field('cm1,cm2,cm3,cm4,cm5,cm6,cm7,cm8,cm9,cm10')
+                    ->where('船样', 1)
+                    ->field('子订单编号,颜色,款号,zdtotal,颜色备注,color_id,
+cm1,cm2,cm3,cm4,cm5,cm6,cm7,cm8,cm9,cm10,
+cmsl1,cmsl2,cmsl3,cmsl4,cmsl5,cmsl6,cmsl7,cmsl8,cmsl9,cmsl10,Uniqid')
                     ->select();
-                $arr = [];
-                foreach ($xhdata as $key => $value){
-                    for($i=1;$i<=10;$i++){
-                        if ($value['cm'.$i] !== '' && $value['cm'.$i] !== null){
-                            array_push($arr,$value['cm'.$i]);
+
+                foreach ($chuanyang as $key => $value) {
+                    // 将尺码和对应的数量从 cm1-cm10 和 cmsl1-cmsl10 转换为动态键值对
+                    for ($i = 1; $i <= 10; $i++) {
+                        if ($value['cm' . $i] !== '' && $value['cm' . $i] !== null) {
+                            $chuanyang[$key][$value['cm' . $i]] = $value['cmsl' . $i];
                         }
+                        // 移除原始的 cm 和 cmsl 字段
+                        unset($chuanyang[$key]['cm' . $i], $chuanyang[$key]['cmsl' . $i]);
                     }
+                    // 添加条码字段,值为子订单编号
+                    $chuanyang[$key]['条码'] = $value['子订单编号'];
                 }
-                $arr = array_unique($arr);
 
-                // 初始数据查询
+// 将合并后的数据插入到相应颜色备注的原始数据尾部
+                $finalList = [];
+                $groupedData = [];
+
+// 将原始数据按颜色备注分组
+                foreach ($processlist as $item) {
+                    $key = $item['颜色备注'];
+                    if (!isset($groupedData[$key])) {
+                        $groupedData[$key] = [];
+                    }
+                    $groupedData[$key][] = $item;
+                }
+
+// 将合并后的数据插入到对应的颜色备注组的尾部
+                foreach ($groupedData as $key => $items) {
+                    $finalList = array_merge($finalList, $items); // 先添加原始数据
+                    if (isset($mergedData[$key])) {
+                        $finalList[] = $mergedData[$key]; // 在组的尾部添加合并数据
+                    }
+                }
+
+// 将船样为1的数据添加到最终列表中
+                $finalList = array_merge($finalList, $chuanyang);
+
+// 最终数据结构
+                $data['process'] = $finalList;
+
+
+                $data['order'] = $list;
+                $data['xhdata'] = $arr;
+                $this->success('成功',$data);
+            } elseif (strlen($afterDash) == 4) {
+                // 获取印件资料
                 $processlist = \db('工单_印件资料')
                     ->where('订单编号', $param['order'])
                     ->where($where)
                     ->where('船样', 0)
-                    ->field('子订单编号, 颜色, 款号, zdtotal, 颜色备注, color_id,
+                    ->field('子订单编号, 颜色, 款号, zdtotal, 颜色备注, color_id, 船样,
              cm1, cm2, cm3, cm4, cm5, cm6, cm7, cm8, cm9, cm10,
              cmsl1, cmsl2, cmsl3, cmsl4, cmsl5, cmsl6, cmsl7, cmsl8, cmsl9, cmsl10, Uniqid')
                     ->select();
 
-                $mergedList = [];
-                $summaryList = []; // 存储汇总数据
+// 保存格式化后的数据
+                $formattedData = [];
 
+// 遍历数据进行尺码转换并添加到输出数组
                 foreach ($processlist as $item) {
-                    $colorId = $item['color_id'];
-                    $subOrderPrefix = substr($item['子订单编号'], 0, -2); // 获取子订单编号的前几位
-                    $subOrderSuffix = substr($item['子订单编号'], -2); // 获取子订单编号的后两位
-
-                    // 判断是否为汇总项(子订单编号后两位为 "00")
-                    if ($subOrderSuffix === '00') {
-                        // 初始化汇总数据
-                        if (!isset($summaryList[$subOrderPrefix])) {
-                            $summaryList[$subOrderPrefix] = [
-                                '子订单编号' => $item['子订单编号'],
-                                '条码' => $item['子订单编号'],  // 条码字段作为汇总项显示
-                                '颜色' => $item['颜色'],
-                                '款号' => $item['款号'],
-                                'zdtotal' => 0,  // 累计总量
-                                '颜色备注' => $item['颜色备注'],
-                                'color_id' => $colorId,
-                                'cm1' => $item['cm1'],
-                                'cm2' => $item['cm2'],
-                                'cm3' => $item['cm3'],
-                                'cm4' => $item['cm4'],
-                                'cm5' => $item['cm5'],
-                                'cm6' => $item['cm6'],
-                                'cm7' => $item['cm7'],
-                                'cm8' => $item['cm8'],
-                                'cm9' => $item['cm9'],
-                                'cm10' => $item['cm10'],
-                                'cmsl1' => 0,
-                                'cmsl2' => 0,
-                                'cmsl3' => 0,
-                                'cmsl4' => 0,
-                                'cmsl5' => 0,
-                                'cmsl6' => 0,
-                                'cmsl7' => 0,
-                                'cmsl8' => 0,
-                                'cmsl9' => 0,
-                                'cmsl10' => 0,
-                            ];
+                    for ($i = 1; $i <= 10; $i++) {
+                        if (!empty($item['cm' . $i])) {
+                            $item[$item['cm' . $i]] = $item['cmsl' . $i];
+                        }
+                        unset($item['cm' . $i], $item['cmsl' . $i]);
+                    }
+                    $formattedData[] = $item;
+                }
+
+// 用于存储每个 color_id 和颜色备注的合并数据
+                $mergedData = [];
+
+// 进行合并
+                foreach ($formattedData as $item) {
+                    $key = $item['color_id'] . '|' . $item['颜色备注'];
+
+                    if (!isset($mergedData[$key])) {
+                        $mergedData[$key] = $item;
+                        $mergedData[$key]['条码'] = $item['子订单编号']; // 初始化条码
+                    } else {
+                        // 合并 zdtotal 和尺码数量
+                        $mergedData[$key]['zdtotal'] += $item['zdtotal'];
+                        foreach (['36', '38', '40', '42', '44', '46', '48'] as $size) {
+                            if (isset($item[$size])) {
+                                $mergedData[$key][$size] = ($mergedData[$key][$size] ?? 0) + $item[$size];
+                            }
                         }
-                        for ($i = 1; $i <= 10; $i++) {
-                            $summaryList[$subOrderPrefix]['cmsl' . $i] += $item['cmsl' . $i];
+                        // 优先选择以 "00" 结尾的条码
+                        if (substr($item['子订单编号'], -2) == '00') {
+                            $mergedData[$key]['条码'] = $item['子订单编号'];
                         }
-                        $summaryList[$subOrderPrefix]['zdtotal'] += $item['zdtotal'];
                     }
-                    // 不论是否为汇总项,原始数据都保留到结果数组中 // 非汇总项的条码为空
-                    $item['条码'] = '';
-                    $mergedList[] = $item;
                 }
-                // 将汇总数据追加到结果数组中
-                foreach ($summaryList as $summary) {
-                    $mergedList[] = $summary;
+
+// 将合并后的数据添加到原始数据的末尾,并排序
+                $finalOutput = $formattedData;
+
+// 按 color_id 和 颜色备注 分组,并在每组末尾添加合并后的条码数据
+                foreach ($mergedData as $key => $mergeItem) {
+                    $mergeItem['合并标记'] = true; // 用于标记这是合并后的数据
+                    $finalOutput[] = $mergeItem;
                 }
-                // 处理动态字段和清空 0 值
-                foreach ($mergedList as $key => $value) {
+
+// 对最终数组进行排序
+                usort($finalOutput, function($a, $b) {
+                    // 先按 color_id 排序
+                    $compare = strcmp($a['color_id'], $b['color_id']);
+                    if ($compare === 0) {
+                        // 在 color_id 相同的情况下,再按 颜色备注 排序
+                        $compare = strcmp($a['颜色备注'], $b['颜色备注']);
+                        if ($compare === 0) {
+                            // 在 颜色备注相同的情况下,按 子订单编号 排序
+                            // 如果一项是合并标记的条码数据,另一项不是,则合并标记的条码数据排在后面
+                            if (isset($a['合并标记']) && !isset($b['合并标记'])) {
+                                return 1;
+                            } elseif (!isset($a['合并标记']) && isset($b['合并标记'])) {
+                                return -1;
+                            }
+                            return strcmp($a['子订单编号'], $b['子订单编号']);
+                        }
+                        return $compare;
+                    }
+                    return $compare;
+                });
+
+// 查询仅获取船样为 1 的数据
+                $chuanyang = \db('工单_印件资料')
+                    ->where('订单编号', $param['order'])
+                    ->where($where)
+                    ->where('船样', 1)
+                    ->field('子订单编号, 颜色, 款号, zdtotal, 颜色备注, color_id, 船样,
+             cm1, cm2, cm3, cm4, cm5, cm6, cm7, cm8, cm9, cm10,
+             cmsl1, cmsl2, cmsl3, cmsl4, cmsl5, cmsl6, cmsl7, cmsl8, cmsl9, cmsl10, Uniqid')
+                    ->select();
+
+                $chuanyangvval = [];
+// 遍历船样为 1 的数据,进行尺码转换
+                foreach ($chuanyang as $item) {
                     for ($i = 1; $i <= 10; $i++) {
-                        if ($value['cm' . $i] !== '' && $value['cm' . $i] !== null) {
-                            $mergedList[$key][$value['cm' . $i]] = $value['cmsl' . $i];
+                        if (!empty($item['cm' . $i])) {
+                            $item[$item['cm' . $i]] = $item['cmsl' . $i];
                         }
-                        unset($mergedList[$key]['cm' . $i], $mergedList[$key]['cmsl' . $i]);
+                        unset($item['cm' . $i], $item['cmsl' . $i]);
                     }
+                    $item['条码'] = $item['子订单编号'];
+                    $chuanyangvval[] = $item;
                 }
-                // 清空 0 值
-                foreach ($mergedList as &$row) {
-                    foreach ($row as $key => $value) {
-                        if ($value === 0) {
-                            $row[$key] = '';
-                        }
+
+// 合并船样和非船样的数据并去重
+                $final = array_map("unserialize", array_unique(array_map("serialize", array_merge($finalOutput, $chuanyangvval))));
+
+// 最后清除带有条码的数据中的子订单编号和颜色信息
+                foreach ($final as &$item) {
+                    if (isset($item['条码']) && $item['船样'] == 0) {
+                        $item['子订单编号'] = '';
+                        $item['颜色'] = '';
+                        $item['款号'] = '';
+                        unset($item['子订单编号'], $item['颜色']);
                     }
                 }
-                sort($arr);
-                $customOrder = ['XXS','XS', 'S', 'M', 'L', 'XL', 'XXL'];
-                usort($arr, function($a, $b) use ($customOrder) {
-                    $posA = array_search($a, $customOrder);
-                    $posB = array_search($b, $customOrder);
-                    return $posA - $posB;
-                });
+
+                $data['process'] = $final;
                 $data['order'] = $list;
                 $data['xhdata'] = $arr;
-                $data['process'] = $mergedList;
-
                 $this->success('成功', $data);
             } else {
                 echo "子订单编号 - 后不是2位也不是4位:$afterDash";
@@ -3080,10 +3220,12 @@ class WorkOrder extends Api
                 ->field('colorcode, colorname')
                 ->where('colorname', $param['colorname'] ?? '')
                 ->find();
+
             if (empty($colorlist)) {
                 $this->error('未找到对应的颜色编号');
             }
             $num = $param['order'] . '-' . $colorlist['colorcode'];
+
             // 查询子订单编号
             $data = \db('工单_印件资料')
                 ->field('子订单编号,cm1,cm2,cm3,cm4,cm5,cm6,cm7,cm8,cm9,cm10')
@@ -3091,27 +3233,48 @@ class WorkOrder extends Api
                 ->where('船样', '=', 0)
                 ->order('子订单编号', 'desc')
                 ->find();
+
             if (empty($data)) {
                 // 如果没有找到数据,生成默认的订单编号,后两位从00开始
                 $order = $param['order'] . '-' . $colorlist['colorcode'] . '00';
             } else {
-                // 如果找到数据,提取子订单编号并递增
-                $order = $data['子订单编号'];
-                if (preg_match('/(.*-' . $colorlist['colorcode'] . ')(\d{2})$/', $order, $matches)) {
-                    $prefix = $matches[1]; // 前缀部分(包括订单编号和颜色代码)
-                    $number = $matches[2]; // 数字部分(后两位)
-
-                    // 循环生成子订单编号并检查数据库中是否存在相同编号
-                    do {
-                        $incrementedNumber = (int)$number + 1;
-                        // 将数字部分补充为两位数,例如 1 -> 01,2 -> 02
-                        $order = $prefix . str_pad($incrementedNumber, 2, '0', STR_PAD_LEFT);
-                        $exists = \db('工单_印件资料')->where('子订单编号', '=', $order)->find();
-                        $number = $incrementedNumber; // 更新 number 用于下一次循环
-                    } while ($exists); // 如果存在相同编号则继续循环递增
-                } else {
-                    $this->error('订单编号格式错误');
+
+                if (strlen($data['子订单编号']) == 12) {
+                    $data = \db('工单_印件资料')
+                        ->where('订单编号',$param['order'])
+                        ->where('船样',0)
+                        ->order('子订单编号 desc')
+                        ->find();
+                    if(empty($data)){
+                        $order = $param['order'].'-01';
+                    }else{
+                        $num = (int)substr($data['子订单编号'],10) + 1;
+                        if ($num<10){
+                            $order = $param['order'].'-0'.$num;
+                        }else{
+                            $order = $param['order'].'-'.$num;
+                        }
+                    }
+                }else{
+                    // 如果找到数据,提取子订单编号并递增
+                    $order = $data['子订单编号'];
+                    if (preg_match('/(.*-' . $colorlist['colorcode'] . ')(\d{2})$/', $order, $matches)) {
+                        $prefix = $matches[1]; // 前缀部分(包括订单编号和颜色代码)
+                        $number = $matches[2]; // 数字部分(后两位)
+
+                        // 循环生成子订单编号并检查数据库中是否存在相同编号
+                        do {
+                            $incrementedNumber = (int)$number + 1;
+                            // 将数字部分补充为两位数,例如 1 -> 01,2 -> 02
+                            $order = $prefix . str_pad($incrementedNumber, 2, '0', STR_PAD_LEFT);
+                            $exists = \db('工单_印件资料')->where('子订单编号', '=', $order)->find();
+                            $number = $incrementedNumber; // 更新 number 用于下一次循环
+                        } while ($exists); // 如果存在相同编号则继续循环递增
+                    } else {
+                        $this->error('订单编号格式错误');
+                    }
                 }
+
             }
 
             //2.获取色系名称信息

文件差异内容过多而无法显示
+ 545 - 205
application/api/controller/WorkOrderSpotCheck.php


+ 3 - 2
application/api/controller/WorkOrderVerification.php

@@ -24,7 +24,7 @@ class WorkOrderVerification extends Api
     }
 
     /**
-     * 获取报工历史记录
+     * 获取报工历史记录
      *
      */
     public function getTab(){
@@ -44,6 +44,7 @@ class WorkOrderVerification extends Api
             ->join('工单_印件资料 y', 'c.子订单编号 = y.子订单编号', 'left')
             ->join('工单_基本资料 j', 'c.订单编号 = j.订单编号', 'left')
             ->where('c.子订单编号', $param['order_id'])
+            ->where('c.工序名称', '手工')
             ->where('c.sczl_jtbh', $param['sczl_jtbh'])
             ->whereNull('c.mod_rq') // 查询未删除数据
             ->where(function($query) {
@@ -55,7 +56,7 @@ class WorkOrderVerification extends Api
         $output = [];
         foreach ($table_list as $record) {
             $output[] = [
-                'serial' => $record['serial'],
+                'serial' => '第('.$record['serial'].')包',
                 'sys_rq' => $record['sys_rq'],
                 '订单编号' => $record['订单编号'],
                 '子订单编号' => $record['子订单编号'],

部分文件因为文件数量过多而无法显示