This commit is contained in:
chenbo 2024-01-31 17:42:56 +08:00
parent ae32963785
commit aaaedd247a
11 changed files with 177 additions and 49 deletions

View File

@ -16,6 +16,7 @@ namespace app\api\lists\suyuan_operation;
use app\common\lists\BaseDataLists; use app\common\lists\BaseDataLists;
use app\common\model\suyuan_operation\AnimalOperateAction;
use app\common\model\suyuan_operation\OperationDewormingLog; use app\common\model\suyuan_operation\OperationDewormingLog;
use app\common\lists\ListsSearchInterface; use app\common\lists\ListsSearchInterface;
@ -55,7 +56,7 @@ class OperationDewormingLogLists extends BaseDataLists implements ListsSearchInt
*/ */
public function lists(): array public function lists(): array
{ {
return OperationDewormingLog::where($this->searchWhere) return AnimalOperateAction::where($this->searchWhere)->where('type', 2)
->with(['fenceHouseAttr', 'animalInfo']) ->with(['fenceHouseAttr', 'animalInfo'])
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc']) ->order(['id' => 'desc'])
@ -72,7 +73,7 @@ class OperationDewormingLogLists extends BaseDataLists implements ListsSearchInt
*/ */
public function count(): int public function count(): int
{ {
return OperationDewormingLog::where($this->searchWhere)->count(); return AnimalOperateAction::where($this->searchWhere)->where('type', 2)->count();
} }
} }

View File

@ -16,6 +16,7 @@ namespace app\api\lists\suyuan_operation;
use app\common\lists\BaseDataLists; use app\common\lists\BaseDataLists;
use app\common\model\suyuan_operation\AnimalOperateAction;
use app\common\model\suyuan_operation\OperationDisinfectLog; use app\common\model\suyuan_operation\OperationDisinfectLog;
use app\common\lists\ListsSearchInterface; use app\common\lists\ListsSearchInterface;
@ -55,7 +56,7 @@ class OperationDisinfectLogLists extends BaseDataLists implements ListsSearchInt
*/ */
public function lists(): array public function lists(): array
{ {
return OperationDisinfectLog::where($this->searchWhere) return AnimalOperateAction::where($this->searchWhere)->where('type', 1)
->with(['fenceHouseAttr', 'animalInfo']) ->with(['fenceHouseAttr', 'animalInfo'])
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc']) ->order(['id' => 'desc'])
@ -72,7 +73,7 @@ class OperationDisinfectLogLists extends BaseDataLists implements ListsSearchInt
*/ */
public function count(): int public function count(): int
{ {
return OperationDisinfectLog::where($this->searchWhere)->count(); return AnimalOperateAction::where($this->searchWhere)->where('type', 1)->count();
} }
} }

View File

@ -16,6 +16,8 @@ namespace app\api\lists\suyuan_operation;
use app\common\lists\BaseDataLists; use app\common\lists\BaseDataLists;
use app\common\model\suyuan_operation\AnimalOperateAction;
use app\common\model\suyuan_operation\OperationDisinfectLog;
use app\common\model\suyuan_operation\OperationFeedingLog; use app\common\model\suyuan_operation\OperationFeedingLog;
use app\common\lists\ListsSearchInterface; use app\common\lists\ListsSearchInterface;
@ -55,7 +57,7 @@ class OperationFeedingLogLists extends BaseDataLists implements ListsSearchInter
*/ */
public function lists(): array public function lists(): array
{ {
return OperationFeedingLog::where($this->searchWhere) return AnimalOperateAction::where($this->searchWhere)->where('type', 3)
->with(['fenceHouseAttr', 'animalInfo']) ->with(['fenceHouseAttr', 'animalInfo'])
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc']) ->order(['id' => 'desc'])
@ -72,7 +74,7 @@ class OperationFeedingLogLists extends BaseDataLists implements ListsSearchInter
*/ */
public function count(): int public function count(): int
{ {
return OperationFeedingLog::where($this->searchWhere)->count(); return AnimalOperateAction::where($this->searchWhere)->where('type', 3)->count();
} }
} }

View File

