|
|
@@ -21,54 +21,33 @@ use Tests\TestCase;
|
|
|
|
|
|
class SyncOrderTest extends TestCase
|
|
|
{
|
|
|
+ use RefreshDatabase;
|
|
|
+
|
|
|
/**
|
|
|
* @var OrderService $service
|
|
|
- * @var OracleDOCOrderHeaderService $orderHeaderService
|
|
|
- * @var DataHandlerService $dataHandlerService
|
|
|
- * @var OwnerService $ownerService
|
|
|
- * @var LogisticService $logisticService
|
|
|
- * @var ShopService $shopService
|
|
|
- * @var WarehouseService $warehouseService
|
|
|
*/
|
|
|
public $service;
|
|
|
- public $orderHeaderService;
|
|
|
- public $dataHandlerService;
|
|
|
- public $ownerService;
|
|
|
- public $logisticService;
|
|
|
- public $shopService;
|
|
|
- public $warehouseService;
|
|
|
+
|
|
|
public function setUp(): void
|
|
|
{
|
|
|
parent::setUp();
|
|
|
$this->service=app(OrderService::class);
|
|
|
- $this->orderHeaderService=app(OracleDOCOrderHeaderService::class);
|
|
|
}
|
|
|
- public function testCreateOrUpdateOrderInfo()
|
|
|
- {
|
|
|
- $order = OracleDOCOrderHeader::query();
|
|
|
|
|
|
- $carbon =Carbon::now()->subHours(1);
|
|
|
- $date = '2020-05-18 18:13:50';
|
|
|
- $orderHeader = OracleDOCOrderHeader::query()->selectRaw(implode(',',OracleDOCOrderHeaderService::$columns))
|
|
|
- ->with(['oracleBASCustomer'=>function($query){
|
|
|
- $query->selectRaw('BAS_CUSTOMER.CustomerID,BAS_CUSTOMER.Customer_Type,BAS_CUSTOMER.Descr_C,BAS_CUSTOMER.Active_Flag');
|
|
|
- },'oracleDOCOrderDetails'=>function($query){
|
|
|
- $query->selectRaw('doc_order_details.orderNo,doc_order_details.customerid,doc_order_details.sku,doc_order_details.QtyOrdered');
|
|
|
- }, 'actAllocationDetails'=>function($query){
|
|
|
- $query->selectRaw('ACT_Allocation_Details.AllocationDetailsID,ACT_Allocation_Details.OrderNo,ACT_Allocation_Details.Qty_Each,ACT_Allocation_Details.PickToTraceID,ACT_Allocation_Details.CustomerID,ACT_Allocation_Details.Sku');
|
|
|
- },'oracleBASCode'=>function($query){
|
|
|
- $query->selectRaw('BAS_Codes.CodeID,BAS_Codes.CodeName_C,BAS_Codes.Code');
|
|
|
- }])
|
|
|
- ->where('DOC_Order_Header.EditTime','>=',$carbon)
|
|
|
+ /**
|
|
|
+ * @test
|
|
|
+ */
|
|
|
+ public function createOrUpdateOrderInfo()
|
|
|
+ {
|
|
|
+ $orderHeader = OracleDOCOrderHeader::query()->where('sostatus',99)->orderByDesc('addtime')->first();
|
|
|
+ $orderHeaders = OracleDOCOrderHeader::query()
|
|
|
+ ->where('sostatus',99)
|
|
|
+ ->where('addtime','>=',$orderHeader->addtime)
|
|
|
->get();
|
|
|
- $this->service->syncOrder($orderHeader);
|
|
|
- $order = $this->service->getByWmsOrders($orderHeader);
|
|
|
- $this->assertNotNull($order);
|
|
|
+ $this->service->syncOrder($orderHeaders);
|
|
|
+ $orders = $this->service->getByWmsOrders($orderHeaders);
|
|
|
+ $this->assertNotNull($orders);
|
|
|
$this->assertNotNull($orderHeader);
|
|
|
- }
|
|
|
-
|
|
|
- public function tearDown(): void
|
|
|
- {
|
|
|
- parent::tearDown(); // TODO: Change the autogenerated stub
|
|
|
+ $this->assertEquals(count($orderHeaders),count($orders));
|
|
|
}
|
|
|
}
|