Files
huachuang/sql/mysql/lms_auto_sleeve_test_data.sql

93 lines
4.1 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- 自动套轴接口测试数据。
-- 测试接口:POST /rpc-api/lms/autoCallAirShaft/executeSleeve
-- 说明:接口会锁定以下四个点位并向 ACS 下发套轴数据,不会直接创建搬运任务。
-- 按当前 ACS 地址配置使用生产区域 1;如果测试环境对应区域 2,请改为 '2'。
SET @test_plan = '1';
SET @test_tube_code = 'TUBE001';
SET @test_air_shaft_code = 'QZZ001';
-- 删除上次生成的同名测试点位,便于重复初始化。
DELETE FROM lms_shafttubeivt
WHERE point_code IN (
'AS_TC01',
'AS_TT01',
'AS_SC01',
'AS_ST01'
);
-- 管芯缓存位:point_type=4,必须包含管芯编码、匹配的气涨轴编码和规划区域。
INSERT INTO lms_shafttubeivt
(ivt_id, point_code, point_name, qzz_size, qzz_generation, tube_code, tube_name,
container_name, point_type, point_location, have_qzz, is_used, sort_seq,
plan, parent_code, lock_status, creator, create_name, updater, update_optname,
create_time, update_time, deleted)
VALUES
(99090701, 'AS_TC01', '套轴管芯缓存', '6',
@test_air_shaft_code, @test_tube_code, '自动套轴测试纸管', NULL, '4',
'TEST', '0', '1', 0, @test_plan, NULL, '0',
1, '管理员', 1, '管理员', NOW(), NOW(), '0');
-- 套管管芯目标位:point_type=2,规划区域必须与管芯缓存位一致,库存必须为空。
INSERT INTO lms_shafttubeivt
(ivt_id, point_code, point_name, qzz_size, qzz_generation, tube_code, tube_name,
container_name, point_type, point_location, have_qzz, is_used, sort_seq,
plan, parent_code, lock_status, creator, create_name, updater, update_optname,
create_time, update_time, deleted)
VALUES
(99090702, 'AS_TT01', '套轴管芯位', NULL,
NULL, NULL, NULL, NULL, '2', 'TEST', '0', '1', 0,
@test_plan, NULL, '0', 1, '管理员', 1, '管理员', NOW(), NOW(), '0');
-- 气涨轴缓存位:point_type=3,气涨轴编码必须与管芯缓存位的 qzz_generation 一致。
INSERT INTO lms_shafttubeivt
(ivt_id, point_code, point_name, qzz_size, qzz_generation, tube_code, tube_name,
container_name, point_type, point_location, have_qzz, is_used, sort_seq,
plan, parent_code, lock_status, creator, create_name, updater, update_optname,
create_time, update_time, deleted)
VALUES
(99090703, 'AS_SC01', '套轴气涨轴缓存', '6',
@test_air_shaft_code, NULL, NULL, NULL, '3', 'TEST', '1', '1',
0, @test_plan, NULL, '0', 1, '管理员', 1, '管理员', NOW(), NOW(), '0');
-- 套管气涨轴目标位:point_type=7,规划区域必须与管芯缓存位一致,库存必须为空。
INSERT INTO lms_shafttubeivt
(ivt_id, point_code, point_name, qzz_size, qzz_generation, tube_code, tube_name,
container_name, point_type, point_location, have_qzz, is_used, sort_seq,
plan, parent_code, lock_status, creator, create_name, updater, update_optname,
create_time, update_time, deleted)
VALUES
(99090704, 'AS_ST01', '套轴气涨轴位', NULL,
NULL, NULL, NULL, NULL, '7', 'TEST', '0', '1', 0,
@test_plan, NULL, '0', 1, '管理员', 1, '管理员', NOW(), NOW(), '0');
-- 调用接口前检查:四条记录的 lock_status 都应为 0。
SELECT ivt_id, point_code, point_type, qzz_size, qzz_generation, tube_code,
container_name, have_qzz, is_used, sort_seq, plan, lock_status
FROM lms_shafttubeivt
WHERE point_code IN ('AS_TC01', 'AS_TT01', 'AS_SC01', 'AS_ST01')
AND deleted = 0
ORDER BY point_type, point_code;
-- 调用接口成功且 ACS 返回成功后,再执行此查询。
-- 四条记录的 lock_status 都应由 0 变为 1。
SELECT point_code, point_type, lock_status
FROM lms_shafttubeivt
WHERE point_code IN (
'AS_TC01',
'AS_TT01',
'AS_SC01',
'AS_ST01'
)
ORDER BY point_type;
-- 测试失败或需要重新调用时,执行以下语句释放测试点位锁。
-- UPDATE lms_shafttubeivt
-- SET lock_status = '0'
-- WHERE point_code IN ('AS_TC01', 'AS_TT01', 'AS_SC01', 'AS_ST01')
-- AND deleted = 0;
-- 测试结束后如需清理数据,手动执行以下语句。
-- DELETE FROM lms_shafttubeivt
-- WHERE point_code IN ('AS_TC01', 'AS_TT01', 'AS_SC01', 'AS_ST01');