cqp 5 dni temu
rodzic
commit
0978c7cf28
1 zmienionych plików z 10 dodań i 9 usunięć
  1. 10 9
      app/Service/U8ThirdPartyService.php

+ 10 - 9
app/Service/U8ThirdPartyService.php

@@ -535,16 +535,17 @@ class U8ThirdPartyService extends Service
 //           $return = $this->formatAndValidateDate($value['productDate']);
 //           if(! $return) return [false, '生产日期格式错误'];
 //           $productDate = $return;
-           if(empty($value['failureDate'])) return [false, '失效日期不能为空'];
-           $return = $this->formatAndValidateDate($value['failureDate']);
-           if(! $return) return [false, '失效日期格式错误'];
-           $failureDate= $return;
-           if(empty($value['lot'])) return [false, '批号不能为空'];
+           if(! empty($value['failureDate'])) {
+               $return = $this->formatAndValidateDate($value['failureDate']);
+               if(! $return) return [false, '失效日期格式错误'];
+               $failureDate= $return;
+           }
+//           if(empty($value['lot'])) return [false, '批号不能为空'];
            if(empty($value['iQuantity']) || ! is_numeric($value['iQuantity'])) return [false, '存货数量错误'];
            $detail_map[$value['materialCode']][] = [
 //               'productDate' => $productDate,
-               'failureDate' => $failureDate,
-               'lot' => $value['lot'],
+               'failureDate' => $failureDate ?? null,
+               'lot' => $value['lot'] ?? null,
                'iQuantity' => $value['iQuantity'],
            ];
        }
@@ -614,10 +615,10 @@ class U8ThirdPartyService extends Service
                    "itaxunitprice" => (float)$taxUnitPrice,
                    "iunitprice"    => (float)$iUnitPrice,
                    "inatunitprice" => (float)$iUnitPrice,
-                   "dvDate"        => $value['failureDate'] ?? null, // 示例中只需失效日期
+                   "dvDate"        => $value['failureDate'], // 示例中只需失效日期
 //                   "dMDate"          => (string)$value['productDate'],
                    "iSOsID"        => (int)$item['iSOsID'], // 强制转整型,去掉引号
-                   "cBatch"        => (string)$value['lot'],
+                   "cBatch"        => $value['lot'],
                    'cFree1' => $item['cFree1'],
                    'cFree2' => $item['cFree2'],
                ];