修改管理后台
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
* 描述: 初始化基础数据
|
||||
*/
|
||||
'use strict';
|
||||
const bcrypt = require('bcrypt');
|
||||
const bcrypt = require('bcryptjs');
|
||||
|
||||
module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
|
||||
109
backend/seeds/20250118000001_electronic_fence_data.js
Normal file
109
backend/seeds/20250118000001_electronic_fence_data.js
Normal file
@@ -0,0 +1,109 @@
|
||||
/**
|
||||
* 电子围栏种子数据
|
||||
* 添加示例围栏数据
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
// 插入示例围栏数据
|
||||
await queryInterface.bulkInsert('electronic_fences', [
|
||||
{
|
||||
name: '银川南湖围栏',
|
||||
type: 'collector',
|
||||
description: '银川南湖区域采集器围栏,用于监控南湖区域的动物活动',
|
||||
coordinates: JSON.stringify([
|
||||
{ lng: 106.275, lat: 38.485 },
|
||||
{ lng: 106.285, lat: 38.485 },
|
||||
{ lng: 106.285, lat: 38.495 },
|
||||
{ lng: 106.275, lat: 38.495 }
|
||||
]),
|
||||
center_lng: 106.280,
|
||||
center_lat: 38.490,
|
||||
area: 10000.0,
|
||||
grazing_status: 'grazing',
|
||||
inside_count: 0,
|
||||
outside_count: 0,
|
||||
is_active: true,
|
||||
farm_id: 1,
|
||||
created_by: 1,
|
||||
updated_by: 1,
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
name: '银川东区围栏',
|
||||
type: 'grazing',
|
||||
description: '银川东区放牧围栏,用于测试功能',
|
||||
coordinates: JSON.stringify([
|
||||
{ lng: 106.260, lat: 38.480 },
|
||||
{ lng: 106.270, lat: 38.480 },
|
||||
{ lng: 106.270, lat: 38.490 },
|
||||
{ lng: 106.260, lat: 38.490 }
|
||||
]),
|
||||
center_lng: 106.265,
|
||||
center_lat: 38.485,
|
||||
area: 5000.0,
|
||||
grazing_status: 'not_grazing',
|
||||
inside_count: 5,
|
||||
outside_count: 2,
|
||||
is_active: true,
|
||||
farm_id: 1,
|
||||
created_by: 1,
|
||||
updated_by: 1,
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
name: '安全围栏A区',
|
||||
type: 'safety',
|
||||
description: '安全围栏A区,用于保护重要区域',
|
||||
coordinates: JSON.stringify([
|
||||
{ lng: 106.30, lat: 38.50 },
|
||||
{ lng: 106.31, lat: 38.50 },
|
||||
{ lng: 106.31, lat: 38.51 },
|
||||
{ lng: 106.30, lat: 38.51 }
|
||||
]),
|
||||
center_lng: 106.305,
|
||||
center_lat: 38.505,
|
||||
area: 8000.0,
|
||||
grazing_status: 'not_grazing',
|
||||
inside_count: 3,
|
||||
outside_count: 1,
|
||||
is_active: true,
|
||||
farm_id: 1,
|
||||
created_by: 1,
|
||||
updated_by: 1,
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
name: '大型放牧区',
|
||||
type: 'grazing',
|
||||
description: '大型放牧区域,适合大规模放牧活动',
|
||||
coordinates: JSON.stringify([
|
||||
{ lng: 106.20, lat: 38.40 },
|
||||
{ lng: 106.25, lat: 38.40 },
|
||||
{ lng: 106.25, lat: 38.45 },
|
||||
{ lng: 106.20, lat: 38.45 }
|
||||
]),
|
||||
center_lng: 106.225,
|
||||
center_lat: 38.425,
|
||||
area: 25000.0,
|
||||
grazing_status: 'grazing',
|
||||
inside_count: 15,
|
||||
outside_count: 3,
|
||||
is_active: true,
|
||||
farm_id: 1,
|
||||
created_by: 1,
|
||||
updated_by: 1,
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
}
|
||||
], {});
|
||||
},
|
||||
|
||||
down: async (queryInterface, Sequelize) => {
|
||||
// 删除所有围栏数据
|
||||
await queryInterface.bulkDelete('electronic_fences', null, {});
|
||||
}
|
||||
};
|
||||
261
backend/seeds/20250118000002_electronic_fence_points_data.js
Normal file
261
backend/seeds/20250118000002_electronic_fence_points_data.js
Normal file
@@ -0,0 +1,261 @@
|
||||
/**
|
||||
* 电子围栏坐标点种子数据
|
||||
* 添加示例坐标点数据
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
// 插入示例坐标点数据
|
||||
await queryInterface.bulkInsert('electronic_fence_points', [
|
||||
// 银川南湖围栏的坐标点
|
||||
{
|
||||
fence_id: 2,
|
||||
point_order: 0,
|
||||
longitude: 106.275,
|
||||
latitude: 38.485,
|
||||
point_type: 'corner',
|
||||
description: '南湖围栏西南角',
|
||||
is_active: true,
|
||||
created_by: 1,
|
||||
updated_by: 1,
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
fence_id: 2,
|
||||
point_order: 1,
|
||||
longitude: 106.285,
|
||||
latitude: 38.485,
|
||||
point_type: 'corner',
|
||||
description: '南湖围栏东南角',
|
||||
is_active: true,
|
||||
created_by: 1,
|
||||
updated_by: 1,
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
fence_id: 2,
|
||||
point_order: 2,
|
||||
longitude: 106.285,
|
||||
latitude: 38.495,
|
||||
point_type: 'corner',
|
||||
description: '南湖围栏东北角',
|
||||
is_active: true,
|
||||
created_by: 1,
|
||||
updated_by: 1,
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
fence_id: 2,
|
||||
point_order: 3,
|
||||
longitude: 106.275,
|
||||
latitude: 38.495,
|
||||
point_type: 'corner',
|
||||
description: '南湖围栏西北角',
|
||||
is_active: true,
|
||||
created_by: 1,
|
||||
updated_by: 1,
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
fence_id: 2,
|
||||
point_order: 4,
|
||||
longitude: 106.280,
|
||||
latitude: 38.490,
|
||||
point_type: 'control',
|
||||
description: '南湖围栏中心控制点',
|
||||
is_active: true,
|
||||
created_by: 1,
|
||||
updated_by: 1,
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
|
||||
// 银川东区围栏的坐标点
|
||||
{
|
||||
fence_id: 3,
|
||||
point_order: 0,
|
||||
longitude: 106.260,
|
||||
latitude: 38.480,
|
||||
point_type: 'corner',
|
||||
description: '东区围栏西南角',
|
||||
is_active: true,
|
||||
created_by: 1,
|
||||
updated_by: 1,
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
fence_id: 3,
|
||||
point_order: 1,
|
||||
longitude: 106.270,
|
||||
latitude: 38.480,
|
||||
point_type: 'corner',
|
||||
description: '东区围栏东南角',
|
||||
is_active: true,
|
||||
created_by: 1,
|
||||
updated_by: 1,
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
fence_id: 3,
|
||||
point_order: 2,
|
||||
longitude: 106.270,
|
||||
latitude: 38.490,
|
||||
point_type: 'corner',
|
||||
description: '东区围栏东北角',
|
||||
is_active: true,
|
||||
created_by: 1,
|
||||
updated_by: 1,
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
fence_id: 3,
|
||||
point_order: 3,
|
||||
longitude: 106.260,
|
||||
latitude: 38.490,
|
||||
point_type: 'corner',
|
||||
description: '东区围栏西北角',
|
||||
is_active: true,
|
||||
created_by: 1,
|
||||
updated_by: 1,
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
|
||||
// 安全围栏A区的坐标点
|
||||
{
|
||||
fence_id: 4,
|
||||
point_order: 0,
|
||||
longitude: 106.250,
|
||||
latitude: 38.470,
|
||||
point_type: 'corner',
|
||||
description: '安全围栏A区西南角',
|
||||
is_active: true,
|
||||
created_by: 1,
|
||||
updated_by: 1,
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
fence_id: 4,
|
||||
point_order: 1,
|
||||
longitude: 106.265,
|
||||
latitude: 38.470,
|
||||
point_type: 'corner',
|
||||
description: '安全围栏A区东南角',
|
||||
is_active: true,
|
||||
created_by: 1,
|
||||
updated_by: 1,
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
fence_id: 4,
|
||||
point_order: 2,
|
||||
longitude: 106.265,
|
||||
latitude: 38.485,
|
||||
point_type: 'corner',
|
||||
description: '安全围栏A区东北角',
|
||||
is_active: true,
|
||||
created_by: 1,
|
||||
updated_by: 1,
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
fence_id: 4,
|
||||
point_order: 3,
|
||||
longitude: 106.250,
|
||||
latitude: 38.485,
|
||||
point_type: 'corner',
|
||||
description: '安全围栏A区西北角',
|
||||
is_active: true,
|
||||
created_by: 1,
|
||||
updated_by: 1,
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
|
||||
// 大型放牧区的坐标点
|
||||
{
|
||||
fence_id: 5,
|
||||
point_order: 0,
|
||||
longitude: 106.240,
|
||||
latitude: 38.460,
|
||||
point_type: 'corner',
|
||||
description: '大型放牧区西南角',
|
||||
is_active: true,
|
||||
created_by: 1,
|
||||
updated_by: 1,
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
fence_id: 5,
|
||||
point_order: 1,
|
||||
longitude: 106.280,
|
||||
latitude: 38.460,
|
||||
point_type: 'corner',
|
||||
description: '大型放牧区东南角',
|
||||
is_active: true,
|
||||
created_by: 1,
|
||||
updated_by: 1,
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
fence_id: 5,
|
||||
point_order: 2,
|
||||
longitude: 106.280,
|
||||
latitude: 38.500,
|
||||
point_type: 'corner',
|
||||
description: '大型放牧区东北角',
|
||||
is_active: true,
|
||||
created_by: 1,
|
||||
updated_by: 1,
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
fence_id: 5,
|
||||
point_order: 3,
|
||||
longitude: 106.240,
|
||||
latitude: 38.500,
|
||||
point_type: 'corner',
|
||||
description: '大型放牧区西北角',
|
||||
is_active: true,
|
||||
created_by: 1,
|
||||
updated_by: 1,
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
},
|
||||
{
|
||||
fence_id: 5,
|
||||
point_order: 4,
|
||||
longitude: 106.260,
|
||||
latitude: 38.480,
|
||||
point_type: 'control',
|
||||
description: '大型放牧区中心控制点',
|
||||
is_active: true,
|
||||
created_by: 1,
|
||||
updated_by: 1,
|
||||
created_at: new Date(),
|
||||
updated_at: new Date()
|
||||
}
|
||||
]);
|
||||
|
||||
console.log('✅ 电子围栏坐标点种子数据插入成功');
|
||||
},
|
||||
|
||||
down: async (queryInterface, Sequelize) => {
|
||||
// 删除所有坐标点数据
|
||||
await queryInterface.bulkDelete('electronic_fence_points', null, {});
|
||||
console.log('✅ 电子围栏坐标点种子数据删除成功');
|
||||
}
|
||||
};
|
||||
123
backend/seeds/20250118000003_pens_data.js
Normal file
123
backend/seeds/20250118000003_pens_data.js
Normal file
@@ -0,0 +1,123 @@
|
||||
/**
|
||||
* 栏舍数据种子文件
|
||||
* @file 20250118000003_pens_data.js
|
||||
* @description 插入栏舍测试数据
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
async up(queryInterface, Sequelize) {
|
||||
// 插入栏舍测试数据
|
||||
await queryInterface.bulkInsert('pens', [
|
||||
{
|
||||
name: '牛舍-001',
|
||||
animal_type: 'cattle',
|
||||
pen_type: '育肥牛舍',
|
||||
responsible: '张三',
|
||||
capacity: 50,
|
||||
status: true,
|
||||
description: '专门用于育肥牛的栏舍,配备完善的通风和饮水系统',
|
||||
farm_id: 1,
|
||||
creator: 'admin',
|
||||
created_at: new Date('2024-01-15 09:00:00'),
|
||||
updated_at: new Date('2024-01-15 09:00:00')
|
||||
},
|
||||
{
|
||||
name: '羊舍-001',
|
||||
animal_type: 'sheep',
|
||||
pen_type: '母羊舍',
|
||||
responsible: '李四',
|
||||
capacity: 100,
|
||||
status: true,
|
||||
description: '用于饲养母羊的栏舍,环境舒适,适合繁殖',
|
||||
farm_id: 1,
|
||||
creator: 'admin',
|
||||
created_at: new Date('2024-01-16 10:30:00'),
|
||||
updated_at: new Date('2024-01-16 10:30:00')
|
||||
},
|
||||
{
|
||||
name: '马舍-001',
|
||||
animal_type: 'horse',
|
||||
pen_type: '种马舍',
|
||||
responsible: '王五',
|
||||
capacity: 20,
|
||||
status: true,
|
||||
description: '专门用于种马饲养的高档栏舍',
|
||||
farm_id: 2,
|
||||
creator: 'admin',
|
||||
created_at: new Date('2024-01-17 14:20:00'),
|
||||
updated_at: new Date('2024-01-17 14:20:00')
|
||||
},
|
||||
{
|
||||
name: '家禽舍-001',
|
||||
animal_type: 'poultry',
|
||||
pen_type: '蛋鸡舍',
|
||||
responsible: '赵六',
|
||||
capacity: 500,
|
||||
status: true,
|
||||
description: '现代化蛋鸡饲养栏舍,配备自动喂料和集蛋系统',
|
||||
farm_id: 2,
|
||||
creator: 'admin',
|
||||
created_at: new Date('2024-01-18 08:45:00'),
|
||||
updated_at: new Date('2024-01-18 08:45:00')
|
||||
},
|
||||
{
|
||||
name: '猪舍-001',
|
||||
animal_type: 'pig',
|
||||
pen_type: '育肥猪舍',
|
||||
responsible: '孙七',
|
||||
capacity: 80,
|
||||
status: true,
|
||||
description: '现代化育肥猪栏舍,配备自动饮水系统',
|
||||
farm_id: 3,
|
||||
creator: 'admin',
|
||||
created_at: new Date('2024-01-19 11:15:00'),
|
||||
updated_at: new Date('2024-01-19 11:15:00')
|
||||
},
|
||||
{
|
||||
name: '牛舍-002',
|
||||
animal_type: 'cattle',
|
||||
pen_type: '奶牛舍',
|
||||
responsible: '周八',
|
||||
capacity: 60,
|
||||
status: true,
|
||||
description: '专门用于奶牛饲养的栏舍,配备挤奶设备',
|
||||
farm_id: 3,
|
||||
creator: 'admin',
|
||||
created_at: new Date('2024-01-20 13:30:00'),
|
||||
updated_at: new Date('2024-01-20 13:30:00')
|
||||
},
|
||||
{
|
||||
name: '羊舍-002',
|
||||
animal_type: 'sheep',
|
||||
pen_type: '羔羊舍',
|
||||
responsible: '吴九',
|
||||
capacity: 150,
|
||||
status: false,
|
||||
description: '用于饲养羔羊的栏舍,目前正在维护中',
|
||||
farm_id: 4,
|
||||
creator: 'admin',
|
||||
created_at: new Date('2024-01-21 16:00:00'),
|
||||
updated_at: new Date('2024-01-21 16:00:00')
|
||||
},
|
||||
{
|
||||
name: '家禽舍-002',
|
||||
animal_type: 'poultry',
|
||||
pen_type: '肉鸡舍',
|
||||
responsible: '郑十',
|
||||
capacity: 300,
|
||||
status: true,
|
||||
description: '用于肉鸡饲养的栏舍,配备温控系统',
|
||||
farm_id: 4,
|
||||
creator: 'admin',
|
||||
created_at: new Date('2024-01-22 09:30:00'),
|
||||
updated_at: new Date('2024-01-22 09:30:00')
|
||||
}
|
||||
], {});
|
||||
},
|
||||
|
||||
async down(queryInterface, Sequelize) {
|
||||
await queryInterface.bulkDelete('pens', null, {});
|
||||
}
|
||||
};
|
||||
83
backend/seeds/20250118000005_cattle_pens_data.js
Normal file
83
backend/seeds/20250118000005_cattle_pens_data.js
Normal file
@@ -0,0 +1,83 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
// 插入栏舍设置数据
|
||||
await queryInterface.bulkInsert('cattle_pens', [
|
||||
{
|
||||
name: '杭嘉新村栏舍01',
|
||||
code: 'PEN001',
|
||||
type: '育成栏',
|
||||
capacity: 50,
|
||||
current_count: 15,
|
||||
area: 200.50,
|
||||
location: '养殖场东区1号位置',
|
||||
status: '启用',
|
||||
remark: '主要用于育成母牛饲养',
|
||||
farm_id: 1,
|
||||
created_at: new Date('2025-01-15 10:30:00'),
|
||||
updated_at: new Date('2025-01-15 10:30:00')
|
||||
},
|
||||
{
|
||||
name: '杭嘉新村栏舍02',
|
||||
code: 'PEN002',
|
||||
type: '产房',
|
||||
capacity: 20,
|
||||
current_count: 8,
|
||||
area: 150.00,
|
||||
location: '养殖场西区2号位置',
|
||||
status: '启用',
|
||||
remark: '专门用于母牛产房',
|
||||
farm_id: 1,
|
||||
created_at: new Date('2025-01-15 10:35:00'),
|
||||
updated_at: new Date('2025-01-15 10:35:00')
|
||||
},
|
||||
{
|
||||
name: '杭嘉新村栏舍03',
|
||||
code: 'PEN003',
|
||||
type: '配种栏',
|
||||
capacity: 10,
|
||||
current_count: 3,
|
||||
area: 80.00,
|
||||
location: '养殖场南区3号位置',
|
||||
status: '启用',
|
||||
remark: '用于公牛配种',
|
||||
farm_id: 1,
|
||||
created_at: new Date('2025-01-15 10:40:00'),
|
||||
updated_at: new Date('2025-01-15 10:40:00')
|
||||
},
|
||||
{
|
||||
name: '杭嘉新村栏舍04',
|
||||
code: 'PEN004',
|
||||
type: '隔离栏',
|
||||
capacity: 15,
|
||||
current_count: 2,
|
||||
area: 120.00,
|
||||
location: '养殖场北区4号位置',
|
||||
status: '启用',
|
||||
remark: '用于隔离观察病牛',
|
||||
farm_id: 1,
|
||||
created_at: new Date('2025-01-15 10:45:00'),
|
||||
updated_at: new Date('2025-01-15 10:45:00')
|
||||
},
|
||||
{
|
||||
name: '杭嘉新村栏舍05',
|
||||
code: 'PEN005',
|
||||
type: '治疗栏',
|
||||
capacity: 8,
|
||||
current_count: 1,
|
||||
area: 60.00,
|
||||
location: '养殖场中心区5号位置',
|
||||
status: '启用',
|
||||
remark: '用于病牛治疗',
|
||||
farm_id: 1,
|
||||
created_at: new Date('2025-01-15 10:50:00'),
|
||||
updated_at: new Date('2025-01-15 10:50:00')
|
||||
}
|
||||
], {});
|
||||
},
|
||||
|
||||
down: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.bulkDelete('cattle_pens', null, {});
|
||||
}
|
||||
};
|
||||
93
backend/seeds/20250118000006_cattle_batches_data.js
Normal file
93
backend/seeds/20250118000006_cattle_batches_data.js
Normal file
@@ -0,0 +1,93 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
// 插入批次设置数据
|
||||
await queryInterface.bulkInsert('cattle_batches', [
|
||||
{
|
||||
name: '2025年春季育成批次',
|
||||
code: 'BATCH2025001',
|
||||
type: '育成批次',
|
||||
start_date: new Date('2025-01-01'),
|
||||
expected_end_date: new Date('2025-06-30'),
|
||||
actual_end_date: null,
|
||||
target_count: 100,
|
||||
current_count: 85,
|
||||
manager: '张三',
|
||||
status: '进行中',
|
||||
remark: '春季育成批次,主要饲养育成母牛',
|
||||
farm_id: 1,
|
||||
created_at: new Date('2025-01-01 09:00:00'),
|
||||
updated_at: new Date('2025-01-01 09:00:00')
|
||||
},
|
||||
{
|
||||
name: '2024年冬季繁殖批次',
|
||||
code: 'BATCH2024001',
|
||||
type: '繁殖批次',
|
||||
start_date: new Date('2024-10-01'),
|
||||
expected_end_date: new Date('2025-03-31'),
|
||||
actual_end_date: new Date('2025-03-31'),
|
||||
target_count: 50,
|
||||
current_count: 50,
|
||||
manager: '李四',
|
||||
status: '已完成',
|
||||
remark: '冬季繁殖批次,已完成所有繁殖任务',
|
||||
farm_id: 1,
|
||||
created_at: new Date('2024-10-01 09:00:00'),
|
||||
updated_at: new Date('2024-10-01 09:00:00')
|
||||
},
|
||||
{
|
||||
name: '2025年育肥批次',
|
||||
code: 'BATCH2025002',
|
||||
type: '育肥批次',
|
||||
start_date: new Date('2025-02-01'),
|
||||
expected_end_date: new Date('2025-08-31'),
|
||||
actual_end_date: null,
|
||||
target_count: 80,
|
||||
current_count: 45,
|
||||
manager: '王五',
|
||||
status: '进行中',
|
||||
remark: '育肥批次,主要饲养肉牛',
|
||||
farm_id: 1,
|
||||
created_at: new Date('2025-02-01 09:00:00'),
|
||||
updated_at: new Date('2025-02-01 09:00:00')
|
||||
},
|
||||
{
|
||||
name: '2025年隔离批次',
|
||||
code: 'BATCH2025003',
|
||||
type: '隔离批次',
|
||||
start_date: new Date('2025-01-10'),
|
||||
expected_end_date: new Date('2025-02-10'),
|
||||
actual_end_date: null,
|
||||
target_count: 20,
|
||||
current_count: 8,
|
||||
manager: '赵六',
|
||||
status: '进行中',
|
||||
remark: '隔离批次,用于观察新引进牛只',
|
||||
farm_id: 1,
|
||||
created_at: new Date('2025-01-10 09:00:00'),
|
||||
updated_at: new Date('2025-01-10 09:00:00')
|
||||
},
|
||||
{
|
||||
name: '2025年治疗批次',
|
||||
code: 'BATCH2025004',
|
||||
type: '治疗批次',
|
||||
start_date: new Date('2025-01-15'),
|
||||
expected_end_date: new Date('2025-03-15'),
|
||||
actual_end_date: null,
|
||||
target_count: 15,
|
||||
current_count: 5,
|
||||
manager: '孙七',
|
||||
status: '进行中',
|
||||
remark: '治疗批次,用于病牛康复治疗',
|
||||
farm_id: 1,
|
||||
created_at: new Date('2025-01-15 09:00:00'),
|
||||
updated_at: new Date('2025-01-15 09:00:00')
|
||||
}
|
||||
], {});
|
||||
},
|
||||
|
||||
down: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.bulkDelete('cattle_batches', null, {});
|
||||
}
|
||||
};
|
||||
83
backend/seeds/20250118000007_cattle_transfer_records_data.js
Normal file
83
backend/seeds/20250118000007_cattle_transfer_records_data.js
Normal file
@@ -0,0 +1,83 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
// 插入转栏记录数据
|
||||
await queryInterface.bulkInsert('cattle_transfer_records', [
|
||||
{
|
||||
record_id: 'TR202501001',
|
||||
animal_id: 1,
|
||||
from_pen_id: 1,
|
||||
to_pen_id: 2,
|
||||
transfer_date: new Date('2025-01-15'),
|
||||
reason: '正常调栏',
|
||||
operator: '张三',
|
||||
status: '已完成',
|
||||
remark: '根据饲养计划进行正常调栏',
|
||||
farm_id: 1,
|
||||
created_at: new Date('2025-01-15 10:30:00'),
|
||||
updated_at: new Date('2025-01-15 10:30:00')
|
||||
},
|
||||
{
|
||||
record_id: 'TR202501002',
|
||||
animal_id: 2,
|
||||
from_pen_id: 1,
|
||||
to_pen_id: 3,
|
||||
transfer_date: new Date('2025-01-16'),
|
||||
reason: '疾病治疗',
|
||||
operator: '李四',
|
||||
status: '进行中',
|
||||
remark: '因健康问题转入治疗栏',
|
||||
farm_id: 1,
|
||||
created_at: new Date('2025-01-16 14:20:00'),
|
||||
updated_at: new Date('2025-01-16 14:20:00')
|
||||
},
|
||||
{
|
||||
record_id: 'TR202501003',
|
||||
animal_id: 3,
|
||||
from_pen_id: 2,
|
||||
to_pen_id: 1,
|
||||
transfer_date: new Date('2025-01-17'),
|
||||
reason: '配种需要',
|
||||
operator: '王五',
|
||||
status: '已完成',
|
||||
remark: '为配种需要调整栏舍',
|
||||
farm_id: 1,
|
||||
created_at: new Date('2025-01-17 09:15:00'),
|
||||
updated_at: new Date('2025-01-17 09:15:00')
|
||||
},
|
||||
{
|
||||
record_id: 'TR202501004',
|
||||
animal_id: 4,
|
||||
from_pen_id: 1,
|
||||
to_pen_id: 4,
|
||||
transfer_date: new Date('2025-01-18'),
|
||||
reason: '隔离观察',
|
||||
operator: '赵六',
|
||||
status: '已完成',
|
||||
remark: '新引进牛只隔离观察',
|
||||
farm_id: 1,
|
||||
created_at: new Date('2025-01-18 11:00:00'),
|
||||
updated_at: new Date('2025-01-18 11:00:00')
|
||||
},
|
||||
{
|
||||
record_id: 'TR202501005',
|
||||
animal_id: 5,
|
||||
from_pen_id: 2,
|
||||
to_pen_id: 5,
|
||||
transfer_date: new Date('2025-01-19'),
|
||||
reason: '疾病治疗',
|
||||
operator: '孙七',
|
||||
status: '进行中',
|
||||
remark: '病牛转入治疗栏',
|
||||
farm_id: 1,
|
||||
created_at: new Date('2025-01-19 15:30:00'),
|
||||
updated_at: new Date('2025-01-19 15:30:00')
|
||||
}
|
||||
], {});
|
||||
},
|
||||
|
||||
down: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.bulkDelete('cattle_transfer_records', null, {});
|
||||
}
|
||||
};
|
||||
88
backend/seeds/20250118000008_cattle_exit_records_data.js
Normal file
88
backend/seeds/20250118000008_cattle_exit_records_data.js
Normal file
@@ -0,0 +1,88 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
// 插入离栏记录数据
|
||||
await queryInterface.bulkInsert('cattle_exit_records', [
|
||||
{
|
||||
record_id: 'EX202501001',
|
||||
animal_id: 1,
|
||||
exit_date: new Date('2025-01-15'),
|
||||
exit_reason: '出售',
|
||||
original_pen_id: 1,
|
||||
destination: '某肉类加工厂',
|
||||
disposal_method: '屠宰',
|
||||
handler: '张三',
|
||||
status: '已确认',
|
||||
remark: '正常出售,已确认收款',
|
||||
farm_id: 1,
|
||||
created_at: new Date('2025-01-15 10:30:00'),
|
||||
updated_at: new Date('2025-01-15 10:30:00')
|
||||
},
|
||||
{
|
||||
record_id: 'EX202501002',
|
||||
animal_id: 2,
|
||||
exit_date: new Date('2025-01-16'),
|
||||
exit_reason: '死亡',
|
||||
original_pen_id: 1,
|
||||
destination: '无害化处理中心',
|
||||
disposal_method: '掩埋',
|
||||
handler: '李四',
|
||||
status: '已确认',
|
||||
remark: '因病死亡,已进行无害化处理',
|
||||
farm_id: 1,
|
||||
created_at: new Date('2025-01-16 14:20:00'),
|
||||
updated_at: new Date('2025-01-16 14:20:00')
|
||||
},
|
||||
{
|
||||
record_id: 'EX202501003',
|
||||
animal_id: 3,
|
||||
exit_date: new Date('2025-01-17'),
|
||||
exit_reason: '淘汰',
|
||||
original_pen_id: 2,
|
||||
destination: '淘汰牛处理场',
|
||||
disposal_method: '屠宰',
|
||||
handler: '王五',
|
||||
status: '待确认',
|
||||
remark: '因年龄过大淘汰,待确认处理',
|
||||
farm_id: 1,
|
||||
created_at: new Date('2025-01-17 09:15:00'),
|
||||
updated_at: new Date('2025-01-17 09:15:00')
|
||||
},
|
||||
{
|
||||
record_id: 'EX202501004',
|
||||
animal_id: 4,
|
||||
exit_date: new Date('2025-01-18'),
|
||||
exit_reason: '转场',
|
||||
original_pen_id: 3,
|
||||
destination: '其他养殖场',
|
||||
disposal_method: '转售',
|
||||
handler: '赵六',
|
||||
status: '已确认',
|
||||
remark: '转场到其他养殖场继续饲养',
|
||||
farm_id: 1,
|
||||
created_at: new Date('2025-01-18 11:00:00'),
|
||||
updated_at: new Date('2025-01-18 11:00:00')
|
||||
},
|
||||
{
|
||||
record_id: 'EX202501005',
|
||||
animal_id: 5,
|
||||
exit_date: new Date('2025-01-19'),
|
||||
exit_reason: '其他',
|
||||
original_pen_id: 4,
|
||||
destination: '科研机构',
|
||||
disposal_method: '其他',
|
||||
handler: '孙七',
|
||||
status: '已取消',
|
||||
remark: '原计划用于科研,后取消',
|
||||
farm_id: 1,
|
||||
created_at: new Date('2025-01-19 15:30:00'),
|
||||
updated_at: new Date('2025-01-19 15:30:00')
|
||||
}
|
||||
], {});
|
||||
},
|
||||
|
||||
down: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.bulkDelete('cattle_exit_records', null, {});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user