USE [YL_MESDB]
GO

IF COL_LENGTH(N'dbo.基础数据_设备工位点检表', N'名称') IS NULL
  ALTER TABLE [dbo].[基础数据_设备工位点检表] ADD [名称] nvarchar(100) NULL
GO

ALTER PROCEDURE [dbo].[设备管理_设备信息_增加]
  @名称 nvarchar(50) = NULL,
  @公司编码 nvarchar(100) = NULL,
  @设备名称 nvarchar(50) = NULL,
  @设备型号 nvarchar(50) = NULL,
  @设备类型 nvarchar(50) = NULL,
  @设备信息 nvarchar(500) = NULL,
  @使用部门 nvarchar(100) = NULL,
  @入账日期 nvarchar(50) = NULL,
  @单位 nvarchar(50) = NULL,
  @数量 decimal(18, 4) = NULL,
  @状态 nvarchar(50) = NULL,
  @维修记录 nvarchar(1000) = NULL,
  @维保记录 nvarchar(1000) = NULL,
  @工位绑定 nvarchar(1000) = NULL,
  @主要设备 nvarchar(10) = NULL,
  @设备标准开机工时 decimal(18, 4) = NULL,
  @特种设备 nvarchar(10) = NULL,
  @证书有效期至 nvarchar(50) = NULL
AS
BEGIN
  SET NOCOUNT ON;
  IF ISNULL(@公司编码, N'') = N'' BEGIN SELECT '0' AS result, N'公司编码不能为空' AS message; RETURN; END
  INSERT INTO [dbo].[基础数据_设备工位点检表] ([名称],[公司编码],[设备名称],[设备型号],[设备类型],[设备信息],[使用部门],[入账日期],[单位],[数量],[状态],[维修记录],[维保记录],[工位绑定],[主要设备],[设备标准开机工时],[特种设备],[证书有效期至])
  VALUES (@名称,@公司编码,@设备名称,@设备型号,@设备类型,@设备信息,@使用部门,TRY_CONVERT(date, NULLIF(@入账日期, N'')),@单位,@数量,@状态,@维修记录,@维保记录,@工位绑定,@主要设备,@设备标准开机工时,@特种设备,TRY_CONVERT(date, NULLIF(@证书有效期至, N'')));
  SELECT '1' AS result;
END
GO

ALTER PROCEDURE [dbo].[设备管理_设备信息_编辑]
  @设备流水号 int = NULL,
  @名称 nvarchar(50) = NULL,
  @公司编码 nvarchar(100) = NULL,
  @设备名称 nvarchar(50) = NULL,
  @设备型号 nvarchar(50) = NULL,
  @设备类型 nvarchar(50) = NULL,
  @设备信息 nvarchar(500) = NULL,
  @使用部门 nvarchar(100) = NULL,
  @入账日期 nvarchar(50) = NULL,
  @单位 nvarchar(50) = NULL,
  @数量 decimal(18, 4) = NULL,
  @状态 nvarchar(50) = NULL,
  @维修记录 nvarchar(1000) = NULL,
  @维保记录 nvarchar(1000) = NULL,
  @工位绑定 nvarchar(1000) = NULL,
  @主要设备 nvarchar(10) = NULL,
  @设备标准开机工时 decimal(18, 4) = NULL,
  @特种设备 nvarchar(10) = NULL,
  @证书有效期至 nvarchar(50) = NULL
AS
BEGIN
  SET NOCOUNT ON;
  UPDATE [dbo].[基础数据_设备工位点检表]
  SET [名称]=@名称,[设备名称]=@设备名称,[设备型号]=@设备型号,[设备类型]=@设备类型,[设备信息]=@设备信息,[使用部门]=@使用部门,[入账日期]=TRY_CONVERT(date, NULLIF(@入账日期, N'')),[单位]=@单位,[数量]=@数量,[状态]=@状态,[维修记录]=@维修记录,[维保记录]=@维保记录,[工位绑定]=@工位绑定,[主要设备]=@主要设备,[设备标准开机工时]=@设备标准开机工时,[特种设备]=@特种设备,[证书有效期至]=TRY_CONVERT(date, NULLIF(@证书有效期至, N''))
  WHERE [设备流水号]=@设备流水号;
  SELECT '1' AS result;
