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,7 +40,13 @@ 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'],
'animal_info_id' => $params['animal_info_id']??0,
'type' => 2,
'type_text'=>'驱虫',
'detail' => json_encode([
'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'], 'vermifuge_name' => $params['vermifuge_name'],
@ -49,7 +55,18 @@ class OperationDewormingLogLogic extends BaseLogic
'operator' => $params['operator'], 'operator' => $params['operator'],
'pic' => $params['pic'], 'pic' => $params['pic'],
'remark' => $params['remark'], '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,7 +73,12 @@ 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'],
'animal_info_id' => $params['animal_info_id']??0,
'type' => 1,
'type_text'=>'消毒',
'detail' => json_encode([
'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'], 'disinfectant_name' => $params['disinfectant_name'],
@ -83,7 +88,19 @@ class OperationDisinfectLogLogic extends BaseLogic
'operator' => $params['operator'], 'operator' => $params['operator'],
'pic' => $params['pic'], 'pic' => $params['pic'],
'remark' => $params['remark'], '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,7 +40,13 @@ class OperationFeedingLogLogic extends BaseLogic
{ {
Db::startTrans(); Db::startTrans();
try { try {
OperationFeedingLog::create([
Db::name('bs_animal_operate_action')->insert([
'fence_house_id' => $params['fence_house_id'],
'animal_info_id' => $params['animal_info_id']??0,
'type' => 3,
'type_text'=>'喂食',
'detail' => json_encode([
'animal_info_id' => $params['animal_info_id']??0, 'animal_info_id' => $params['animal_info_id']??0,
'fence_house_id' => $params['fence_house_id'], 'fence_house_id' => $params['fence_house_id'],
'feed_type' => $params['feed_type'], 'feed_type' => $params['feed_type'],
@ -49,8 +55,20 @@ class OperationFeedingLogLogic extends BaseLogic
'operator' => $params['operator'], 'operator' => $params['operator'],
'pic' => $params['pic'], 'pic' => $params['pic'],
'remark' => $params['remark'], '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,7 +75,13 @@ 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'],
'animal_info_id' => $params['animal_info_id']??0,
'type' => 4,
'type_text'=>'疫苗',
'detail' => json_encode([
'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'], 'vaccine_name' => $params['vaccine_name'],
@ -87,7 +93,21 @@ class OperationVaccinumLogLogic extends BaseLogic
'operator' => $params['operator'], 'operator' => $params['operator'],
'pic' => $params['pic'], 'pic' => $params['pic'],
'remark' => $params['remark'], '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([
Db::name('bs_animal_operate_action')->insert([
'fence_house_id' => $params['fence_house_id'],
'animal_info_id' => $params['animal_info_id']??0,
'type' => 5,
'type_text'=>'喂水',
'detail' => json_encode([
'animal_info_id' => $params['animal_info_id']??0, 'animal_info_id' => $params['animal_info_id']??0,
'fence_house_id' => $params['fence_house_id'], 'fence_house_id' => $params['fence_house_id'],
'water_consumption' => $params['water_consumption'], 'water_consumption' => $params['water_consumption'],
'operator' => $params['operator'], 'operator' => $params['operator'],
'pic' => $params['pic'], 'pic' => $params['pic'],
'remark' => $params['remark'], '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');
}
}