-- 出库一键设置测试数据。
-- 仓库：遂宁成品仓；库区：主存区。
-- 所有编码均使用 TEST-OCS- 前缀，脚本使用 INSERT IGNORE，可重复执行且不会覆盖测试中的锁状态。

INSERT IGNORE INTO wms_structattr
    (struct_id, struct_code, struct_name, sect_id, sect_code, sect_name,
     stor_id, stor_code, stor_name, is_tempstruct, row_num, col_num, layer_num,
     block_num, placement_type, storagevehicle_code, storagevehicle_qty,
     lock_type, creator, updater, deleted, is_used)
VALUES
    -- 左侧出库：从小列号侧出库，目标箱前有一个挡路箱。
    ('2080900000000001001', 'TEST-OCS-L-01', '左侧挡路仓位', '2078406241102450689', 'ZC01', '主存区',
     '2078405279260463106', 'AC01', '遂宁成品仓', '0', 91, 1, 1, 91, '02',
     'TEST-OCS-L-BLOCK', 1, '1', '1', '1', '0', 1),
    ('2080900000000001002', 'TEST-OCS-L-02', '左侧目标仓位', '2078406241102450689', 'ZC01', '主存区',
     '2078405279260463106', 'AC01', '遂宁成品仓', '0', 91, 2, 1, 91, '02',
     'TEST-OCS-L-TARGET', 1, '1', '1', '1', '0', 1),

    -- 右侧出库：从大列号侧出库，目标箱前有一个挡路箱。
    ('2080900000000001101', 'TEST-OCS-R-01', '右侧目标仓位', '2078406241102450689', 'ZC01', '主存区',
     '2078405279260463106', 'AC01', '遂宁成品仓', '0', 92, 1, 1, 92, '03',
     'TEST-OCS-R-TARGET', 1, '1', '1', '1', '0', 1),
    ('2080900000000001102', 'TEST-OCS-R-02', '右侧挡路仓位', '2078406241102450689', 'ZC01', '主存区',
     '2078405279260463106', 'AC01', '遂宁成品仓', '0', 92, 2, 1, 92, '03',
     'TEST-OCS-R-BLOCK', 1, '1', '1', '1', '0', 1),

    -- 双向出库：目标箱两侧均有挡路箱，左右移动数相同时默认选择左侧。
    ('2080900000000001201', 'TEST-OCS-D-01', '双向左挡路仓位', '2078406241102450689', 'ZC01', '主存区',
     '2078405279260463106', 'AC01', '遂宁成品仓', '0', 93, 1, 1, 93, '01',
     'TEST-OCS-D-LBLOCK', 1, '1', '1', '1', '0', 1),
    ('2080900000000001202', 'TEST-OCS-D-02', '双向目标仓位', '2078406241102450689', 'ZC01', '主存区',
     '2078405279260463106', 'AC01', '遂宁成品仓', '0', 93, 2, 1, 93, '01',
     'TEST-OCS-D-TARGET', 1, '1', '1', '1', '0', 1),
    ('2080900000000001203', 'TEST-OCS-D-03', '双向右挡路仓位', '2078406241102450689', 'ZC01', '主存区',
     '2078405279260463106', 'AC01', '遂宁成品仓', '0', 93, 3, 1, 93, '01',
     'TEST-OCS-D-RBLOCK', 1, '1', '1', '1', '0', 1),

    -- 空闲移库目的仓位。
    ('2080900000000001301', 'TEST-OCS-FREE-01', '移库空位01', '2078406241102450689', 'ZC01', '主存区',
     '2078405279260463106', 'AC01', '遂宁成品仓', '0', 94, 1, 1, 94, '01',
     NULL, 0, '1', '1', '1', '0', 1),
    ('2080900000000001302', 'TEST-OCS-FREE-02', '移库空位02', '2078406241102450689', 'ZC01', '主存区',
     '2078405279260463106', 'AC01', '遂宁成品仓', '0', 94, 2, 1, 94, '01',
     NULL, 0, '1', '1', '1', '0', 1),
    ('2080900000000001303', 'TEST-OCS-FREE-03', '移库空位03', '2078406241102450689', 'ZC01', '主存区',
     '2078405279260463106', 'AC01', '遂宁成品仓', '0', 94, 3, 1, 94, '01',
     NULL, 0, '1', '1', '1', '0', 1),
    ('2080900000000001304', 'TEST-OCS-FREE-04', '移库空位04', '2078406241102450689', 'ZC01', '主存区',
     '2078405279260463106', 'AC01', '遂宁成品仓', '0', 94, 4, 1, 94, '01',
     NULL, 0, '1', '1', '1', '0', 1),
    ('2080900000000001305', 'TEST-OCS-FREE-05', '移库空位05', '2078406241102450689', 'ZC01', '主存区',
     '2078405279260463106', 'AC01', '遂宁成品仓', '0', 94, 5, 1, 94, '01',
     NULL, 0, '1', '1', '1', '0', 1),
    ('2080900000000001306', 'TEST-OCS-FREE-06', '移库空位06', '2078406241102450689', 'ZC01', '主存区',
     '2078405279260463106', 'AC01', '遂宁成品仓', '0', 94, 6, 1, 94, '01',
     NULL, 0, '1', '1', '1', '0', 1);

