找回密码
 注册账号

QQ登录

只需一步,快速开始

手机号码,快捷登录

手机号码,快捷登录

初学者课程:T3自学|T6自学|U8自学软件下载课件下载工具下载资料:通资料|U8资料|NC|培训|年结积分规则 | 使用常见问题Q&A
知识库:U8 | | NC | U9 | OA | 政务U8|U9|NCC|NC65|NC65客开|NCC客开新手必读 | 任务 | 快速增金币用友QQ群[微信群]
查看: 3383|回复: 0

[资料] 采购申请单根据物料清单制单,不用手工录入

[复制链接]
发表于 2018-12-22 13:58:47 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册账号

×
采购申请单,第一行输入产品编码和数量,保存后,系统自动带出该产品的一阶BOM信息录入到采购申请单中只写了一阶,全阶没写
采购申请单,第一行输入产品编码和数量,保存后,系统自动带出该产品的一阶BOM信息录入到采购申请单中
只写了一阶,全阶没写
USE [UFDATA_003_2018]--用友年度账套号
GO
create trigger TR_PU_AppVouchs
on [dbo].[PU_AppVouchs]
for insert
as
if exists(select * from inserted where cInvCode like '2%') --成品机编号以2开头
begin
declare @ID int
select @ID =ID from inserted
DELETE FROM PU_AppVouchs where ID=@ID
insert into PU_AppVouchs(ID,cInvCode,fQuantity,cVenCode,dRequirDate,dArriveDate)
select ID=@ID,cpscode,fQuantity=iPSQuantity*(select CAST(fQuantity AS FLOAT) from inserted),cVenCode=(SELECT cVenCode FROM inserted),
dRequirDate=(SELECT dRequirDate FROM inserted),dArriveDate=(SELECT dArriveDate FROM inserted)
from ProductStructures where cPSPCode=(SELECT cinvcode from inserted)
DECLARE @cCode varchar(50),@cCodeD varchar(50)
SET @cCodeD=(select 'PR'+CONVERT(VARCHAR(20),MAX(convert(INT,RIGHT(cCode,10)))) from PU_AppVouch)
SET @cCode=(select 'PR'+CONVERT(VARCHAR(20),MAX(convert(INT,RIGHT(cCode,10)))+1) from PU_AppVouch)
INSERT INTO PU_AppVouch(ID,cCode,dDate,cBusType,cDepCode,cPersonCode,cPTCode,iVTid,cMaker,cMemo)
SELECT distinct ID=@ID+1,@cCode,GETDATE(),cBusType=(SELECT cBusType FROM PU_AppVouch WHERE cCode=@cCodeD),
cDepCode=(SELECT cDepCode FROM PU_AppVouch WHERE cCode=@cCodeD),cPersonCode=(SELECT cPersonCode FROM PU_AppVouch WHERE cCode=@cCodeD),
cPTCode=(SELECT cPTCode FROM PU_AppVouch WHERE cCode=@cCodeD),iVTid=(SELECT iVTid FROM PU_AppVouch WHERE cCode=@cCodeD),
cMaker=(SELECT cMaker FROM PU_AppVouch WHERE cCode=@cCodeD),cMemo=(SELECT cMemo FROM PU_AppVouch WHERE cCode=@cCodeD)
from PU_AppVouch
DELETE FROM PU_AppVouch where ID=@ID
update PU_AppVouch set ID=@ID,cCode=@cCode where ID=@ID+1
END


您需要登录后才可以回帖 登录 | 注册账号

本版积分规则

QQ|站长微信|Archiver|手机版|小黑屋|用友之家 ( 蜀ICP备07505338号|51072502110008 )

GMT+8, 2024-12-22 17:20 , Processed in 0.059589 second(s), 10 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表