END
GO

DECLARE @导入设备 TABLE ([名称] nvarchar(100),[公司编码] nvarchar(100),[生产用名] nvarchar(50),[型号规格] nvarchar(50),[设备信息] nvarchar(500),[使用部门] nvarchar(100),[入账日期] date,[单位] nvarchar(50),[数量] decimal(18,4),[状态] nvarchar(50));
INSERT INTO @导入设备 VALUES (N'气泵（空压机）',N'REALLY-11',N'气泵',N'1.4MPa/YT132S-4',N'最大压力0.8Mpa',N'一楼机加车间','2006-12-31',N'台',1,N'停用');
INSERT INTO @导入设备 VALUES (N'台钻',N'REALLY-21',N'台钻',N'JW7114',N'φ2-12mm/0.1mm',N'二楼机加车间','2007-01-01',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'数控加工中心',N'REALLY-6',N'加1',N'VDL-600A',N'X600/Y420/Z520/',N'一楼机加车间','2008-12-23',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'普通车床',N'REALLY-1',N'普1',N'CD6240A',N'回转直径400/转速1400/0.04mm',N'一楼机加车间','2010-12-31',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'砂轮机',N'REALLY-19',N'砂轮机',N'MQ3225',N'转速3000/砂轮直径250',N'一楼机加车间','2010-12-31',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'数控车床',N'REALLY-3',N'数2',N'CAK5085di',N'床鞍直径280',N'一楼机加车间','2011-09-29',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'万能外圆磨床',N'REALLY-8',N'磨2',N'MG1420E',N'0.005mm',N'一楼机加车间','2012-03-29',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'数控车床',N'REALLY-2',N'数1',N'CAK3665DI',N'0.01mm',N'一楼机加车间','2013-12-31',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'数显鼓风干燥箱/烤箱',N'REALLY-14',N'烤箱',N'101A-0',NULL,N'二楼装配区','2014-06-05',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'数控车床',N'REALLY-4',N'数3',N'Viva T2c/500',N'0.01mm',N'一楼机加车间','2015-03-17',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'超声波清洗机',N'REALLY-16',N'清洗机',N'FRQ-20100ST',NULL,N'二楼清洗室','2015-04-12',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'抛光机',N'REALLY-44',N'抛光机',N'ZXH-Z615-1/ZXH-756',NULL,N'一楼机加车间','2015-05-17',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'激光打标机',N'REALLY-13',N'打标机',N'骄子LMK-F20',NULL,N'二楼装配区','2016-02-01',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'数控车床',N'REALLY-5',N'数4',N'Viva T2C/500',N'0.01mm',N'一楼机加车间','2018-05-11',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'锯床',N'REALLY-10',N'锯1',N'GZ4232',N'0.1mm',N'一楼机加车间','2018-08-26',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'内燃叉车',N'REALLY-33',N'油叉',N'CPCD30/3.0T',N'＜3T',N'一楼机加车间','2020-04-15',N'辆',1,NULL);
INSERT INTO @导入设备 VALUES (N'螺杆空压机',N'REALLY-23',N'15KW空压机',N'LU15 Pmi',N'最大压力0.8Mpa',N'一楼空压机室','2020-06-29',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'冷干机',N'已报废',NULL,N'PRIMAK D21',NULL,N'一楼空压机室','2020-06-29',N'台',1,N'报废');
INSERT INTO @导入设备 VALUES (N'数控车床',N'REALLY-25',N'数5',N'T55M含自动排屑器',N'0.01mm',N'一楼机加车间','2020-11-05',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'立卧两用数控台',N'加1#用',N'加1四轴',N'SKT13170F',N'0.05mm',N'加1设备内','2020-12-10',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'立式加工中心',N'REALLY-26',N'加3',N'VDF-850A',N'0.02mm',N'一楼机加车间','2020-12-10',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'立卧两用数控台',N'加3#用',NULL,N'SKT13200F',N'0.05mm',N'一楼机加车间','2020-12-10',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'带锯床',N'REALLY-31',N'锯2',N'B33',N'0.1mm',N'一楼机加车间','2021-02-01',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'电动攻丝机',N'RELLY-29',N'攻丝机2#',N'SW-U16-L',N'夹头范围M3-M16',N'一楼机加车间','2021-02-28',N'台',1,N'停用');
INSERT INTO @导入设备 VALUES (N'自动数控穿孔机',N'REALLY-28',N'电火花',N'NC4030高精度线规结构',N'穿孔直径0.8-3.0mm/0.05mm',N'一楼机加车间','2021-03-03',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'立式加工中心',N'REALLY-27',N'加4',N'VDF-850A',N'0.02mm',N'一楼机加车间','2021-03-11',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'摇臂钻床',N'REALLY-30',N'钻床',N'Z3050/16',N'夹头范围3-50',N'一楼机加车间','2021-03-17',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'航车',N'起重机/吊车',N'5T吊',N'YLHC-27',N'＜5T',N'一楼机加车间','2021-04-05',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'电动叉车',N'REALLY-34',N'1.5T电叉',N'CDD-1525/CPCZ1.5T',N'＜1.5T',N'二楼机加车间','2021-04-05',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'普通车床',N'REALLY-32',N'普2',N'CDE6150A',N'0.03mm',N'一楼机加车间','2021-09-02',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'数控车床',N'REALLY-36',N'数7',N'T55S',N'0.01mm',N'一楼机加车间','2022-04-03',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'数控车床',N'REALLY-37',N'数8',N'T55S',N'0.01mm',N'一楼机加车间','2022-04-03',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'洗地机',N'RELLY-38',N'洗地机',N'YZ-X2',NULL,N'一楼机加车间','2022-04-29',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'自动上下料设备',N'REALLY-39',N'数8机械人',N'HY2119/HY-JCSXL1-2',NULL,N'一楼机加车间','2022-06-22',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'加工中心',N'REALLY-40',N'加5',N'V11L',N'0.02mm',N'一楼机加车间','2022-12-09',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'转台',N'加5#用',N'加5四轴',N'HR-255N-K',N'0.05mm',N'一楼机加车间','2022-12-22',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'旋转接头',N'数7#数#8用',NULL,N'YQXJ56M-20',N'0.1mm',N'一楼机加车间','2023-02-06',N'台',2,NULL);
INSERT INTO @导入设备 VALUES (N'中实三爪液压卡盘',N'数7#数#8用',N'液压卡盘',N'CL-06A5',NULL,N'一楼机加车间','2023-02-14',N'台',2,NULL);
INSERT INTO @导入设备 VALUES (N'套丝机',N'RELLY-41',N'套丝机',N'SQ-50B1',NULL,N'一楼机加车间','2023-03-12',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'线号机',N'REALLY-17',N'线号机',N'LM-550B/LM550E',NULL,N'二楼装配车间','2023-04-22',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'高频加热炉',N'REALLY-42',N'高频加热',N'TGG-35KW进品版',NULL,N'二楼装配车间','2023-08-06',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'普通车床',N'REALLY-43',N'普3',N'CW6163E/1000',N'0.03mm',N'一楼机加车间','2023-08-14',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'光栅尺数显系统',N'普3#用',N'普3数显',N'Z向1100mm，X向570mm',NULL,N'一楼机加车间','2023-08-16',N'套',1,NULL);
INSERT INTO @导入设备 VALUES (N'卧式加工中心',N'REALLY-45',N'卧加1',N'HCN-6000L',N'0.01mm',N'一楼机加车间','2023-11-27',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'姊妹刀功能软件',N'数7#数#8用',N'对刀仪',N'6FC5800-OAM78-OYB0',NULL,N'一楼机加车间','2023-12-03',N'套',2,NULL);
INSERT INTO @导入设备 VALUES (N'自动料仓',N'机器人用',N'机器人料仓',N'配机械手定制件',NULL,N'一楼机加车间','2024-01-28',N'套',1,NULL);
INSERT INTO @导入设备 VALUES (N'电动悬挂起重机(欧式)',N'REALLY-46',N'普车吊',N'LX2.8T-7.3M/LD2-70/YJ',N'＜1.5T',N'一楼机加车间','2024-06-29',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'电动悬挂起重机(欧式)',N'REALLY-47',N'装配吊',N'LX2.8T-7M/LD2-40/OR6',N'＜1.5T',N'二楼车间装配区','2024-06-29',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'多功能除渣除油一体机',N'REALLY-50',N'除渣除油机',N'FGB-4',NULL,N'一楼机加车间','2024-06-29',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'桥式悬挂起重机',N'REALLY-49',N'原料吊',N'LX2-7m/LD2-70Y/YK',N'＜1.5T',N'一楼车间库房区','2024-06-29',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'切割剥皮两用机',N'REALLY-60',N'割管机',N'QB-51',NULL,N'二楼车间清洗间','2024-09-29',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'缩管机',N'REALLY-61',N'缩管机',N'KM-91C8-323',NULL,N'二楼车间清洗间','2024-09-29',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'冷冻式干燥机',N'REALLY-59',N'冷干机',N'AD2-10',NULL,N'一楼三坐标室','2024-11-25',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'工业脉冲集尘机',N'REALLY-52',N'磨床除尘机',N'FMCJC-2200',NULL,N'一楼机加车间','2024-11-25',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'闪链云智能物',N'REALLY-58',N'刀具柜',N'智能刀具柜主柜88货道+40侧边格/SCCM-03',NULL,N'一楼机加车间','2024-11-25',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'小锯床',N'REALLY-63',N'小带锯',N'DLY-18F1',N'切割范围45°φ100mm/90°180mm',N'二楼车间装配区','2024-11-25',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'车床桁架机械手',N'REALLY-51',N'数5机械手',N'CNPR-B02/CNPR-3000-B',NULL,N'一楼机加车间','2024-11-29',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'二氧焊机',N'REALLY-55',N'二氧焊机',N'YM-350FR2',NULL,N'一楼车间打磨间','2024-11-29',N'台',1,N'停用');
INSERT INTO @导入设备 VALUES (N'弯管机',N'REALLY-62',N'弯管机',N'DW38NC',NULL,N'二楼车间装配区','2024-11-29',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'数控机床(多主轴车削中心)',N'REALLY-57',N'数9',N'DUAL TURN200/DT200',N'0.01mm',N'一楼机加车间','2024-12-10',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'外圆磨床',N'REALLY-53',N'磨1',N'M1332B/1000',N'0.005mm',N'一楼机加车间','2024-12-25',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'气动压力机',N'REALLY-64',N'压力机1',N'大双柱63型 推力200KG',NULL,N'二楼车间装配','2024-12-03',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'气动压力机',N'REALLY-65',N'压力机2',N'大双柱63型 推力200KG',NULL,N'二楼车间装配','2024-12-03',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'气动压力机',N'REALLY-66',N'压力机3',N'大双柱63型 推力200KG',NULL,N'二楼车间装配','2024-12-03',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'卡套预装机+模具四套',N'REALLY-67',N'卡套预装机',N'KC-A01',NULL,N'二楼车间装配区','2025-01-01',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'单臂移动式焊烟净化器',N'REALLY-56',N'焊烟净化器',N'LW1201L-030AF（LW-C-M1201-030A1）',N'3000m³/小时',N'一楼车间打磨间','2025-02-13',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'冷干机',N'REALLY-24（注：替换原冷干机）',N'冷干机',N'FX45-230/1/50-CN',NULL,N'一楼空压机室','2025-02-07',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'管型预绝缘端子压接机',N'REALLY-68',N'端子机1',N'MD-E(0.5-4平方）',N'压接端子范围0.5-4mm²',N'二楼装配车间','2025-08-29',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'OTUT端子压接机2#',N'REALLY-69',N'端子机2',N'MD-180S/MD-180TUT',N'截面积0.33-0.82mm²',N'二楼装配车间','2025-09-04',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'车床桁架机械手',N'REALLY-70',N'数7机械手',N'CNPR-B02/SX-621',NULL,N'一楼机加车间','2025-08-31',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'氩弧焊机',N'REALLY-71',N'氩弧焊机',N'WSE-315',N'使用焊丝规格φ1.0-3.0mm/电流范围20-315A',N'一楼焊接区','2014-06-03',N'台',1,N'停用');
INSERT INTO @导入设备 VALUES (N'车床桁架机械手',N'REALLY-74',N'数9机械手',N'CNPR-B02/SX-620',N'0.1mm',N'一楼机加车间','2025-08-31',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'电动悬挂起重机(欧式)',N'REALLY-72',N'阀类吊',N'LX2.8T-6M',N'最大起重2.8T/链长6M',N'二楼阀类测试区','2025-12-04',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'马扎克数控车床',N'REALLY-73',N'数6',N'QTE200/500L',N'12工位刀塔/加工φ290/行程500',N'一楼机加车间','2026-01-10',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'马扎克加工中心',N'REALLY-75',N'加2',N'FF400V/30L',N'X500/Y400/Z400',N'一楼机加车间','2026-02-10',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'电动攻丝机',N'RELLY-54',N'攻丝机1#',N'M3-M20(YZ-20C)',N'夹头范围M3-M20',N'一楼机加车间','2025-12-01',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'手动液压叉车',N'REALLY-76',N'手动搬运车',N'黄色AC540 2.5T',N'最大承重2.5T',N'一楼机加车间','2025-12-11',N'辆',1,NULL);
INSERT INTO @导入设备 VALUES (N'455铜铝型材切割机(全自动)',N'REALLY-77',N'自动切割机',N'455铜铝型材切割机',N'最大切割行程100',N'一楼机加车间','2026-03-09',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'油雾收集器',N'REALLY-78',N'数5用',N'YWJC-LD300',NULL,N'一楼机加车间',NULL,N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'油雾收集器',N'REALLY-79',N'数7用',N'YWJC-LD300',NULL,N'一楼机加车间',NULL,N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'油雾收集器',N'REALLY-80',N'数8用',N'YWJC-LD300',NULL,N'一楼机加车间',NULL,N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'油雾收集器',N'REALLY-81',N'数6用',N'YWJC-LD300',NULL,N'一楼机加车间',NULL,N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'油雾收集器',N'REALLY-82',N'加2用',N'YWJC-LD1100',NULL,N'一楼机加车间',NULL,N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'油雾收集器',N'REALLY-83',N'加3用',N'YWJC-LD1100',NULL,N'一楼机加车间',NULL,N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'油雾收集器',N'REALLY-84',N'加5用',N'YWJC-LD1100',NULL,N'一楼机加车间',NULL,N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'油雾收集器',N'REALLY-85',N'卧加用',N'YWJC-LD1500',NULL,N'一楼机加车间',NULL,N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'油雾收集器',N'REALLY-86',N'数9用',N'YWJC-LD600',NULL,N'一楼机加车间',NULL,N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'无尘环保带锯床',N'REALLY-87',N'小带锯2#',N'DLY-18F1',N'45°切割范围φ100',N'一楼机打磨间','2026-05-20',N'台',1,NULL);
INSERT INTO @导入设备 VALUES (N'车床桁架机械手',N'REALLY-88',N'数6机械手',N'CNPR-B03',NULL,N'一楼机加车间',NULL,N'套',1,NULL);

MERGE [dbo].[基础数据_设备工位点检表] AS target
USING @导入设备 AS source
ON ISNULL(target.[公司编码], N'') = ISNULL(source.[公司编码], N'') AND ISNULL(source.[公司编码], N'') <> N''
WHEN MATCHED THEN UPDATE SET
  target.[名称]=source.[名称], target.[设备名称]=source.[生产用名], target.[设备型号]=source.[型号规格], target.[设备信息]=source.[设备信息], target.[使用部门]=source.[使用部门], target.[入账日期]=source.[入账日期], target.[单位]=source.[单位], target.[数量]=source.[数量], target.[状态]=source.[状态]
WHEN NOT MATCHED BY TARGET THEN
  INSERT ([名称],[公司编码],[设备名称],[设备型号],[设备信息],[使用部门],[入账日期],[单位],[数量],[状态])
  VALUES (source.[名称],source.[公司编码],source.[生产用名],source.[型号规格],source.[设备信息],source.[使用部门],source.[入账日期],source.[单位],source.[数量],source.[状态]);
GO

SELECT COUNT(*) AS [设备信息导入后总数] FROM [dbo].[基础数据_设备工位点检表];
GO
