ErpJob.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace app\jobs;
  3. use yii\base\BaseObject;
  4. use yii\queue\JobInterface;
  5. use app\utils\OrderUtil;
  6. use app\models\ErpInventory;
  7. use app\modules\admin\models\erp\InventoryForm;
  8. // erp库存同步到商品
  9. class ErpJob extends BaseObject implements JobInterface
  10. {
  11. public $in_action;
  12. public $store_id;
  13. public $id;
  14. public $count;
  15. public $front_agent_admin_id;
  16. public function execute($queue)
  17. {
  18. debug_log(__METHOD__ . '~~~~~~~~已弃用~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
  19. throw new \Exception(__METHOD__ . '~~~~~~~~已弃用~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
  20. return;
  21. $_GET['md_id'] = 0;
  22. if($this->in_action){
  23. $action = $this->in_action;
  24. $this->$action();
  25. }
  26. }
  27. public function executeErpInventory2Goods() {
  28. try {
  29. if(cache_lock(__METHOD__ . $this->id, 30)){
  30. return;
  31. }
  32. ErpInventory::num2Goods($this->id);
  33. } catch (\Exception $e) {
  34. \Yii::error($e);
  35. }
  36. }
  37. public function executeErpInitStoreGoods() {
  38. try {
  39. InventoryForm::initStoreGoods($this->store_id, $this->id, $this->count);
  40. } catch (\Exception $e) {
  41. \Yii::error($e);
  42. }
  43. }
  44. public function executeAgentFrontErpInitStoreGoods() {
  45. try {
  46. \app\modules\admin\models\agent\front_erp\InventoryForm::initStoreGoods($this->front_agent_admin_id, $this->id, $this->count);
  47. } catch (\Exception $e) {
  48. \Yii::error($e);
  49. }
  50. }
  51. }