| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- namespace Tests\Services\CommodityBarcodeService;
- use App\OracleBasSKU;
- use App\Services\CommodityBarcodeService;
- use App\ValueStore;
- use Tests\TestCase;
- class CreateBarcodeByWmsTest extends TestCase
- {
- /**
- * @var CommodityBarcodeService $service
- */
- public $service;
- public $bas_skus;
- public $created_at;
- public $commodityBarcodes;
- public function setUp(): void
- {
- parent::setUp(); // TODO: Change the autogenerated stub
- $this->created_at = config('sync.commodity_sync.created_at');
- $last_time = ValueStore::query()->where('name', $this->created_at)->value('value');
- $startDate = \Illuminate\Support\Carbon::now()->subSeconds(65);
- $this->service = app(CommodityBarcodeService::class);
- $this->bas_skus = OracleBasSKU::query()
- ->select('customerid', 'sku', 'descr_c', 'alternate_sku1', 'alternate_sku2', 'alternate_sku3', 'skulength', 'skuwidth', 'skuhigh', 'cube', 'packid', 'addtime', 'edittime')
- ->where('addTime', '>=', $last_time ?? $startDate)
- ->orderByDesc('addtime')
- ->get();
- }
- public function testCreateBarcodeByWms()
- {
- if ($this->bas_skus->isEmpty()) {
- $this->assertEmpty($this->bas_skus);
- return;
- }
- $this->service->createBarcodeByWms($this->bas_skus);
- $this->commodityBarcodes=$this->service->getByWms($this->bas_skus);
- if ($this->commodityBarcodes) $this->assertNotNull($this->commodityBarcodes);
- }
- public function tearDown(): void
- {
- parent::tearDown(); // TODO: Change the autogenerated stub
- }
- }
|