2012-02-21 8 views
3

magento를 1.4.0.1에서 1.5.1.0으로 업그레이드 한 후 인보이스를 제출할 수 없습니다.인보이스를 저장할 수 없습니다.

exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '100000001' for key 'UNQ_INCREMENT_ID'' in /home/misbhv/domains/*/public_html/lib/Zend/Db/Statement/Pdo.php:234 
Stack trace: 
#0 /home/misbhv/domains/*/public_html/lib/Zend/Db/Statement.php(300): Zend_Db_Statement_Pdo->_execute(Array) 
#1 /home/misbhv/domains/*/public_html/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array) 
#2 /home/misbhv/domains/*/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `sk...', Array) 
#3 /home/misbhv/domains/*/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(337): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `sk...', Array) 
#4 /home/misbhv/domains/*/public_html/lib/Zend/Db/Adapter/Abstract.php(574): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `sk...', Array) 
#5 /home/misbhv/domains/*/public_html/app/code/core/Mage/Core/Model/Mysql4/Abstract.php(414): Zend_Db_Adapter_Abstract->insert('sklep_sales_fla...', Array) 
#6 /home/misbhv/domains/*/public_html/app/code/core/Mage/Sales/Model/Mysql4/Order/Abstract.php(417): Mage_Core_Model_Mysql4_Abstract->save(Object(Mage_Sales_Model_Order_Invoice)) 
#7 /home/misbhv/domains/*/public_html/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Sales_Model_Mysql4_Order_Abstract->save(Object(Mage_Sales_Model_Order_Invoice)) 
#8 /home/misbhv/domains/*/public_html/app/code/core/Mage/Core/Model/Resource/Transaction.php(150): Mage_Core_Model_Abstract->save() 
#9 /home/misbhv/domains/*/public_html/app/code/core/Mage/Adminhtml/controllers/Sales/Order/InvoiceController.php(272): Mage_Core_Model_Resource_Transaction->save() 
#10 /home/misbhv/domains/*/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(420): Mage_Adminhtml_Sales_Order_InvoiceController->saveAction() 
#11 /home/misbhv/domains/*/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(253): Mage_Core_Controller_Varien_Action->dispatch('save') 
#12 /home/misbhv/domains/*/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http)) 
#13 /home/misbhv/domains/*/public_html/app/code/core/Mage/Core/Model/App.php(340): Mage_Core_Controller_Varien_Front->dispatch() 
#14 /home/misbhv/domains/*/public_html/app/Mage.php(627): Mage_Core_Model_App->run(Array) 
#15 /home/misbhv/domains/*/public_html/index.php(80): Mage::run('', 'store') 
#16 {main} 
: 내가 Sales -> Orders -> [order] View -> Invoice에 브라우저를 가리키고 Submit invoice을 클릭있어 은, 내가 무슨 일이 여기 내 exception.log 파일에서 진행하고있어 확인했습니다 Unable to save the invoice.

말하는 오류를 받고 있어요 것은 오류입니다

나는 그걸로 무엇을 해야할지 모르고 어떤 해결책도 google 할 수 없습니다. 어떤 도움을 많이 주시면 감사하겠습니다!

+0

이 게시물이 도움이 될 수 있습니다 : http://www.magentocommerce.com/boards/v/viewthread/234665/#t335407 – seanbreeden

답변

6

에서 솔루션 : http://www.magentocommerce.com/boards/v/viewthread/234665/#t335407 의미가 있습니다 :

i had the same error code. the increment number and the last order number are not synchrone anymore. what we did is the following:

go to admin->sales-> orders and look up the highest order number (for each store view!)

after some help from a fooman post, we did this: \"Then look at your database. In the table eav_entity_type you will find all entity types listed. The one of interest to change is where the order number starts, ie. order sales/order. Remember the entity_type_id.\” (in my install it is 4)

\"Next go to the table eav_entity_store. Look up the entity_type_id. Now you can change the value of increment_last_id to your last actual order number. (That is, if you wanted to have your next orderId to be 15000 set increment_last_id to 14999.)\”

Hope that this helps.

+0

그게 다야! 왜 내가 그것을 못 찾았는지 모르겠다. 정말 고맙습니다! :) – mbajur

+0

완전 +1 –

0

난 당신이 버전에서 1.4.x로의 본건이 필요한 것을 행에 독특한에 새로운 제한이 있다고 생각합니다. 중복 된 행을보고 해결해야합니다. 다른 모든 increment_id를 사용하여 모든 계단식 제한이있는 새 행을 만듭니다. 당신은 다음 SQL 문을 사용하여 중복 행을 볼 수

SELECT row FROM table GROUP BY row HAVING COUNT(*)>1; 

나중에 중복 행을 참조해야하는이 오류가 있기 때문에 내가 중복 jey을 제거 할 수 있습니다 내 경우. 당신이 Magento의 오류로 인해 부상 당했기 때문에 중복 행을 제거 할 수 있습니다. 필자의 경우 Magento scrip 업데이트가 테이블의 구조를 업데이트하려고 시도했지만 멈추었습니다.

0

나는 모든 increment_id 앞에 Fooman 플러그인과 빈 공간에 문제가있었습니다. 이 쿼리는

UPDATE `sales_flat_invoice` SET increment_id = trim(increment_id); 
UPDATE `sales_flat_order` SET increment_id = trim(increment_id); 
UPDATE `sales_flat_invoice_grid` SET increment_id = trim(increment_id); 
UPDATE `sales_flat_order_grid` SET increment_id = trim(increment_id); 
UPDATE `sales_flat_shipment` SET increment_id = trim(increment_id); 
UPDATE `sales_flat_creditmemo` SET increment_id = trim(increment_id); 
UPDATE `sales_flat_shipment_grid` SET increment_id = trim(increment_id); 
UPDATE `sales_flat_creditmemo_grid` SET increment_id = trim(increment_id); 
UPDATE `eav_entity_store` SET increment_last_id = trim(increment_last_id); 
1

실제로 위의 솔루션을 바라 보았다 .. 나를 위해 그것을 고정하고 당신이 올바른 궤도에있어, 작동 할 수 있습니다 생각하지만 난 뭔가 다른 것을 시도하십시오 'increment_last_id'을 변경

을 필드 문제가 바로 해결되었습니다. 실제로 Magento가 중복 오류로 실패한 ID를 쓰려고 할 때 동일한 주문 ID를 공유하는 삭제 된 이전 저장소보기의 기존 주문 집합이있었습니다.

나는 exception.log를보고 문제를 발견했다. 실제로 문제의 원인이 된 주문 ID를 알려 주었다.

이러한 주문을 삭제하고 increment_last_id 필드를 편집하여 새 주문을 재정렬하면 내 문제가 해결되었습니다. 이제는 내 새 주문이 지난 번에 위의 번호에서 시작되며 주문 ID의 충돌은 더 이상 발생하지 않습니다.

관련 문제