diff --git a/app/api/lists/suyuan_operation/OperationDewormingLogLists.php b/app/api/lists/suyuan_operation/OperationDewormingLogLists.php index e31ff79..4f2a7ec 100644 --- a/app/api/lists/suyuan_operation/OperationDewormingLogLists.php +++ b/app/api/lists/suyuan_operation/OperationDewormingLogLists.php @@ -16,6 +16,7 @@ namespace app\api\lists\suyuan_operation; use app\common\lists\BaseDataLists; +use app\common\model\suyuan_operation\AnimalOperateAction; use app\common\model\suyuan_operation\OperationDewormingLog; use app\common\lists\ListsSearchInterface; @@ -55,7 +56,7 @@ class OperationDewormingLogLists extends BaseDataLists implements ListsSearchInt */ public function lists(): array { - return OperationDewormingLog::where($this->searchWhere) + return AnimalOperateAction::where($this->searchWhere)->where('type', 2) ->with(['fenceHouseAttr', 'animalInfo']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) @@ -72,7 +73,7 @@ class OperationDewormingLogLists extends BaseDataLists implements ListsSearchInt */ public function count(): int { - return OperationDewormingLog::where($this->searchWhere)->count(); + return AnimalOperateAction::where($this->searchWhere)->where('type', 2)->count(); } } \ No newline at end of file diff --git a/app/api/lists/suyuan_operation/OperationDisinfectLogLists.php b/app/api/lists/suyuan_operation/OperationDisinfectLogLists.php index 8d82d7d..2f98977 100644 --- a/app/api/lists/suyuan_operation/OperationDisinfectLogLists.php +++ b/app/api/lists/suyuan_operation/OperationDisinfectLogLists.php @@ -16,6 +16,7 @@ namespace app\api\lists\suyuan_operation; use app\common\lists\BaseDataLists; +use app\common\model\suyuan_operation\AnimalOperateAction; use app\common\model\suyuan_operation\OperationDisinfectLog; use app\common\lists\ListsSearchInterface; @@ -55,7 +56,7 @@ class OperationDisinfectLogLists extends BaseDataLists implements ListsSearchInt */ public function lists(): array { - return OperationDisinfectLog::where($this->searchWhere) + return AnimalOperateAction::where($this->searchWhere)->where('type', 1) ->with(['fenceHouseAttr', 'animalInfo']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) @@ -72,7 +73,7 @@ class OperationDisinfectLogLists extends BaseDataLists implements ListsSearchInt */ public function count(): int { - return OperationDisinfectLog::where($this->searchWhere)->count(); + return AnimalOperateAction::where($this->searchWhere)->where('type', 1)->count(); } } \ No newline at end of file diff --git a/app/api/lists/suyuan_operation/OperationFeedingLogLists.php b/app/api/lists/suyuan_operation/OperationFeedingLogLists.php index 096994b..b257a74 100644 --- a/app/api/lists/suyuan_operation/OperationFeedingLogLists.php +++ b/app/api/lists/suyuan_operation/OperationFeedingLogLists.php @@ -16,6 +16,8 @@ namespace app\api\lists\suyuan_operation; 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\lists\ListsSearchInterface; @@ -55,7 +57,7 @@ class OperationFeedingLogLists extends BaseDataLists implements ListsSearchInter */ public function lists(): array { - return OperationFeedingLog::where($this->searchWhere) + return AnimalOperateAction::where($this->searchWhere)->where('type', 3) ->with(['fenceHouseAttr', 'animalInfo']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) @@ -72,7 +74,7 @@ class OperationFeedingLogLists extends BaseDataLists implements ListsSearchInter */ public function count(): int { - return OperationFeedingLog::where($this->searchWhere)->count(); + return AnimalOperateAction::where($this->searchWhere)->where('type', 3)->count(); } } \ No newline at end of file diff --git a/app/api/lists/suyuan_operation/OperationVaccinumLogLists.php b/app/api/lists/suyuan_operation/OperationVaccinumLogLists.php index 0555b7c..a6c4fad 100644 --- a/app/api/lists/suyuan_operation/OperationVaccinumLogLists.php +++ b/app/api/lists/suyuan_operation/OperationVaccinumLogLists.php @@ -16,6 +16,7 @@ namespace app\api\lists\suyuan_operation; use app\common\lists\BaseDataLists; +use app\common\model\suyuan_operation\AnimalOperateAction; use app\common\model\suyuan_operation\OperationVaccinumLog; use app\common\lists\ListsSearchInterface; @@ -55,7 +56,7 @@ class OperationVaccinumLogLists extends BaseDataLists implements ListsSearchInte */ public function lists(): array { - return OperationVaccinumLog::where($this->searchWhere) + return AnimalOperateAction::where($this->searchWhere)->where('type', 4) ->with(['fenceHouseAttr', 'animalInfo']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) @@ -72,7 +73,7 @@ class OperationVaccinumLogLists extends BaseDataLists implements ListsSearchInte */ public function count(): int { - return OperationVaccinumLog::where($this->searchWhere)->count(); + return AnimalOperateAction::where($this->searchWhere)->where('type', 4)->count(); } } \ No newline at end of file diff --git a/app/api/lists/suyuan_operation/OperationWaterLogLists.php b/app/api/lists/suyuan_operation/OperationWaterLogLists.php index fad1476..2857136 100644 --- a/app/api/lists/suyuan_operation/OperationWaterLogLists.php +++ b/app/api/lists/suyuan_operation/OperationWaterLogLists.php @@ -16,6 +16,7 @@ namespace app\api\lists\suyuan_operation; use app\common\lists\BaseDataLists; +use app\common\model\suyuan_operation\AnimalOperateAction; use app\common\model\suyuan_operation\OperationWaterLog; use app\common\lists\ListsSearchInterface; @@ -55,7 +56,7 @@ class OperationWaterLogLists extends BaseDataLists implements ListsSearchInterfa */ public function lists(): array { - return OperationWaterLog::where($this->searchWhere) + return AnimalOperateAction::where($this->searchWhere)->where('type', 5) ->with(['fenceHouseAttr', 'animalInfo']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) @@ -72,7 +73,7 @@ class OperationWaterLogLists extends BaseDataLists implements ListsSearchInterfa */ public function count(): int { - return OperationWaterLog::where($this->searchWhere)->count(); + return AnimalOperateAction::where($this->searchWhere)->where('type', 5)->count(); } } \ No newline at end of file diff --git a/app/api/logic/suyuan_operation/OperationDewormingLogLogic.php b/app/api/logic/suyuan_operation/OperationDewormingLogLogic.php index 31ca57f..b8b4c6e 100644 --- a/app/api/logic/suyuan_operation/OperationDewormingLogLogic.php +++ b/app/api/logic/suyuan_operation/OperationDewormingLogLogic.php @@ -40,16 +40,33 @@ class OperationDewormingLogLogic extends BaseLogic { Db::startTrans(); try { - OperationDewormingLog::create([ + + Db::name('bs_animal_operate_action')->insert([ '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'], + 'type' => 2, + 'type_text'=>'驱虫', + 'detail' => json_encode([ + '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'], + ]) ]); +// 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(); return true; diff --git a/app/api/logic/suyuan_operation/OperationDisinfectLogLogic.php b/app/api/logic/suyuan_operation/OperationDisinfectLogLogic.php index 712ee1d..e7bcfa1 100644 --- a/app/api/logic/suyuan_operation/OperationDisinfectLogLogic.php +++ b/app/api/logic/suyuan_operation/OperationDisinfectLogLogic.php @@ -73,17 +73,34 @@ class OperationDisinfectLogLogic extends BaseLogic { Db::startTrans(); try { - OperationDisinfectLog::where('id', $params['id'])->update([ + Db::name('bs_animal_operate_action')->insert([ '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'], + 'type' => 1, + 'type_text'=>'消毒', + 'detail' => json_encode([ + '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'], + ]) ]); +// 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(); return true; diff --git a/app/api/logic/suyuan_operation/OperationFeedingLogLogic.php b/app/api/logic/suyuan_operation/OperationFeedingLogLogic.php index 6cddc91..9c7c454 100644 --- a/app/api/logic/suyuan_operation/OperationFeedingLogLogic.php +++ b/app/api/logic/suyuan_operation/OperationFeedingLogLogic.php @@ -40,17 +40,35 @@ class OperationFeedingLogLogic extends BaseLogic { Db::startTrans(); 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'], - 'feed_type' => $params['feed_type'], - 'feed_brand' => $params['feed_brand'], - 'feed_consumption' => $params['feed_consumption'], - 'operator' => $params['operator'], - 'pic' => $params['pic'], - 'remark' => $params['remark'], + 'animal_info_id' => $params['animal_info_id']??0, + 'type' => 3, + 'type_text'=>'喂食', + 'detail' => json_encode([ + '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'], + ]) ]); +// 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(); return true; } catch (\Exception $e) { diff --git a/app/api/logic/suyuan_operation/OperationVaccinumLogLogic.php b/app/api/logic/suyuan_operation/OperationVaccinumLogLogic.php index 39addde..446817c 100644 --- a/app/api/logic/suyuan_operation/OperationVaccinumLogLogic.php +++ b/app/api/logic/suyuan_operation/OperationVaccinumLogLogic.php @@ -75,19 +75,39 @@ class OperationVaccinumLogLogic extends BaseLogic { Db::startTrans(); try { - OperationVaccinumLog::where('id', $params['id'])->update([ + + Db::name('bs_animal_operate_action')->insert([ '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'], + 'type' => 4, + 'type_text'=>'疫苗', + 'detail' => json_encode([ + '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'], + ]) ]); +// 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(); return true; diff --git a/app/api/logic/suyuan_operation/OperationWaterLogLogic.php b/app/api/logic/suyuan_operation/OperationWaterLogLogic.php index 76f11ac..b2fb30d 100644 --- a/app/api/logic/suyuan_operation/OperationWaterLogLogic.php +++ b/app/api/logic/suyuan_operation/OperationWaterLogLogic.php @@ -40,15 +40,31 @@ class OperationWaterLogLogic extends BaseLogic { Db::startTrans(); 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'], - 'water_consumption' => $params['water_consumption'], - 'operator' => $params['operator'], - 'pic' => $params['pic'], - 'remark' => $params['remark'], + 'animal_info_id' => $params['animal_info_id']??0, + 'type' => 5, + 'type_text'=>'喂水', + '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(); return true; } catch (\Exception $e) { diff --git a/app/common/model/suyuan_operation/AnimalOperateAction.php b/app/common/model/suyuan_operation/AnimalOperateAction.php new file mode 100644 index 0000000..2a16d40 --- /dev/null +++ b/app/common/model/suyuan_operation/AnimalOperateAction.php @@ -0,0 +1,34 @@ +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'); + } +} \ No newline at end of file