feat: 完善WCS调度、库存追溯和出库分配

This commit is contained in:
zgw
2026-07-15 16:24:07 +08:00
parent 9d3aa7a3bd
commit 66ac268524
101 changed files with 12596 additions and 669 deletions

View File

@@ -0,0 +1,95 @@
set nocount on;
set xact_abort on;
/* 03仓充电桩:仅允许更新指定的两个货位节点。 */
begin try
begin transaction;
if
(
select count(*)
from dbo.bas_cargo_space with (updlock, holdlock)
where warehouse_id = N'03'
and cargo_space_id in (N'03060501', N'03060502')
) <> 2
throw 51020, N'03仓充电桩货位不存在或数量异常。', 1;
update dbo.bas_cargo_space
set status = N'10',
the_type_name = N'充电桩',
cargo_space_name = concat(
right(N'00' + convert(nvarchar(2), the_platoon), 2), N'排',
right(N'00' + convert(nvarchar(2), the_column), 2), N'列',
right(N'00' + convert(nvarchar(2), the_floor), 2), N'层-充电桩'
),
group_coding_no = null,
group_coding = null,
this_cargo_area = null
where warehouse_id = N'03'
and cargo_space_id in (N'03060501', N'03060502');
declare @updated_count int = @@rowcount;
if @updated_count <> 2
throw 51021, N'03仓充电桩更新数量异常。', 1;
if not exists
(
select 1
from dbo.sys_dict_data
where dict_type = N'bas_cargo_space_status'
and dict_value = N'10'
)
begin
insert into dbo.sys_dict_data
(
dict_sort, dict_label, dict_value, dict_type,
css_class, list_class, is_default, status,
create_by, create_time, update_by, update_time, remark
)
values
(
10, N'充电桩', N'10', N'bas_cargo_space_status',
null, N'info', N'N', N'0',
N'admin', getdate(), N'', null, N'03仓充电桩节点'
);
end
else
begin
update dbo.sys_dict_data
set dict_label = N'充电桩',
dict_sort = 10,
status = N'0',
remark = N'03仓充电桩节点',
update_by = N'admin',
update_time = getdate()
where dict_type = N'bas_cargo_space_status'
and dict_value = N'10';
end;
if exists
(
select 1
from dbo.bas_cargo_space
where cargo_space_id in (N'03060501', N'03060502')
and
(
warehouse_id <> N'03'
or status <> N'10'
or the_type_name <> N'充电桩'
or group_coding is not null
)
)
throw 51022, N'03仓充电桩结果校验失败。', 1;
commit transaction;
end try
begin catch
if xact_state() <> 0
rollback transaction;
throw;
end catch;
select cargo_space_id, cargo_space_name, status, the_type_name, group_coding
from dbo.bas_cargo_space
where cargo_space_id in (N'03060501', N'03060502')
order by cargo_space_id;