fix: 按价格截止日排除事后补录价格
Co-authored-by: 苏木 <594326199@qq.com> Co-committed-by: 苏木 <594326199@qq.com>
This commit is contained in:
parent
ded2789a17
commit
7bb4667a47
@ -294,6 +294,10 @@ class PayablesUnpricedCycleProcessor
|
||||
$rows = DB::connection($connectionName)
|
||||
->table(SupplierPayableForecastRepository::PRICE_TABLE)
|
||||
->where('effectStartTime', '<=', $cutoffAt->format('Y-m-d H:i:s'))
|
||||
->where(static function ($query) use ($cutoffAt): void {
|
||||
$query->whereNull('createTime')
|
||||
->orWhere('createTime', '<=', $cutoffAt->format('Y-m-d H:i:s'));
|
||||
})
|
||||
->where(static function ($query) use ($cutoffAt): void {
|
||||
$query->whereNull('effectEndTime')
|
||||
->orWhere('effectEndTime', '')
|
||||
@ -312,7 +316,9 @@ class PayablesUnpricedCycleProcessor
|
||||
$completed = $this->date($row->createTime ?? null);
|
||||
$end = $this->date($row->effectEndTime ?? null);
|
||||
if ($code === '' || $price === null || $start === null
|
||||
|| $start > $cutoffAt || ($end !== null && $end < $cutoffAt)) {
|
||||
|| $start > $cutoffAt
|
||||
|| ($completed !== null && $completed > $cutoffAt)
|
||||
|| ($end !== null && $end < $cutoffAt)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@ -236,6 +236,9 @@ class PayablesUnpricedCycleTest extends FeatureTestCase
|
||||
'id:auto:delivery:matched-1' => [
|
||||
'supplier' => '供应商甲', 'barCode' => 'M-1', 'qty' => '2', 'unitPrice' => null, 'amount' => null,
|
||||
],
|
||||
'id:auto:delivery:late-created-price' => [
|
||||
'supplier' => '供应商乙', 'barCode' => 'LATE-1', 'qty' => '1', 'unitPrice' => null, 'amount' => null,
|
||||
],
|
||||
], $companyId, $userId, 'test');
|
||||
$store->saveBatch(PayablesUnpricedCycleProcessor::RETURN_HISTORY_DATASET, [
|
||||
'id:auto:return:matched' => [
|
||||
@ -257,6 +260,9 @@ class PayablesUnpricedCycleTest extends FeatureTestCase
|
||||
$this->assertSame('8', $pricedReturn[0]['unit_price']);
|
||||
$this->assertSame('24.00', $pricedReturn[0]['amount']);
|
||||
$this->assertSame('2026-10', $pricedDelivery[0]['_accounting_period']);
|
||||
$remainingDelivery = $store->listRows(PayablesUnpricedCycleProcessor::DELIVERY_HISTORY_DATASET, $companyId);
|
||||
$this->assertCount(1, $remainingDelivery);
|
||||
$this->assertSame('LATE-1', $remainingDelivery[0]['barCode']);
|
||||
|
||||
$this->artisan('payables:unpriced-cycle:auto', [
|
||||
'--company' => $companyId,
|
||||
@ -356,6 +362,17 @@ class PayablesUnpricedCycleTest extends FeatureTestCase
|
||||
'effectEndTime' => null,
|
||||
'createTime' => '2026-09-01 00:00:00',
|
||||
],
|
||||
[
|
||||
'Id' => 4,
|
||||
'skucode' => 'LATE-1',
|
||||
'priceType' => '定价',
|
||||
'originalPrice' => 9,
|
||||
'afterPrice' => 9,
|
||||
'diffPrice' => 0,
|
||||
'effectStartTime' => '2000-01-01 00:00:00',
|
||||
'effectEndTime' => null,
|
||||
'createTime' => '2026-11-02 09:21:01',
|
||||
],
|
||||
]);
|
||||
DB::connection('business_mirror')->table('business_mirror_table_states')->insert([
|
||||
'dataset_key' => 'jiansun.dbo.pm_priceAdjustment_log',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user