cqp преди 1 седмица
родител
ревизия
ac3ee37760
променени са 1 файла, в които са добавени 4 реда и са изтрити 4 реда
  1. 4 4
      app/Service/U8ThirdPartyService.php

+ 4 - 4
app/Service/U8ThirdPartyService.php

@@ -158,9 +158,9 @@ class U8ThirdPartyService extends Service
             $newRow['iMoney']       = round($unitLocalMoney * $newQty, 2);
             $newRow['iSum']         = round($unitLocalSum * $newQty, 2);
             $newRow['iTaxPrice']    = round(($unitLocalSum - $unitLocalMoney) * $newQty, 2);
-            $newRow['cBatch']       = $value['lot'];
-            $newRow['dPDate']       = $this->formatAndValidateDate($value['productDate']);
-            $newRow['dVDate']       = $this->formatAndValidateDate($value['failureDate']);
+            $newRow['cBatch']       = $value['lot'] ?? null;
+            $newRow['dPDate'] = !empty($value['productDate']) ? $this->formatAndValidateDate($value['productDate']) : null;
+            $newRow['dVDate'] = !empty($value['failureDate']) ? $this->formatAndValidateDate($value['failureDate']) : null;
 
             $insertData[] = $newRow;
         }
@@ -263,7 +263,7 @@ class U8ThirdPartyService extends Service
             unset($newRow['AutoID']);
             $newRow['iQuantity'] = $newQty;             // 申请数量
             $newRow['irowno'] = $rowNo++;          // 重新排序行号
-            $newRow['cBatch'] = $value['lot'];     // 批号
+            $newRow['cBatch'] = $value['lot'] ?? null;     // 批号
 
             // 生产日期与失效日期 (U8 领料申请单通常字段名为 dMadeDate 和 dVDate 或 dmadedate)
             $newRow['dMadeDate'] = !empty($value['productDate']) ? $this->formatAndValidateDate($value['productDate']) : null;