FluxOrderFix.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. namespace App\Console\Commands;
  3. use App\Http\Controllers\Controller;
  4. use App\OracleDOCOrderHeader;
  5. use Carbon\Carbon;
  6. use Illuminate\Console\Command;
  7. class FluxOrderFix extends Command
  8. {
  9. /**
  10. * The name and signature of the console command.
  11. *
  12. * @var string
  13. */
  14. protected $signature = 'FluxOrderFix';
  15. /**
  16. * The console command description.
  17. *
  18. * @var string
  19. */
  20. protected $description = 'FluxOrderFix';
  21. /**
  22. * Create a new command instance.
  23. *
  24. * @return void
  25. */
  26. public function __construct()
  27. {
  28. parent::__construct();
  29. }
  30. /**
  31. * Execute the console command.
  32. *
  33. * @return mixed
  34. */
  35. public function handle()
  36. {
  37. $this->fixEdisendflagAtWrong();
  38. $this->youWuFixEdisendflagAtWrong();
  39. }
  40. public function fixEdisendflagAtWrong(){
  41. OracleDOCOrderHeader::where('edisendflag','W')
  42. ->whereNull('EDI_RESENDTIME')
  43. ->where('edisendtime','>',Carbon::now()->subDays(2))
  44. ->where('ediremarks2','<>','不支持的单据类型')
  45. ->update(['edisendflag'=>'N','manualflag'=>'N','EDI_RESENDTIME'=>Carbon::now()]);
  46. OracleDOCOrderHeader::where('edisendflag','W')
  47. ->where('EDI_RESENDTIME','>',Carbon::now()->subDays(2))
  48. ->where('edisendtime','>',Carbon::now()->subDays(2))
  49. ->where('ediremarks2','<>','不支持的单据类型')
  50. ->update(['edisendflag'=>'N','manualflag'=>'N']);
  51. }
  52. public function youWuFixEdisendflagAtWrong(){
  53. OracleDOCOrderHeader::where('yw_edisendflag','W')
  54. ->where('customerid','YOUWU')
  55. ->whereNull('EDI_RESENDTIME')
  56. ->where('yw_edisendtime','>',Carbon::now()->subDays(2))
  57. ->where('yw_edisendflag','W')
  58. ->update(['yw_edisendflag'=>'N','manualflag'=>'N','EDI_RESENDTIME'=>Carbon::now()]);
  59. OracleDOCOrderHeader::where('yw_edisendflag','W')
  60. ->where('customerid','YOUWU')
  61. ->where('EDI_RESENDTIME','>',Carbon::now()->subDays(2))
  62. ->where('yw_edisendtime','>',Carbon::now()->subDays(2))
  63. ->update(['yw_edisendflag'=>'N','manualflag'=>'N']);
  64. }
  65. }