cqp 1 日 前
コミット
c4f5eda1cb
1 ファイル変更18 行追加6 行削除
  1. 18 6
      app/Service/U8ServerService.php

+ 18 - 6
app/Service/U8ServerService.php

@@ -76,14 +76,18 @@ class U8ServerService extends Service
             ->select('a.cMaker as crt_name', DB::raw("COALESCE(c.cPersonName, '') as purchase_name"),'a.cBusType as business_type','a.cCode as order_number',DB::raw("CONVERT(varchar(10), a.dDate, 120) as order_date"),'a.ID as id')
             ->first();
         if(empty($order)) return [false, '采购请购单不存在'];
-        $order = $order->toArray();
+        $order = (array) $order;
 
         $detail = $this->databaseService->table('PU_AppVouchs as a')
             ->leftJoin('Inventory as b', 'b.cInvCode', 'a.cInvCode')
             ->leftJoin('ComputationUnit as c', 'c.cComunitCode', 'b.cComUnitCode')
             ->where('a.ID', $order['id'])
             ->select('b.cInvName as product_title','b.cInvCode as product_code','a.fQuantity as quantity','c.cComUnitName as unit_title',DB::raw("CONVERT(varchar(10), a.dRequirDate, 120) as need_arrived_date"))
-            ->get()->toArray();
+            ->get();
+        // 转为数组的数组
+        $detail = array_map(function ($item) {
+            return (array) $item;
+        }, $detail->toArray());
         $order['detail'] = $detail;
 
         return [true, $order];
@@ -128,14 +132,18 @@ class U8ServerService extends Service
             ->select('a.cMaker as crt_name', 'a.cBusType as business_type','a.cPOID as order_number',DB::raw("CONVERT(varchar(10), a.dPODate, 120) as order_date"),'c.cVenName as supplier_title','a.POID as id')
             ->first();
         if(empty($order)) return [false, '采购单不存在'];
-        $order = $order->toArray();
+        $order = (array) $order;
 
         $detail = $this->databaseService->table('PO_Podetails as a')
             ->leftJoin('Inventory as b', 'b.cInvCode', 'a.cInvCode')
             ->leftJoin('ComputationUnit as c', 'c.cComunitCode', 'b.cComUnitCode')
             ->where('a.POID', $order['id'])
             ->select('b.cInvName as product_title','b.cInvCode as product_code','a.iQuantity as quantity','c.cComUnitName as unit_title','a.iSum as amount')
-            ->get()->toArray();
+            ->get();
+        // 转为数组的数组
+        $detail = array_map(function ($item) {
+            return (array) $item;
+        }, $detail->toArray());
         $order['detail'] = $detail;
 
         return [true, $order];
@@ -180,12 +188,16 @@ class U8ServerService extends Service
             ->select('a.cOperator as crt_name', 'c.cVenName as supplier_title','a.cVouchID as order_number',DB::raw("CONVERT(varchar(10), a.dVouchDate, 120) as order_date"),'a.PID as id')
             ->first();
         if(empty($order)) return [false, '付款单不存在'];
-        $order = $order->toArray();
+        $order = (array) $order;
 
         $detail = $this->databaseService->table('AP_ApplyPayVouchs as a')
             ->where('a.PID', $order['id'])
             ->select('a.cSource as source','a.cCoVouchID as source_order_number','a.iApplyAmt_f as amount')
-            ->get()->toArray();
+            ->get();
+        // 转为数组的数组
+        $detail = array_map(function ($item) {
+            return (array) $item;
+        }, $detail->toArray());
         $order['detail'] = $detail;
 
         return [true, $order];