@ -16,6 +16,7 @@ namespace app\api\lists\suyuan_operation;
use app\common\lists\BaseDataLists; use app\common\lists\BaseDataLists;
use app\common\model\suyuan_operation\AnimalOperateAction;
use app\common\model\suyuan_operation\OperationVaccinumLog; use app\common\model\suyuan_operation\OperationVaccinumLog;
use app\common\lists\ListsSearchInterface; use app\common\lists\ListsSearchInterface;
@ -55,7 +56,7 @@ class OperationVaccinumLogLists extends BaseDataLists implements ListsSearchInte
*/ */
public function lists(): array public function lists(): array
{ {
return OperationVaccinumLog::where($this->searchWhere) return AnimalOperateAction::where($this->searchWhere)->where('type', 4)
->with(['fenceHouseAttr', 'animalInfo']) ->with(['fenceHouseAttr', 'animalInfo'])
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc']) ->order(['id' => 'desc'])
@ -72,7 +73,7 @@ class OperationVaccinumLogLists extends BaseDataLists implements ListsSearchInte
*/ */
public function count(): int public function count(): int
{ {
return OperationVaccinumLog::where($this->searchWhere)->count(); return AnimalOperateAction::where($this->searchWhere)->where('type', 4)->count();
} }
} }

View File

@ -16,6 +16,7 @@ namespace app\api\lists\suyuan_operation;
use app\common\lists\BaseDataLists; use app\common\lists\BaseDataLists;
use app\common\model\suyuan_operation\AnimalOperateAction;
use app\common\model\suyuan_operation\OperationWaterLog; use app\common\model\suyuan_operation\OperationWaterLog;
use app\common\lists\ListsSearchInterface; use app\common\lists\ListsSearchInterface;
@ -55,7 +56,7 @@ class OperationWaterLogLists extends BaseDataLists implements ListsSearchInterfa
*/ */
public function lists(): array public function lists(): array
{ {
return OperationWaterLog::where($this->searchWhere) return AnimalOperateAction::where($this->searchWhere)->where('type', 5)
->with(['fenceHouseAttr', 'animalInfo']) ->with(['fenceHouseAttr', 'animalInfo'])
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc']) ->order(['id' => 'desc'])
@ -72,7 +73,7 @@ class OperationWaterLogLists extends BaseDataLists implements ListsSearchInterfa
*/ */
public function count(): int public function count(): int
{ {
return OperationWaterLog::where($this->searchWhere)->count(); return AnimalOperateAction::where($this->searchWhere)->where('type', 5)->count();
} }
} }

View File

