feat:material_application
This commit is contained in:
@@ -11,7 +11,8 @@ use Hyperf\DbConnection\Model\Model;
|
||||
* @property int $id
|
||||
* @property int $material_id
|
||||
* @property int $dish_id
|
||||
* @property int $num
|
||||
* @property string $number
|
||||
* @property string $al_number
|
||||
* @property string $processing
|
||||
* @property int $status
|
||||
* @property int $city_id
|
||||
@@ -36,7 +37,7 @@ class MaterialApplication extends Model
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*/
|
||||
protected array $casts = ['id' => 'integer', 'material_id' => 'integer', 'dish_id' => 'integer', 'num' => 'integer', 'status' => 'integer', 'city_id' => 'integer', 'kitchen_id' => 'integer', 'operator_id' => 'integer', 'is_del' => 'integer'];
|
||||
protected array $casts = ['id' => 'integer', 'material_id' => 'integer', 'dish_id' => 'integer', 'status' => 'integer', 'city_id' => 'integer', 'kitchen_id' => 'integer', 'operator_id' => 'integer', 'is_del' => 'integer'];
|
||||
|
||||
const CREATED_AT = 'create_time';
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class MaterialRequest extends FormRequest
|
||||
protected array $scenes = [
|
||||
'material_list' => ['limit','query_name'],
|
||||
'material_application' => ['material_id','dish_id','number','processing','city_id','kitchen_id'],
|
||||
'application_edit' => ['id','material_id','dish_id','number','processing'],
|
||||
'application_edit' => ['id','number','processing'],
|
||||
'application_delete' => ['id'],
|
||||
'application_list' => ['limit'],
|
||||
];
|
||||
|
||||
@@ -48,7 +48,7 @@ class MaterialService extends BaseService{
|
||||
{
|
||||
$material_id = (int)$this->request->input('material_id');
|
||||
$dish_id = (int)$this->request->input('dish_id');
|
||||
$number = (int)$this->request->input('number');
|
||||
$number = (double)$this->request->input('number');
|
||||
$processing = $this->request->input('processing');
|
||||
$status = MaterialCode::UN_AUDIT;
|
||||
$city_id = (int)$this->request->input('city_id');
|
||||
@@ -57,7 +57,7 @@ class MaterialService extends BaseService{
|
||||
$materialApplication = new MaterialApplication();
|
||||
$materialApplication->material_id = $material_id;
|
||||
$materialApplication->dish_id = $dish_id;
|
||||
$materialApplication->num = $number;
|
||||
$materialApplication->number = $number;
|
||||
$materialApplication->processing = $processing;
|
||||
$materialApplication->status = $status;
|
||||
$materialApplication->city_id = $city_id;
|
||||
@@ -73,21 +73,16 @@ class MaterialService extends BaseService{
|
||||
public function applicationEdit(): array
|
||||
{
|
||||
$id = (int)$this->request->input('id');
|
||||
$material_id = (int)$this->request->input('material_id');
|
||||
$dish_id = (int)$this->request->input('dish_id');
|
||||
$number = (int)$this->request->input('number');
|
||||
$processing = $this->request->input('processing');
|
||||
|
||||
$info = $this->MaterialApplication->getInfoById($id);
|
||||
|
||||
if (!empty($material_id)){
|
||||
$info->material_id = $material_id;
|
||||
}
|
||||
if (!empty($dish_id)){
|
||||
$info->dish_id = $dish_id;
|
||||
}
|
||||
if (!empty($number)){
|
||||
$info->num = $number;
|
||||
$info->number = $number;
|
||||
if($number <= $info->al_number){
|
||||
$info->status = MaterialCode::ALL_OUT;
|
||||
}
|
||||
}
|
||||
if (!empty($processing)){
|
||||
$info->processing = $processing;
|
||||
|
||||
Reference in New Issue
Block a user