欢迎光临
我们一直在努力

制造业中流程卡的生成-数据库专栏,SQL Server

建站超值云服务器,限时71元/月

流程卡的生成

流程卡在制造业中是一个被技术多年采用的一种管理与描述生产技术过程的一种表现形式,通过流程卡,可以很明了地体现了技术的过程,在mrpiik中,可以通过多层bom表提取通过处理后,由数据库自动生成流程卡,以下为流程卡的生成的数据库过程

create  procedure  pro_card

as

select parent,max(parnt_desc) as parnt_desc,

max(case component when wc[r]101 then comp_desc else null end) as wc[r]101,

max(case component when wc[r]102 then comp_desc else null end) as wc[r]102,

max(case component when wc[r]103 then comp_desc else null end) as wc[r]103,

max(case component when wc[r]104 then comp_desc else null end) as wc[r]104,

max(case component when wc[r]105 then comp_desc else null end) as wc[r]105,

max(case component when wc[r]106 then comp_desc else null end) as wc[r]106,

max(case component when wc[r]107 then comp_desc else null end) as wc[r]107,

max(case component when wc[r]108 then comp_desc else null end) as wc[r]108,

max(case component when wc[r]109 then comp_desc else null end) as wc[r]109,

max(case component when wc[r]10b then comp_desc else null end) as wc[r]10b,

max(case component when wc[r]10c then comp_desc else null end) as wc[r]10c,

max(case component when wc[r]10d then comp_desc else null end) as wc[r]10d

max(case component when wc[r]10e then comp_desc else null end) as wc[r]10e,

max(case component when wc[r]201 then comp_desc else null end) as wc[r]201,

max(case component whenwc[r]202 then comp_desc else null end) as wc[r]202,

max(case component whenwc[r]203 then comp_desc else null end) as wc[r]203,

max(case component whenwc[r]204 then comp_desc else null end) as wc[r]204,

max(case component whenwc[r]205 then comp_desc else null end) as wc[r]205,

max(case component whenwc[r]206 then comp_desc else null end) as wc[r]206,

max(case component whenwc[r]207 then comp_desc else null end) as wc[r]207,

max(case component whenwc[r]208 then comp_desc else null end) as wc[r]208,

max(case component when wc[r]301 then comp_desc else null end) as wc[r]301,

max(case component when wc[r]302 then comp_desc else null end) as wc[r]302,

max(case component when wc[r]303 then comp_desc else null end) as wc[r]303,

max(case component when wc[r]304 then comp_desc else null end) as wc[r]304,

max(case component when wc[r]305 then comp_desc else null end) as wc[r]305,

max(case component when wc[r]306 then comp_desc else null end) as wc[r]306,

max(case component when wc[r]307 then comp_desc else null end) as wc[r]307,

max(case component when wc[r]308 then comp_desc else null end) as wc[r]308,

max(case component when wc[r]309 then comp_desc else null end) as wc[r]309,

max(case component when wc[r]501 then comp_desc else null end) as wc[r]501,

max(case component when wc[r]601 then comp_desc else null end) as wc[r]601,

max(case component when wc[r]701 then comp_desc else null end) as wc[r]701,

max(case component when wc[r]801 then comp_desc else null end) as wc[r]801

from m_bom

group by parent

go

建立存储过程,产生数据交叉表,这是一个基础工作。

建立如下的dts包,生成表p_card

图一

在表p_card的基础上生成视图也就是我们的最终要看到了结果pr_card

pr_card的代码如下:

create  view pr_card

as

select parent,parnt_desc,

ltrim(isnull([wc[r]]101],space(1))+space(1))+ltrim(isnull([wc[r]]102],space(1))+space(1))+

ltrim(isnull([wc[r]]103],space(1))+space(1))+ltrim(isnull([wc[r]]104],space(1))+space(1))+

ltrim(isnull([wc[r]]105],space(1))+space(1))+ltrim(isnull([wc[r]]106],space(1))+space(1))+

ltrim(isnull([wc[r]]107],space(1))+space(1))+ltrim(isnull([wc[r]]108],space(1))+space(1))+

ltrim(isnull([wc[r]]109],space(1))+space(1))+ltrim(isnull([wc[r]]10b],space(1))+space(1))+

ltrim(isnull([wc[r]]10c],space(1))+space(1))+ltrim(isnull([wc[r]]10d],space(1))+space(1))+

ltrim(isnull([wc[r]]10e],space(1))+space(1))+ltrim(isnull([wc[r]]201],space(1))+space(1))+

ltrim(isnull([wc[r]]202],space(1))+space(1))+ltrim(isnull([wc[r]]203],space(1))+space(1))+

ltrim(isnull([wc[r]]204],space(1))+space(1))+ltrim(isnull([wc[r]]205],space(1))+space(1))+

ltrim(isnull([wc[r]]206],space(1))+space(1))+ltrim(isnull([wc[r]]207],space(1))+space(1))+

ltrim(isnull([wc[r]]208],space(1))+space(1))+ltrim(isnull([wc[r]]301],space(1))+space(1))+

ltrim(isnull([wc[r]]302],space(1))+space(1))+ltrim(isnull([wc[r]]303],space(1))+space(1))+

ltrim(isnull([wc[r]]304],space(1))+space(1))+ltrim(isnull([wc[r]]305],space(1))+space(1))+

ltrim(isnull([wc[r]]306],space(1))+space(1))+ltrim(isnull([wc[r]]307],space(1))+space(1))+

ltrim(isnull([wc[r]]308],space(1))+space(1))+ltrim(isnull([wc[r]]309],space(1))+space(1))+

ltrim(isnull([wc[r]]501],space(1))+space(1))+ltrim(isnull([wc[r]]601],space(1))+space(1))+

ltrim(isnull([wc[r]]701),space(1))+space(1))+isnull([wc[r]]801),space(1)) as 流程卡

from dbo.p_card

到些流程卡的设计就结束了,最终结果的形式如下:

其中,是利用空格来体现不同工位的表述。

本人为本科应界毕业生,愿从事企业信息化工作,希望有兴趣的公司或企业可以与我联系,我在静候

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 制造业中流程卡的生成-数据库专栏,SQL Server
分享到: 更多 (0)