cqp 8 ore fa
parent
commit
cda77edaee

+ 5 - 1
app/Http/Controllers/Api/TestController.php

@@ -4,10 +4,14 @@ namespace App\Http\Controllers\Api;
 
 use App\Jobs\ProcessDataJob;
 use App\Model\Record;
+use App\Service\U8ThirtyPartyDatabaseServerService;
 
 class TestController extends BaseController
 {
-    public function aa(){dd(2);
+    public function aa(){dd(22);
+//        $service = new U8ThirtyPartyDatabaseServerService();
+//        list($status, $order) = $service->insertUnAccountVouch('接口生成');
+//        dd($status, $order);
         $result = Record::where('del_time',2)
             ->where('result', 'LIKE', '%'.'数据库连接'.'%')
             ->get()->toArray();

+ 11 - 5
app/Service/U8ThirtyPartyDatabaseServerService.php

@@ -51,11 +51,18 @@ class U8ThirtyPartyDatabaseServerService extends Service
                 // U8 中 DispatchList 是发货单主表,DispatchLists 是子表
                 $pendingData = $db->table('DispatchList as H')
                     ->join('DispatchLists as D', 'H.DLID', '=', 'D.DLID')
-                    ->where('H.cMemo', $cMemo)
-                    ->where('H.dDate', '<=', '2026-03-31')
+                    ->where('H.cMemo', '接口生成')
+                    ->where('H.dDate', '>=', '2026-04-01')
+                    ->where('H.dDate', '<=', '2026-04-30')
+                    ->whereNotExists(function ($query) use ($db) {
+                        $query->select($db->raw(1))
+                            ->from('IA_SA_UnAccountVouch as IA')
+                            ->whereRaw('IA.IDUN = H.DLID')
+                            ->whereRaw('IA.IDSUN = D.iDLsid');
+                    })
                     ->select([
-                        'H.DLID as IDUN',       // 发货单主表ID
-                        'D.iDLsid as IDSUN',    // 发货单子表ID
+                        'H.DLID as IDUN',    // 发货单主表ID
+                        'D.iDLsid as IDSUN', // 发货单子表ID
                     ])
                     ->get();
 
@@ -70,7 +77,6 @@ class U8ThirtyPartyDatabaseServerService extends Service
                         'IDSUN'      => $row->IDSUN,
                         'cVouTypeUN' => '05',       // 写死固定值
                         'cBustypeUN' => '分期收款',  // 写死固定值
-                        // 如果该表有其他必填字段(如日期、仓库等),请在此补充
                     ];
                 }