INSERT IGNORE INTO wms_group_plate
    (group_id, vehicle_code, status, material_id, pcsn, qty, frozen_qty,
     qty_unit_id, qty_unit_name, remark, ext_code, ext_type, ext_dtl_code,
     material_code, creator, updater, deleted)
VALUES
    -- 挡路库存统一使用测试物料 B，避免被目标出库明细误分配。
    (2080900000000002001, 'TEST-OCS-L-BLOCK', '02', '2080700000000000102',
     'OCS-L-BLOCK-PCSN', 50.000, 0.000, 'KG', '千克', '左侧出库挡路箱',
     'OCS-BLOCK-SOURCE', 'TEST', 'OCS-L-BLOCK-DTL', 'TEST-MAT-002', '1', '1', b'0'),
    (2080900000000002002, 'TEST-OCS-L-TARGET', '02', '2080700000000000101',
     'OCS-L-TARGET-PCSN', 50.000, 0.000, 'KG', '千克', '左侧出库目标箱',
     'OCS-L-SOURCE', 'TEST', 'OCS-L-TARGET-DTL', 'TEST-MAT-001', '1', '1', b'0'),

    (2080900000000002101, 'TEST-OCS-R-TARGET', '02', '2080700000000000101',
     'OCS-R-TARGET-PCSN', 50.000, 0.000, 'KG', '千克', '右侧出库目标箱',
     'OCS-R-SOURCE', 'TEST', 'OCS-R-TARGET-DTL', 'TEST-MAT-001', '1', '1', b'0'),
    (2080900000000002102, 'TEST-OCS-R-BLOCK', '02', '2080700000000000102',
     'OCS-R-BLOCK-PCSN', 50.000, 0.000, 'KG', '千克', '右侧出库挡路箱',
     'OCS-BLOCK-SOURCE', 'TEST', 'OCS-R-BLOCK-DTL', 'TEST-MAT-002', '1', '1', b'0'),

    (2080900000000002201, 'TEST-OCS-D-LBLOCK', '02', '2080700000000000102',
     'OCS-D-LBLOCK-PCSN', 50.000, 0.000, 'KG', '千克', '双向出库左挡路箱',
     'OCS-BLOCK-SOURCE', 'TEST', 'OCS-D-LBLOCK-DTL', 'TEST-MAT-002', '1', '1', b'0'),
    (2080900000000002202, 'TEST-OCS-D-TARGET', '02', '2080700000000000101',
     'OCS-D-TARGET-PCSN', 50.000, 0.000, 'KG', '千克', '双向出库目标箱',
     'OCS-D-SOURCE', 'TEST', 'OCS-D-TARGET-DTL', 'TEST-MAT-001', '1', '1', b'0'),
    (2080900000000002203, 'TEST-OCS-D-RBLOCK', '02', '2080700000000000102',
     'OCS-D-RBLOCK-PCSN', 50.000, 0.000, 'KG', '千克', '双向出库右挡路箱',
     'OCS-BLOCK-SOURCE', 'TEST', 'OCS-D-RBLOCK-DTL', 'TEST-MAT-002', '1', '1', b'0');

-- 如需清理，请先删除引用这些载具的测试出库分配/任务，再执行：
-- DELETE FROM wms_group_plate WHERE vehicle_code LIKE 'TEST-OCS-%';
-- DELETE FROM wms_structattr WHERE struct_code LIKE 'TEST-OCS-%';