@ -40,16 +40,33 @@ class OperationDewormingLogLogic extends BaseLogic
{ {
Db::startTrans(); Db::startTrans();
try { try {
OperationDewormingLog::create([
Db::name('bs_animal_operate_action')->insert([
'fence_house_id' => $params['fence_house_id'], 'fence_house_id' => $params['fence_house_id'],
'animal_info_id' => $params['animal_info_id']??0, 'animal_info_id' => $params['animal_info_id']??0,
'vermifuge_name' => $params['vermifuge_name'], 'type' => 2,
'deworming_date' => $params['deworming_date'], 'type_text'=>'驱虫',
'deworming_method' => $params['deworming_method'], 'detail' => json_encode([
'operator' => $params['operator'], 'fence_house_id' => $params['fence_house_id'],
'pic' => $params['pic'], 'animal_info_id' => $params['animal_info_id']??0,
'remark' => $params['remark'], 'vermifuge_name' => $params['vermifuge_name'],
'deworming_date' => $params['deworming_date'],
'deworming_method' => $params['deworming_method'],
'operator' => $params['operator'],
'pic' => $params['pic'],
'remark' => $params['remark'],
])
]); ]);
// OperationDewormingLog::create([
// 'fence_house_id' => $params['fence_house_id'],
// 'animal_info_id' => $params['animal_info_id']??0,
// 'vermifuge_name' => $params['vermifuge_name'],
// 'deworming_date' => $params['deworming_date'],
// 'deworming_method' => $params['deworming_method'],
// 'operator' => $params['operator'],
// 'pic' => $params['pic'],
// 'remark' => $params['remark'],
// ]);
Db::commit(); Db::commit();
return true; return true;

View File

@ -73,17 +73,34 @@ class OperationDisinfectLogLogic extends BaseLogic
{ {
Db::startTrans(); Db::startTrans();
try { try {
OperationDisinfectLog::where('id', $params['id'])->update([ Db::name('bs_animal_operate_action')->insert([
'fence_house_id' => $params['fence_house_id'], 'fence_house_id' => $params['fence_house_id'],
'animal_info_id' => $params['animal_info_id']??0, 'animal_info_id' => $params['animal_info_id']??0,
'disinfectant_name' => $params['disinfectant_name'], 'type' => 1,
'concentration' => $params['concentration'], 'type_text'=>'消毒',
'disinfectant_method' => $params['disinfectant_method'], 'detail' => json_encode([
'disinfectant_area' => $params['disinfectant_area'], 'fence_house_id' => $params['fence_house_id'],
'operator' => $params['operator'], 'animal_info_id' => $params['animal_info_id']??0,
'pic' => $params['pic'], 'disinfectant_name' => $params['disinfectant_name'],
'remark' => $params['remark'], 'concentration' => $params['concentration'],
'disinfectant_method' => $params['disinfectant_method'],
'disinfectant_area' => $params['disinfectant_area'],
'operator' => $params['operator'],
'pic' => $params['pic'],
'remark' => $params['remark'],
])
]); ]);
// OperationDisinfectLog::where('id', $params['id'])->update([
// 'fence_house_id' => $params['fence_house_id'],
// 'animal_info_id' => $params['animal_info_id']??0,
// 'disinfectant_name' => $params['disinfectant_name'],
// 'concentration' => $params['concentration'],
// 'disinfectant_method' => $params['disinfectant_method'],
// 'disinfectant_area' => $params['disinfectant_area'],
// 'operator' => $params['operator'],
// 'pic' => $params['pic'],
// 'remark' => $params['remark'],
// ]);
Db::commit(); Db::commit();
return true; return true;

View File

@ -40,17 +40,35 @@ class OperationFeedingLogLogic extends BaseLogic
{ {
Db::startTrans(); Db::startTrans();
try { try {
OperationFeedingLog::create([
'animal_info_id' => $params['animal_info_id']??0, Db::name('bs_animal_operate_action')->insert([
'fence_house_id' => $params['fence_house_id'], 'fence_house_id' => $params['fence_house_id'],
'feed_type' => $params['feed_type'], 'animal_info_id' => $params['animal_info_id']??0,
'feed_brand' => $params['feed_brand'], 'type' => 3,
'feed_consumption' => $params['feed_consumption'], 'type_text'=>'喂食',
'operator' => $params['operator'], 'detail' => json_encode([
'pic' => $params['pic'], 'animal_info_id' => $params['animal_info_id']??0,
'remark' => $params['remark'], 'fence_house_id' => $params['fence_house_id'],
'feed_type' => $params['feed_type'],
'feed_brand' => $params['feed_brand'],
'feed_consumption' => $params['feed_consumption'],
'operator' => $params['operator'],
'pic' => $params['pic'],
'remark' => $params['remark'],
])
]); ]);
// OperationFeedingLog::create([
// 'animal_info_id' => $params['animal_info_id']??0,
// 'fence_house_id' => $params['fence_house_id'],
// 'feed_type' => $params['feed_type'],
// 'feed_brand' => $params['feed_brand'],
// 'feed_consumption' => $params['feed_consumption'],
// 'operator' => $params['operator'],
// 'pic' => $params['pic'],
// 'remark' => $params['remark'],
// ]);
Db::commit(); Db::commit();
return true; return true;
} catch (\Exception $e) { } catch (\Exception $e) {

View File

@ -75,19 +75,39 @@ class OperationVaccinumLogLogic extends BaseLogic
{ {
Db::startTrans(); Db::startTrans();
try { try {
OperationVaccinumLog::where('id', $params['id'])->update([
Db::name('bs_animal_operate_action')->insert([
'fence_house_id' => $params['fence_house_id'], 'fence_house_id' => $params['fence_house_id'],
'animal_info_id' => $params['animal_info_id']??0, 'animal_info_id' => $params['animal_info_id']??0,
'vaccine_name' => $params['vaccine_name'], 'type' => 4,
'vaccine_manufacturers' => $params['vaccine_manufacturers'], 'type_text'=>'疫苗',
'vaccine_batch' => $params['vaccine_batch'], 'detail' => json_encode([
'vaccination_method' => $params['vaccination_method'], 'fence_house_id' => $params['fence_house_id'],
'vaccination_site' => $params['vaccination_site'], 'animal_info_id' => $params['animal_info_id']??0,
'immune_validity_period' => $params['immune_validity_period'], 'vaccine_name' => $params['vaccine_name'],
'operator' => $params['operator'], 'vaccine_manufacturers' => $params['vaccine_manufacturers'],
'pic' => $params['pic'], 'vaccine_batch' => $params['vaccine_batch'],
'remark' => $params['remark'], 'vaccination_method' => $params['vaccination_method'],
'vaccination_site' => $params['vaccination_site'],
'immune_validity_period' => $params['immune_validity_period'],
'operator' => $params['operator'],
'pic' => $params['pic'],
'remark' => $params['remark'],
])
]); ]);
// OperationVaccinumLog::where('id', $params['id'])->update([
// 'fence_house_id' => $params['fence_house_id'],
// 'animal_info_id' => $params['animal_info_id']??0,
// 'vaccine_name' => $params['vaccine_name'],
// 'vaccine_manufacturers' => $params['vaccine_manufacturers'],
// 'vaccine_batch' => $params['vaccine_batch'],
// 'vaccination_method' => $params['vaccination_method'],
// 'vaccination_site' => $params['vaccination_site'],
// 'immune_validity_period' => $params['immune_validity_period'],
// 'operator' => $params['operator'],
// 'pic' => $params['pic'],
// 'remark' => $params['remark'],
// ]);
Db::commit(); Db::commit();
return true; return true;

View File

@ -40,15 +40,31 @@ class OperationWaterLogLogic extends BaseLogic
{ {
Db::startTrans(); Db::startTrans();
try { try {
OperationWaterLog::create([
'animal_info_id' => $params['animal_info_id']??0, Db::name('bs_animal_operate_action')->insert([
'fence_house_id' => $params['fence_house_id'], 'fence_house_id' => $params['fence_house_id'],
'water_consumption' => $params['water_consumption'], 'animal_info_id' => $params['animal_info_id']??0,
'operator' => $params['operator'], 'type' => 5,
'pic' => $params['pic'], 'type_text'=>'喂水',
'remark' => $params['remark'], 'detail' => json_encode([
'animal_info_id' => $params['animal_info_id']??0,
'fence_house_id' => $params['fence_house_id'],
'water_consumption' => $params['water_consumption'],
'operator' => $params['operator'],
'pic' => $params['pic'],
'remark' => $params['remark'],
])
]); ]);
// OperationWaterLog::create([
// 'animal_info_id' => $params['animal_info_id']??0,
// 'fence_house_id' => $params['fence_house_id'],
// 'water_consumption' => $params['water_consumption'],
// 'operator' => $params['operator'],
// 'pic' => $params['pic'],
// 'remark' => $params['remark'],
// ]);
Db::commit(); Db::commit();
return true; return true;
} catch (\Exception $e) { } catch (\Exception $e) {

View File

@ -0,0 +1,34 @@
<?php
namespace app\common\model\suyuan_operation;
use app\common\model\BaseModel;
class AnimalOperateAction extends BaseModel
{
protected $name = 'animal_operate_action';
protected $deleteTime = 'delete_time';
/**
* @notes 关联fenceHouseAttr
* @return \think\model\relation\HasOne
* @author likeadmin
* @date 2024/01/15 10:04
*/
public function fenceHouseAttr()
{
return $this->hasOne(\app\common\model\fence_house\FenceHouse::class, 'id', 'fence_house_id');
}
/**
* @notes 关联animalInfo
* @return \think\model\relation\HasOne
* @author likeadmin
* @date 2024/01/15 10:04
*/
public function animalInfo()
{
return $this->hasOne(\app\common\model\animal_info\AnimalInfo::class, 'id', 'animal_info_id');
}
}