-- MySQL:只读检查,不调用接口、不修改库存。 -- 第一次先执行下面这条,找出你已创建的工单。 SELECT CAST(workorder_id AS CHAR) AS workorder_id, container_name, resource_name, product_area, status, is_delete, create_time FROM pdm_bi_rawfoilworkorder WHERE is_delete = '0' ORDER BY create_time DESC LIMIT 20; -- 替换为目标工单ID,保留引号,避免大整数精度丢失。 SET @test_workorder_id = '2106993313478479872'; -- 应恰好返回一行。status=01,is_used=1,四个相关字段不应为空。 -- point_code 使用生箔机主点位,不是 resource_name,也不是 empty_point_code。 SELECT CAST(w.workorder_id AS CHAR) AS workorder_id, w.container_name, w.status, w.is_delete, w.resource_name, w.product_area AS order_area, sb.product_area AS device_area, sb.point_id, sb.point_code, sb.point_location, sb.is_used, sb.empty_point_code, sb.full_point_code, JSON_OBJECT('raw_jo', JSON_OBJECT( 'workorder_id', CAST(w.workorder_id AS CHAR), 'container_name', w.container_name, 'point_code', sb.point_code )) AS request_body FROM pdm_bi_rawfoilworkorder w LEFT JOIN st_ivt_sbpointivt sb ON sb.ext_code = w.resource_name WHERE w.workorder_id = @test_workorder_id; -- 必须没有该母卷的未完成任务;不要为重复测试随意删除已有任务。 SELECT t.task_id, t.task_type, t.task_status, t.material_code, t.point_code1, t.point_code2, t.point_code3, t.point_code4 FROM sch_base_task t JOIN pdm_bi_rawfoilworkorder w ON w.container_name = t.material_code WHERE w.workorder_id = @test_workorder_id AND t.is_delete = '0' AND t.task_status < '07'; -- 冷却位候选及完整点位冲突检查。 -- 接口先选择同侧,再选择另一侧;每侧按冷却位point_code升序取第一条。 -- blocking_tasks应为0。接口自身初筛仅检查冷却空轴位的任务起终点, -- 若第一条候选在下面完整检查中冲突,后续createTask仍会报错,不会自动换下一条。 SELECT c.ivt_id, c.point_code, c.product_area, c.point_location, c.empty_point_code AS point_code1, sb.empty_point_code AS point_code2, sb.full_point_code AS point_code3, c.full_point_code AS point_code4, c.empty_point_status, c.full_point_status, CASE WHEN c.point_location = sb.point_location THEN 0 ELSE 1 END AS side_priority, (SELECT COUNT(*) FROM sch_base_task t WHERE t.is_delete = '0' AND t.task_status < '07' AND (t.point_code1 IN (c.empty_point_code, sb.empty_point_code, sb.full_point_code, c.full_point_code) OR t.point_code2 IN (c.empty_point_code, sb.empty_point_code, sb.full_point_code, c.full_point_code) OR t.point_code3 IN (c.empty_point_code, sb.empty_point_code, sb.full_point_code, c.full_point_code) OR t.point_code4 IN (c.empty_point_code, sb.empty_point_code, sb.full_point_code, c.full_point_code))) AS blocking_tasks FROM pdm_bi_rawfoilworkorder w JOIN st_ivt_sbpointivt sb ON sb.ext_code = w.resource_name JOIN st_ivt_coolpointivt c ON c.product_area = sb.product_area WHERE w.workorder_id = @test_workorder_id AND c.is_used = '1' AND c.point_type = '1' AND c.empty_point_status = '02' AND c.full_point_status = '01' AND (c.point_location = sb.point_location OR (sb.point_location IN ('0', '1') AND c.point_location IN ('0', '1'))) AND NOT EXISTS (SELECT 1 FROM sch_base_task t WHERE t.is_delete = '0' AND t.task_status < '07' AND (t.point_code1 = c.empty_point_code OR t.point_code2 = c.empty_point_code)) ORDER BY side_priority, c.point_code; -- 本地纯流程测试:必须已有参数且value=0;没有参数会在ACS工具类取值时空指针。 -- 这是全局开关,此脚本只检查,不修改。 SELECT code, value FROM sys_param WHERE code = 'is_connect_acs'; -- 接口执行后检查:工单status应变成02,新增任务类型010101。 SELECT workorder_id, container_name, status, update_time FROM pdm_bi_rawfoilworkorder WHERE workorder_id = @test_workorder_id; SELECT t.task_id, t.task_type, t.task_status, t.is_delete, t.acs_task_type, t.material_code, t.point_code1, t.point_code2, t.point_code3, t.point_code4 FROM sch_base_task t JOIN pdm_bi_rawfoilworkorder w ON w.container_name = t.material_code WHERE w.workorder_id = @test_workorder_id ORDER BY t.create_time DESC;