ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 效率神器,一键搞定繁琐工作
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
让更多数据处理,一键完成 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
查看: 4264|回复: 7

用友ERP U8 两个数据库 通信 触发器 程序

[复制链接]

TA的精华主题

TA的得分主题

发表于 2012-10-16 16:06 | 显示全部楼层 |阅读模式
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
CREATE TRIGGER insertinventory2 ON dbo.inventory
FOR INSERT
AS
Declare @cInvCode nvarchar(20)
Declare @cInvAddCode nvarchar(30)
Declare @cInvName nvarchar(60)
Declare @cInvStd nvarchar(60)
Declare @cInvCCode nvarchar(12)
Declare @cVenCode nvarchar(20)
Declare @cReplaceItem nvarchar(20)
Declare @cPosition nvarchar(20)
Declare @bSale bit
Declare @bPurchase bit
Declare @bSelf bit
Declare @bComsume bit
Declare @bProducing bit
Declare @bService bit
Declare @bAccessary bit
Declare @iTaxRate float
Declare @iInvWeight float
Declare @iVolume float
Declare @iInvRCost float
Declare @iInvSPrice float
Declare @iInvSCost float
Declare @iInvLSCost float
Declare @iInvNCost float
Declare @iInvAdvance float
Declare @iInvBatch float
Declare @iSafeNum float
Declare @iTopSum float
Declare @iLowSum float
Declare @iOverStock float
Declare @cInvABC nvarchar(1)
Declare @bInvQuality bit
Declare @bInvBatch bit
Declare @bInvEntrust bit
Declare @bInvOverStock bit
Declare @dSDate datetime
Declare @dEDate datetime
Declare @bFree1 bit
Declare @bFree2 bit
Declare @cInvDefine1 nvarchar(20)
Declare @cInvDefine2 nvarchar(20)
Declare @cInvDefine3 nvarchar(20)
Declare @bInvType bit
Declare @iInvMPCost float
Declare @cQuality nvarchar(100)
Declare @iInvSaleCost float
Declare @iInvSCost1 float
Declare @iInvSCost2 float
Declare @iInvSCost3 float
Declare @bFree3 bit
Declare @bFree4 bit
Declare @bFree5 bit
Declare @bFree6 bit
Declare @bFree7 bit
Declare @bFree8 bit
Declare @bFree9 bit
Declare @bFree10 bit
Declare @cCreatePerson nvarchar(20)
Declare @cModifyPerson nvarchar(20)
Declare @dModifyDate datetime
Declare @fSubscribePoint float
Declare @fVagQuantity float
Declare @cValueType nvarchar(20)
Declare @bFixExch bit
Declare @fOutExcess float
Declare @fInExcess float
Declare @iMassDate smallint
Declare @iWarnDays smallint
Declare @fExpensesExch float
Declare @bTrack bit
Declare @bSerial bit
Declare @bBarCode bit
Declare @cBarCode nvarchar(30)
Declare @cInvDefine4 nvarchar(60)
Declare @cInvDefine5 nvarchar(60)
Declare @cInvDefine6 nvarchar(60)
Declare @cInvDefine7 nvarchar(120)
Declare @cInvDefine8 nvarchar(120)
Declare @cInvDefine9 nvarchar(120)
Declare @cInvDefine10 nvarchar(120)
Declare @cInvDefine11 int
Declare @cInvDefine12 int
Declare @cInvDefine13 float
Declare @cInvDefine14 float
Declare @cInvDefine15 datetime
Declare @cInvDefine16 datetime
Declare @iGroupType tinyint
Declare @cGroupCode nvarchar(35)
Declare @cComUnitCode nvarchar(35)
Declare @cAssComUnitCode nvarchar(35)
Declare @cSAComUnitCode nvarchar(35)
Declare @cPUComUnitCode nvarchar(35)
Declare @cSTComUnitCode nvarchar(35)
Declare @cCAComUnitCode nvarchar(35)
Declare @cFrequency nvarchar(10)
Declare @iFrequency smallint
Declare @iDays smallint
Declare @dLastDate datetime
Declare @iWastage float
Declare @bSolitude bit
Declare @cEnterprise nvarchar(100)
Declare @cAddress nvarchar(255)
Declare @cFile nvarchar(40)
Declare @cLabel nvarchar(30)
Declare @cCheckOut nvarchar(30)
Declare @cLicence nvarchar(30)
Declare @bSpecialties bit
Declare @cDefWareHouse nvarchar(10)
Declare @iHighPrice float
Declare @iExpSaleRate float
Declare @cPriceGroup nvarchar(20)
Declare @cOfferGrade nvarchar(20)
Declare @iOfferRate float
Declare @cMonth nvarchar(6)
Declare @iAdvanceDate smallint
Declare @cCurrencyName nvarchar(60)
Declare @cProduceAddress nvarchar(255)
Declare @cProduceNation nvarchar(60)
Declare @cRegisterNo nvarchar(60)
Declare @cEnterNo nvarchar(60)
Declare @cPackingType nvarchar(60)
Declare @cEnglishName nvarchar(100)
Declare @bPropertyCheck bit
Declare @cPreparationType nvarchar(30)
Declare @cCommodity nvarchar(60)
Declare @iRecipeBatch tinyint
Declare @cNotPatentName nvarchar(30)
Declare @bPromotSales bit
Declare @iPlanPolicy smallint
Declare @iROPMethod smallint
Declare @iBatchRule smallint
Declare @fBatchIncrement float
Declare @iAssureProvideDays int
Declare @iTestStyle smallint
Declare @iDTMethod smallint
Declare @fDTRate float
Declare @fDTNum float
Declare @cDTUnit nvarchar(35)
Declare @iDTStyle smallint
Declare @iQTMethod int
Declare @PictureGUID uniqueidentifier
Declare @bPlanInv bit
Declare @bProxyForeign bit
Declare @bATOModel bit
Declare @bCheckItem bit
Declare @bPTOModel bit
Declare @bEquipment bit
Declare @cProductUnit nvarchar(35)
Declare @fOrderUpLimit float
Declare @cMassUnit smallint
Declare @fRetailPrice float
Declare @cInvDepCode nvarchar(12)
Declare @iAlterAdvance int
Declare @fAlterBaseNum float
Declare @cPlanMethod nvarchar(1)
Declare @bMPS bit
Declare @bROP bit
Declare @bRePlan bit
Declare @cSRPolicy nvarchar(2)
Declare @bBillUnite bit
Declare @iSupplyDay int
Declare @fSupplyMulti float
Declare @fMinSupply float
Declare @bCutMantissa bit
Declare @cInvPersonCode nvarchar(20)
Declare @iInvTfId int
Declare @cEngineerFigNo nvarchar(60)
Declare @bInTotalCost bit
Declare @iSupplyType smallint
Declare @bConfigFree1 bit
Declare @bConfigFree2 bit
Declare @bConfigFree3 bit
Declare @bConfigFree4 bit
Declare @bConfigFree5 bit
Declare @bConfigFree6 bit
Declare @bConfigFree7 bit
Declare @bConfigFree8 bit
Declare @bConfigFree9 bit
Declare @bConfigFree10 bit
Declare @iDTLevel smallint
Declare @cDTAQL nvarchar(20)
Declare @bPeriodDT bit
Declare @cDTPeriod nvarchar(30)
Declare @iBigMonth int
Declare @iBigDay int
Declare @iSmallMonth int
Declare @iSmallDay int
Declare @bOutInvDT bit
Declare @bBackInvDT bit
Declare @iEndDTStyle smallint
Declare @bDTWarnInv bit
Declare @fBackTaxRate float
Declare @cCIQCode nvarchar(30)
Declare @cWGroupCode nvarchar(35)
Declare @cWUnit nvarchar(35)
Declare @fGrossW float
Declare @cVGroupCode nvarchar(35)
Declare @cVUnit nvarchar(35)
Declare @fLength float
Declare @fWidth float
Declare @fHeight float
Declare @iDTUCounter int
Declare @iDTDCounter int
Declare @iBatchCounter int
Declare @cShopUnit nvarchar(35)
Declare @cPurPersonCode nvarchar(20)
Declare @bImportMedicine bit
Declare @bFirstBusiMedicine bit
Declare @bForeExpland bit
Declare @cInvPlanCode nvarchar(20)
Declare @fConvertRate float
Declare @dReplaceDate datetime
Declare @bInvModel bit
Declare @bKCCutMantissa bit
Declare @bReceiptByDT bit
Declare @iImpTaxRate float
Declare @iExpTaxRate float
Declare @bExpSale bit
Declare @iDrawBatch int
Declare @bCheckBSATP bit
Declare @cInvProjectCode nvarchar(16)
Declare @iTestRule smallint
Declare @cRuleCode nvarchar(20)
Declare @bCheckFree1 bit
Declare @bCheckFree2 bit
Declare @bCheckFree3 bit
Declare @bCheckFree4 bit
Declare @bCheckFree5 bit
Declare @bCheckFree6 bit
Declare @bCheckFree7 bit
Declare @bCheckFree8 bit
Declare @bCheckFree9 bit
Declare @bCheckFree10 bit
Declare @bBomMain bit
Declare @bBomSub bit
Declare @bProductBill bit
Declare @iCheckATP smallint
Declare @iInvATPId int
Declare @iPlanTfDay int
Declare @iOverlapDay int
Declare @bPiece bit
Declare @bSrvItem bit
Declare @bSrvFittings bit
Declare @fMaxSupply float
Declare @fMinSplit float
Declare @bSpecialOrder bit
Declare @bTrackSaleBill bit
set @cinvcode =(select cinvcode from inserted)
if not exists(select cinvcode from UFDATA_901_2012.dbo.inventory where cinvcode = @cinvcode)
begin
insert UFDATA_901_2012.dbo.inventory (cInvCode,cInvAddCode,cInvName,cInvStd,cInvCCode,cVenCode,cReplaceItem,cPosition,bSale,bPurchase,bSelf,bComsume,bProducing,bService,bAccessary,iTaxRate,iInvWeight,iVolume,iInvRCost,iInvSPrice,iInvSCost,iInvLSCost,iInvNCost,iInvAdvance,iInvBatch,iSafeNum,iTopSum,iLowSum,iOverStock,cInvABC,bInvQuality,bInvBatch,bInvEntrust,bInvOverStock,dSDate,dEDate,bFree1,bFree2,cInvDefine1,cInvDefine2,cInvDefine3,bInvType,iInvMPCost,cQuality,iInvSaleCost,iInvSCost1,iInvSCost2,iInvSCost3,bFree3,bFree4,bFree5,bFree6,bFree7,bFree8,bFree9,bFree10,cCreatePerson,cModifyPerson,dModifyDate,fSubscribePoint,fVagQuantity,cValueType,bFixExch,fOutExcess,fInExcess,iMassDate,iWarnDays,fExpensesExch,bTrack,bSerial,bBarCode,iId,cBarCode,cInvDefine4,cInvDefine5,cInvDefine6,cInvDefine7,cInvDefine8,cInvDefine9,cInvDefine10,cInvDefine11,cInvDefine12,cInvDefine13,cInvDefine14,cInvDefine15,cInvDefine16,iGroupType,cGroupCode,cComUnitCode,cAssComUnitCode,cSAComUnitCode,cPUComUnitCode,cSTComUnitCode,cCAComUnitCode,cFrequency,iFrequency,iDays,dLastDate,iWastage,bSolitude,cEnterprise,cAddress,cFile,cLabel,cCheckOut,cLicence,bSpecialties,cDefWareHouse,iHighPrice,iExpSaleRate,cPriceGroup,cOfferGrade,iOfferRate,cMonth,iAdvanceDate,cCurrencyName,cProduceAddress,cProduceNation,cRegisterNo,cEnterNo,cPackingType,cEnglishName,bPropertyCheck,cPreparationType,cCommodity,iRecipeBatch,cNotPatentName,bPromotSales,iPlanPolicy,iROPMethod,iBatchRule,fBatchIncrement,iAssureProvideDays,iTestStyle,iDTMethod,fDTRate,fDTNum,cDTUnit,iDTStyle,iQTMethod,PictureGUID,bPlanInv,bProxyForeign,bATOModel,bCheckItem,bPTOModel,bEquipment,cProductUnit,fOrderUpLimit,cMassUnit,fRetailPrice,cInvDepCode,iAlterAdvance,fAlterBaseNum,cPlanMethod,bMPS,bROP,bRePlan,cSRPolicy,bBillUnite,iSupplyDay,fSupplyMulti,fMinSupply,bCutMantissa,cInvPersonCode,iInvTfId,cEngineerFigNo,bInTotalCost,iSupplyType,bConfigFree1,bConfigFree2,bConfigFree3,bConfigFree4,bConfigFree5,bConfigFree6,bConfigFree7,bConfigFree8,bConfigFree9,bConfigFree10,iDTLevel,cDTAQL,bPeriodDT,cDTPeriod,iBigMonth,iBigDay,iSmallMonth,iSmallDay,bOutInvDT,bBackInvDT,iEndDTStyle,bDTWarnInv,fBackTaxRate,cCIQCode,cWGroupCode,cWUnit,fGrossW,cVGroupCode,cVUnit,fLength,fWidth,fHeight,iDTUCounter,iDTDCounter,iBatchCounter,cShopUnit,cPurPersonCode,bImportMedicine,bFirstBusiMedicine,bForeExpland,cInvPlanCode,fConvertRate,dReplaceDate,bInvModel,bKCCutMantissa,bReceiptByDT,iImpTaxRate,iExpTaxRate,bExpSale,iDrawBatch,bCheckBSATP,cInvProjectCode,iTestRule,cRuleCode,bCheckFree1,bCheckFree2,bCheckFree3,bCheckFree4,bCheckFree5,bCheckFree6,bCheckFree7,bCheckFree8,bCheckFree9,bCheckFree10,bBomMain,bBomSub,bProductBill,iCheckATP,iInvATPId,iPlanTfDay,iOverlapDay,bPiece,bSrvItem,bSrvFittings,fMaxSupply,fMinSplit,bSpecialOrder,bTrackSaleBill) select cInvCode,cInvAddCode,cInvName,cInvStd,cInvCCode,cVenCode,cReplaceItem,cPosition,bSale,bPurchase,bSelf,bComsume,bProducing,bService,bAccessary,iTaxRate,iInvWeight,iVolume,iInvRCost,iInvSPrice,iInvSCost,iInvLSCost,iInvNCost,iInvAdvance,iInvBatch,iSafeNum,iTopSum,iLowSum,iOverStock,cInvABC,bInvQuality,bInvBatch,bInvEntrust,bInvOverStock,dSDate,dEDate,bFree1,bFree2,cInvDefine1,cInvDefine2,cInvDefine3,bInvType,iInvMPCost,cQuality,iInvSaleCost,iInvSCost1,iInvSCost2,iInvSCost3,bFree3,bFree4,bFree5,bFree6,bFree7,bFree8,bFree9,bFree10,cCreatePerson,cModifyPerson,dModifyDate,fSubscribePoint,fVagQuantity,cValueType,bFixExch,fOutExcess,fInExcess,iMassDate,iWarnDays,fExpensesExch,bTrack,bSerial,bBarCode,iId,cBarCode,cInvDefine4,cInvDefine5,cInvDefine6,cInvDefine7,cInvDefine8,cInvDefine9,cInvDefine10,cInvDefine11,cInvDefine12,cInvDefine13,cInvDefine14,cInvDefine15,cInvDefine16,iGroupType,cGroupCode,cComUnitCode,cAssComUnitCode,cSAComUnitCode,cPUComUnitCode,cSTComUnitCode,cCAComUnitCode,cFrequency,iFrequency,iDays,dLastDate,iWastage,bSolitude,cEnterprise,cAddress,cFile,cLabel,cCheckOut,cLicence,bSpecialties,cDefWareHouse,iHighPrice,iExpSaleRate,cPriceGroup,cOfferGrade,iOfferRate,cMonth,iAdvanceDate,cCurrencyName,cProduceAddress,cProduceNation,cRegisterNo,cEnterNo,cPackingType,cEnglishName,bPropertyCheck,cPreparationType,cCommodity,iRecipeBatch,cNotPatentName,bPromotSales,iPlanPolicy,iROPMethod,iBatchRule,fBatchIncrement,iAssureProvideDays,iTestStyle,iDTMethod,fDTRate,fDTNum,cDTUnit,iDTStyle,iQTMethod,PictureGUID,bPlanInv,bProxyForeign,bATOModel,bCheckItem,bPTOModel,bEquipment,cProductUnit,fOrderUpLimit,cMassUnit,fRetailPrice,cInvDepCode,iAlterAdvance,fAlterBaseNum,cPlanMethod,bMPS,bROP,bRePlan,cSRPolicy,bBillUnite,iSupplyDay,fSupplyMulti,fMinSupply,bCutMantissa,cInvPersonCode,iInvTfId,cEngineerFigNo,bInTotalCost,iSupplyType,bConfigFree1,bConfigFree2,bConfigFree3,bConfigFree4,bConfigFree5,bConfigFree6,bConfigFree7,bConfigFree8,bConfigFree9,bConfigFree10,iDTLevel,cDTAQL,bPeriodDT,cDTPeriod,iBigMonth,iBigDay,iSmallMonth,iSmallDay,bOutInvDT,bBackInvDT,iEndDTStyle,bDTWarnInv,fBackTaxRate,cCIQCode,cWGroupCode,cWUnit,fGrossW,cVGroupCode,cVUnit,fLength,fWidth,fHeight,iDTUCounter,iDTDCounter,iBatchCounter,cShopUnit,cPurPersonCode,bImportMedicine,bFirstBusiMedicine,bForeExpland,cInvPlanCode,fConvertRate,dReplaceDate,bInvModel,bKCCutMantissa,bReceiptByDT,iImpTaxRate,iExpTaxRate,bExpSale,iDrawBatch,bCheckBSATP,cInvProjectCode,iTestRule,cRuleCode,bCheckFree1,bCheckFree2,bCheckFree3,bCheckFree4,bCheckFree5,bCheckFree6,bCheckFree7,bCheckFree8,bCheckFree9,bCheckFree10,bBomMain,bBomSub,bProductBill,iCheckATP,iInvATPId,iPlanTfDay,iOverlapDay,bPiece,bSrvItem,bSrvFittings,fMaxSupply,fMinSplit,bSpecialOrder,bTrackSaleBill from inserted
End


TA的精华主题

TA的得分主题

发表于 2012-10-17 21:20 | 显示全部楼层
不懂,说的详细一些???

TA的精华主题

TA的得分主题

 楼主| 发表于 2012-10-21 13:16 | 显示全部楼层
如果你有2个帐套,可以利用该代码进行2个帐套间数据通信。

TA的精华主题

TA的得分主题

发表于 2013-9-9 15:50 | 显示全部楼层

TA的精华主题

TA的得分主题

 楼主| 发表于 2014-6-7 10:12 | 显示全部楼层

TA的精华主题

TA的得分主题

发表于 2014-6-7 11:16 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助
想问一下。你做那么多的参数声明来做什么??

TA的精华主题

TA的得分主题

 楼主| 发表于 2014-6-13 14:04 | 显示全部楼层
触发器 使用 变量前 必须 先声明

TA的精华主题

TA的得分主题

发表于 2014-6-14 22:04 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
你声明了几个,又用了几个??
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2024-12-26 23:29 , Processed in 0.036986 second(s), 9 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

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