Jelajahi Sumber

入库收货超时调整

haozi 4 tahun lalu
induk
melakukan
63de3af113
1 mengubah file dengan 7 tambahan dan 32 penghapusan
  1. 7 32
      app/Services/HandInStorageService.php

+ 7 - 32
app/Services/HandInStorageService.php

@@ -585,10 +585,8 @@ sql;
             $this->updateFluxInv($info, $lotNum, $who, $time, $actTransactionLog);
 
             // 6: flux 更新 asn_detail 和 asn_header 状态
-            $result=$this->updateFluxAsn($info, $invlotatt, $time, $who);
+            $result=$this->updateFluxAsn($info, $invlotatt, $time, $who,$asnDetail);
             if (!$result){$db->rollBack();return false;}
-            // 7:入库完成 -> 事务状态改为完成
-            // $this->updateActTransactionLogStatus($actTransactionLog,$time);
             $db->commit();
             return true;
         } catch (\Exception $e) {
@@ -598,19 +596,6 @@ sql;
         }
 
     }
-
-    /**
-     * @param array $actTransactionLog
-     * @param $time
-     * 更改事务表状态
-     */
-//    public function updateActTransactionLogStatus(array $actTransactionLog,$time)
-//    {
-//        $db = DB::connection("oracle");
-//        $db->update(DB::raw("UPDATE ACT_TRANSACTION_LOG SET status = '99',edittime = TO_DATE(?,'yyyy-mm-dd hh24:mi:ss') WHERE transactionid = ?"),
-//            [$time, $actTransactionLog['trid']]);
-//
-//    }
     /**
      * @param array $info
      * @param $asnDetail
@@ -635,31 +620,21 @@ sql;
      * @return bool
      * 更新asn状态
      */
-    public function updateFluxAsn(array $info, array $invlotatt, $time, $who): bool
+    public function updateFluxAsn(array $info, array $invlotatt, $time, $who,$asnDetail): bool
     {
         $db = DB::connection("oracle");
         $asn = OracleDOCASNHeader::query()
             ->withCount('asnDetails')
-            ->with('asnDetails')
             ->where('asnno', $info['asnno'])
             ->first();
-        if (!$asn || !$asn->asnDetails || !$asn->asn_details_count) return false;
-        $asnDetails = $asn->asnDetails;
-        $receiveAsn = null;
-        foreach ($asnDetails as $asnDetail) {
-            if ($asnDetail['asnno'] == $info['asnno'] &&
-                $asnDetail['asnlineno'] == $info['asnlineno'] &&
-                $asnDetail['customerid'] == $info['customerid'] &&
-                $asnDetail['sku'] == $info['sku'] ){
-                $receiveAsn = $asnDetail;
-            }
-        }
+        if (!$asn || !$asn->asn_details_count) return false;
+
 
-        if (!$receiveAsn) return false;
+        if (!$asnDetail) return false;
 
-        $receivedQty = (int)($receiveAsn['receivedqty']??$receiveAsn['receivedqty_each']);  // 已收货数量
+        $receivedQty = (int)($asnDetail['receivedqty']??$asnDetail['receivedqty_each']);  // 已收货数量
         $amount = (int) $info['amount'];                    // 当前收货数量
-        $expectedQty = (int)$receiveAsn['expectedqty'];     // 预期数量
+        $expectedQty = (int)$asnDetail['expectedqty'];     // 预期数量
 
         if ($receivedQty + $amount < $expectedQty) {
             // 已收货数量+当前收货数量 < 预期数量