稻虾流向增加单位
parent
94aa0656ed
commit
81abd7270d
|
|
@ -2,15 +2,15 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Enums\OperationType;
|
||||||
use App\Http\Requestes\RiceShrimpFlowStoreRequest;
|
use App\Http\Requestes\RiceShrimpFlowStoreRequest;
|
||||||
use App\Http\Requestes\RiceShrimpFlowUpdateRequest;
|
use App\Http\Requestes\RiceShrimpFlowUpdateRequest;
|
||||||
use App\Http\Resources\RiceShrimpFlowResource;
|
use App\Http\Resources\RiceShrimpFlowResource;
|
||||||
use App\Models\RiceShrimpFlow;
|
use App\Models\RiceShrimpFlow;
|
||||||
|
use App\Services\OperationLogService;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||||
use App\Services\OperationLogService;
|
|
||||||
use App\Enums\OperationType;
|
|
||||||
|
|
||||||
class RiceShrimpFlowController extends Controller
|
class RiceShrimpFlowController extends Controller
|
||||||
{
|
{
|
||||||
|
|
@ -48,6 +48,7 @@ class RiceShrimpFlowController extends Controller
|
||||||
'quarter',
|
'quarter',
|
||||||
'area',
|
'area',
|
||||||
'sales',
|
'sales',
|
||||||
|
'unit',
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
$riceShrimpFlow->created_by = $user->id;
|
$riceShrimpFlow->created_by = $user->id;
|
||||||
|
|
@ -80,6 +81,7 @@ class RiceShrimpFlowController extends Controller
|
||||||
'quarter',
|
'quarter',
|
||||||
'area',
|
'area',
|
||||||
'sales',
|
'sales',
|
||||||
|
'unit',
|
||||||
] as $key) {
|
] as $key) {
|
||||||
if ($request->filled($key)) {
|
if ($request->filled($key)) {
|
||||||
$riceShrimpFlow->{$key} = $request->input($key);
|
$riceShrimpFlow->{$key} = $request->input($key);
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ class RiceShrimpFlowStoreRequest extends FormRequest
|
||||||
'quarter' => ['required', new Quarter()],
|
'quarter' => ['required', new Quarter()],
|
||||||
'area' => ['required', 'string'],
|
'area' => ['required', 'string'],
|
||||||
'sales' => ['required', 'int', 'min:0'],
|
'sales' => ['required', 'int', 'min:0'],
|
||||||
|
'unit' => ['required', 'string'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -29,6 +30,7 @@ class RiceShrimpFlowStoreRequest extends FormRequest
|
||||||
'quarter' => '季度',
|
'quarter' => '季度',
|
||||||
'area' => '地区',
|
'area' => '地区',
|
||||||
'sales' => '销量',
|
'sales' => '销量',
|
||||||
|
'unit' => '单位',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ class RiceShrimpFlowUpdateRequest extends FormRequest
|
||||||
'quarter' => ['filled', new Quarter()],
|
'quarter' => ['filled', new Quarter()],
|
||||||
'area' => ['filled', 'string'],
|
'area' => ['filled', 'string'],
|
||||||
'sales' => ['filled', 'int', 'min:0'],
|
'sales' => ['filled', 'int', 'min:0'],
|
||||||
|
'unit' => ['filled', 'string'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -29,6 +30,7 @@ class RiceShrimpFlowUpdateRequest extends FormRequest
|
||||||
'quarter' => '季度',
|
'quarter' => '季度',
|
||||||
'area' => '地区',
|
'area' => '地区',
|
||||||
'sales' => '销量',
|
'sales' => '销量',
|
||||||
|
'unit' => '单位',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ class RiceShrimpFlowResource extends JsonResource
|
||||||
'quarter' => $this->quarter,
|
'quarter' => $this->quarter,
|
||||||
'area' => $this->area,
|
'area' => $this->area,
|
||||||
'sales' => $this->sales,
|
'sales' => $this->sales,
|
||||||
|
'unit' => $this->unit,
|
||||||
'created_by' => AdminUserResource::make($this->whenLoaded('createdBy')),
|
'created_by' => AdminUserResource::make($this->whenLoaded('createdBy')),
|
||||||
'updated_by' => AdminUserResource::make($this->whenLoaded('updatedBy')),
|
'updated_by' => AdminUserResource::make($this->whenLoaded('updatedBy')),
|
||||||
'created_at' => $this->created_at->unix(),
|
'created_at' => $this->created_at->unix(),
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ class RiceShrimpFlow extends Model
|
||||||
'quarter',
|
'quarter',
|
||||||
'area',
|
'area',
|
||||||
'sales',
|
'sales',
|
||||||
|
'unit',
|
||||||
'created_by',
|
'created_by',
|
||||||
'updated_by',
|
'updated_by',
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ return new class extends Migration
|
||||||
$table->tinyInteger('quarter')->comment('季度');
|
$table->tinyInteger('quarter')->comment('季度');
|
||||||
$table->string('area')->comment('地区');
|
$table->string('area')->comment('地区');
|
||||||
$table->unsignedBigInteger('sales')->comment('销量');
|
$table->unsignedBigInteger('sales')->comment('销量');
|
||||||
|
$table->string('unit')->comment('单位');
|
||||||
$table->unsignedBigInteger('created_by')->comment('创建人ID');
|
$table->unsignedBigInteger('created_by')->comment('创建人ID');
|
||||||
$table->unsignedBigInteger('updated_by')->comment('修改人ID');
|
$table->unsignedBigInteger('updated_by')->comment('修改人ID');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue